32 #ifndef __BYTESTREAM_H__ 33 #define __BYTESTREAM_H__ 42 #if U_SHOW_CPLUSPLUS_API 72 virtual void Append(
const char* bytes, int32_t n) = 0;
116 virtual char* GetAppendBuffer(int32_t min_capacity,
117 int32_t desired_capacity_hint,
118 char* scratch, int32_t scratch_capacity,
119 int32_t* result_capacity);
129 virtual void Flush();
177 virtual void Append(
const char* bytes, int32_t n);
193 int32_t desired_capacity_hint,
194 char* scratch, int32_t scratch_capacity,
195 int32_t* result_capacity);
219 const int32_t capacity_;
234 template<
typename StringClass>
251 if (initialAppendCapacity > 0 &&
252 (uint32_t)initialAppendCapacity > (dest->capacity() - dest->length())) {
253 dest->reserve(dest->length() + initialAppendCapacity);
262 virtual void Append(
const char* data, int32_t n) { dest_->append(data, n); }
275 #endif // __BYTESTREAM_H__ 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.
StringByteSink(StringClass *dest)
Constructs a ByteSink that will append bytes to the dest string.
int32_t NumberOfBytesWritten() const
Returns the number of bytes actually written to the sink.
virtual void Append(const char *data, int32_t n)
Append "bytes[0,n-1]" to this.
ByteSink()
Default constructor.
A ByteSink can be filled with bytes.
UBool Overflowed() const
Returns true if any bytes were discarded, i.e., if there was an attempt to write more than 'capacity'...
int32_t NumberOfBytesAppended() const
Returns the number of bytes appended to the sink.
virtual void Append(const char *bytes, int32_t n)=0
Append "bytes[0,n-1]" to this.
Implementation of ByteSink that writes to a flat byte array, with bounds-checking: This sink will not...
StringByteSink(StringClass *dest, int32_t initialAppendCapacity)
Constructs a ByteSink that reserves append capacity and will append bytes to the dest string...
C++ API: Central ICU header for including the C++ standard <string> header and for related definition...
C++ API: Common ICU base class UObject.
Basic definitions for ICU, for both C and C++ APIs.
Implementation of ByteSink that writes to a "string".
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside...
UMemory is the common ICU base class.
int8_t UBool
The ICU boolean type.