30 #ifndef __BYTESTREAM_H__
31 #define __BYTESTREAM_H__
67 virtual void Append(
const char* bytes, int32_t n) = 0;
112 int32_t desired_capacity_hint,
113 char* scratch, int32_t scratch_capacity,
114 int32_t* result_capacity);
172 virtual void Append(
const char* bytes, int32_t n);
188 int32_t desired_capacity_hint,
189 char* scratch, int32_t scratch_capacity,
190 int32_t* result_capacity);
214 const int32_t capacity_;
223 #if U_HAVE_STD_STRING
230 template<
typename StringClass>
245 virtual void Append(
const char* data, int32_t n) { dest_->append(data, n); }
A ByteSink can be filled with bytes.
virtual void Append(const char *bytes, int32_t n)=0
Append "bytes[0,n-1]" to this.
ByteSink()
Default constructor.
virtual void Flush()
Flush internal buffers.
virtual ~ByteSink()
Virtual destructor.
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.
Implementation of ByteSink that writes to a flat byte array, with bounds-checking: This sink will not...
int32_t NumberOfBytesWritten() const
Returns the number of bytes actually written to the sink.
virtual CheckedArrayByteSink & Reset()
Returns the sink to its original state, without modifying the buffer.
virtual ~CheckedArrayByteSink()
Destructor.
CheckedArrayByteSink(char *outbuf, int32_t capacity)
Constructs a ByteSink that will write to outbuf[0..capacity-1].
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)
Append "bytes[0,n-1]" to this.
int32_t NumberOfBytesAppended() const
Returns the number of bytes appended to the sink.
UBool Overflowed() const
Returns true if any bytes were discarded, i.e., if there was an attempt to write more than 'capacity'...
Implementation of ByteSink that writes to a "string".
StringByteSink(StringClass *dest)
Constructs a ByteSink that will append bytes to the dest string.
virtual void Append(const char *data, int32_t n)
Append "bytes[0,n-1]" to this.
UMemory is the common ICU base class.
C++ API: Central ICU header for including the C++ standard <string> header and for related definition...
int8_t UBool
The ICU boolean type.
C++ API: Common ICU base class UObject.
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.
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.