30 #ifndef __BYTESTREAM_H__
31 #define __BYTESTREAM_H__
67 virtual void Append(
const char* bytes,
int32_t n) = 0;
111 virtual char* GetAppendBuffer(
int32_t min_capacity,
113 char* scratch,
int32_t scratch_capacity,
123 virtual void Flush();
174 char* scratch,
int32_t scratch_capacity,
199 #if U_HAVE_STD_STRING
206 template<
typename StringClass>
207 class StringByteSink :
public ByteSink {
214 StringByteSink(StringClass* dest) : dest_(dest) { }
221 virtual void Append(
const char* data,
int32_t n) { dest_->append(data, n); }
225 StringByteSink(
const StringByteSink &);
226 StringByteSink &operator=(
const StringByteSink &);
233 #endif // __BYTESTREAM_H__
A ByteSink can be filled with bytes.
int32_t NumberOfBytesWritten() const
Returns the number of bytes actually written to the sink.
Implementation of ByteSink that writes to a flat byte array, with bounds-checking: This sink will not...
virtual ~ByteSink()
Virtual destructor.
ByteSink()
Default constructor.
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
C++ API: Central ICU header for including the C++ standard <string> header and for related definition...
UMemory is the common ICU base class.
C++ API: Common ICU base class UObject.
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API If the compiler doesn't support namespaces...
virtual char * GetAppendBuffer(int32_t min_capacity, int32_t desired_capacity_hint, char *scratch, int32_t scratch_capacity, int32_t *result_capacity)
Returns a writable buffer for appending and writes the buffer's capacity to *result_capacity.
virtual void Append(const char *bytes, int32_t n)=0
Append "bytes[0,n-1]" to this.
Basic definitions for ICU, for both C and C++ APIs.
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside...
signed int int32_t
Define 64 bit limits.
UBool Overflowed() const
Returns true if any bytes were discarded, i.e., if there was an attempt to write more than 'capacity'...
int8_t UBool
The ICU boolean type.