webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Public Member Functions | List of all members
CheckedArrayByteSink Class Reference

#include <bytestream.h>

Inheritance diagram for CheckedArrayByteSink:
ByteSink ByteSink ByteSink UMemory UMemory UMemory UMemory UMemory UMemory UMemory UMemory UMemory

Public Member Functions

 CheckedArrayByteSink (char *outbuf, int32_t capacity)
 
virtual ~CheckedArrayByteSink ()
 
virtual CheckedArrayByteSinkReset ()
 
virtual void Append (const char *bytes, int32_t n)
 
virtual char * GetAppendBuffer (int32_t min_capacity, int32_t desired_capacity_hint, char *scratch, int32_t scratch_capacity, int32_t *result_capacity)
 
int32_t NumberOfBytesWritten () const
 
UBool Overflowed () const
 
int32_t NumberOfBytesAppended () const
 
 CheckedArrayByteSink (char *outbuf, int32_t capacity)
 
virtual ~CheckedArrayByteSink ()
 
virtual CheckedArrayByteSinkReset ()
 
virtual void Append (const char *bytes, int32_t n)
 
virtual char * GetAppendBuffer (int32_t min_capacity, int32_t desired_capacity_hint, char *scratch, int32_t scratch_capacity, int32_t *result_capacity)
 
int32_t NumberOfBytesWritten () const
 
UBool Overflowed () const
 
int32_t NumberOfBytesAppended () const
 
 CheckedArrayByteSink (char *outbuf, int32_t capacity)
 
virtual ~CheckedArrayByteSink ()
 
virtual CheckedArrayByteSinkReset ()
 
virtual void Append (const char *bytes, int32_t n)
 
virtual char * GetAppendBuffer (int32_t min_capacity, int32_t desired_capacity_hint, char *scratch, int32_t scratch_capacity, int32_t *result_capacity)
 
int32_t NumberOfBytesWritten () const
 
UBool Overflowed () const
 
int32_t NumberOfBytesAppended () const
 
- Public Member Functions inherited from ByteSink
 ByteSink ()
 
virtual ~ByteSink ()
 
virtual void Flush ()
 
 ByteSink ()
 
virtual ~ByteSink ()
 
virtual void Flush ()
 
 ByteSink ()
 
virtual ~ByteSink ()
 
virtual void Flush ()
 

Detailed Description

Implementation of ByteSink that writes to a flat byte array, with bounds-checking: This sink will not write more than capacity bytes to outbuf. If more than capacity bytes are Append()ed, then excess bytes are ignored, and Overflowed() will return true. Overflow does not cause a runtime error. ICU 4.2

Constructor & Destructor Documentation

◆ CheckedArrayByteSink() [1/3]

CheckedArrayByteSink::CheckedArrayByteSink ( char *  outbuf,
int32_t  capacity 
)

Constructs a ByteSink that will write to outbuf[0..capacity-1].

Parameters
outbufbuffer to write to
capacitysize of the buffer ICU 4.2

◆ ~CheckedArrayByteSink() [1/3]

virtual CheckedArrayByteSink::~CheckedArrayByteSink ( )
virtual

Destructor. ICU 4.2

◆ CheckedArrayByteSink() [2/3]

CheckedArrayByteSink::CheckedArrayByteSink ( char *  outbuf,
int32_t  capacity 
)

Constructs a ByteSink that will write to outbuf[0..capacity-1].

Parameters
outbufbuffer to write to
capacitysize of the buffer ICU 4.2

◆ ~CheckedArrayByteSink() [2/3]

virtual CheckedArrayByteSink::~CheckedArrayByteSink ( )
virtual

Destructor. ICU 4.2

◆ CheckedArrayByteSink() [3/3]

CheckedArrayByteSink::CheckedArrayByteSink ( char *  outbuf,
int32_t  capacity 
)

Constructs a ByteSink that will write to outbuf[0..capacity-1].

Parameters
outbufbuffer to write to
capacitysize of the buffer ICU 4.2

◆ ~CheckedArrayByteSink() [3/3]

virtual CheckedArrayByteSink::~CheckedArrayByteSink ( )
virtual

Destructor. ICU 4.2

Member Function Documentation

◆ Append() [1/3]

virtual void CheckedArrayByteSink::Append ( const char *  bytes,
int32_t  n 
)
virtual

Append "bytes[0,n-1]" to this.

Parameters
bytesthe pointer to the bytes
nthe number of bytes; must be non-negative ICU 4.2

Implements ByteSink.

◆ Append() [2/3]

virtual void CheckedArrayByteSink::Append ( const char *  bytes,
int32_t  n 
)
virtual

Append "bytes[0,n-1]" to this.

Parameters
bytesthe pointer to the bytes
nthe number of bytes; must be non-negative ICU 4.2

Implements ByteSink.

◆ Append() [3/3]

virtual void CheckedArrayByteSink::Append ( const char *  bytes,
int32_t  n 
)
virtual

Append "bytes[0,n-1]" to this.

Parameters
bytesthe pointer to the bytes
nthe number of bytes; must be non-negative ICU 4.2

Implements ByteSink.

◆ GetAppendBuffer() [1/3]

virtual char* CheckedArrayByteSink::GetAppendBuffer ( int32_t  min_capacity,
int32_t  desired_capacity_hint,
char *  scratch,
int32_t  scratch_capacity,
int32_t result_capacity 
)
virtual

Returns a writable buffer for appending and writes the buffer's capacity to *result_capacity. For details see the base class documentation.

Parameters
min_capacityrequired minimum capacity of the returned buffer; must be non-negative
desired_capacity_hintdesired capacity of the returned buffer; must be non-negative
scratchdefault caller-owned buffer
scratch_capacitycapacity of the scratch buffer
result_capacitypointer to an integer which will be set to the capacity of the returned buffer
Returns
a buffer with *result_capacity>=min_capacity ICU 4.2

Reimplemented from ByteSink.

◆ GetAppendBuffer() [2/3]

virtual char* CheckedArrayByteSink::GetAppendBuffer ( int32_t  min_capacity,
int32_t  desired_capacity_hint,
char *  scratch,
int32_t  scratch_capacity,
int32_t result_capacity 
)
virtual

Returns a writable buffer for appending and writes the buffer's capacity to *result_capacity. For details see the base class documentation.

Parameters
min_capacityrequired minimum capacity of the returned buffer; must be non-negative
desired_capacity_hintdesired capacity of the returned buffer; must be non-negative
scratchdefault caller-owned buffer
scratch_capacitycapacity of the scratch buffer
result_capacitypointer to an integer which will be set to the capacity of the returned buffer
Returns
a buffer with *result_capacity>=min_capacity ICU 4.2

Reimplemented from ByteSink.

◆ GetAppendBuffer() [3/3]

virtual char* CheckedArrayByteSink::GetAppendBuffer ( int32_t  min_capacity,
int32_t  desired_capacity_hint,
char *  scratch,
int32_t  scratch_capacity,
int32_t result_capacity 
)
virtual

Returns a writable buffer for appending and writes the buffer's capacity to *result_capacity. For details see the base class documentation.

Parameters
min_capacityrequired minimum capacity of the returned buffer; must be non-negative
desired_capacity_hintdesired capacity of the returned buffer; must be non-negative
scratchdefault caller-owned buffer
scratch_capacitycapacity of the scratch buffer
result_capacitypointer to an integer which will be set to the capacity of the returned buffer
Returns
a buffer with *result_capacity>=min_capacity ICU 4.2

Reimplemented from ByteSink.

◆ NumberOfBytesAppended() [1/3]

int32_t CheckedArrayByteSink::NumberOfBytesAppended ( ) const
inline

Returns the number of bytes appended to the sink. If Overflowed() then NumberOfBytesAppended()>NumberOfBytesWritten() else they return the same number.

Returns
number of bytes written to the buffer ICU 4.6

◆ NumberOfBytesAppended() [2/3]

int32_t CheckedArrayByteSink::NumberOfBytesAppended ( ) const
inline

Returns the number of bytes appended to the sink. If Overflowed() then NumberOfBytesAppended()>NumberOfBytesWritten() else they return the same number.

Returns
number of bytes written to the buffer ICU 4.6

◆ NumberOfBytesAppended() [3/3]

int32_t CheckedArrayByteSink::NumberOfBytesAppended ( ) const
inline

Returns the number of bytes appended to the sink. If Overflowed() then NumberOfBytesAppended()>NumberOfBytesWritten() else they return the same number.

Returns
number of bytes written to the buffer ICU 4.6

◆ NumberOfBytesWritten() [1/3]

int32_t CheckedArrayByteSink::NumberOfBytesWritten ( ) const
inline

Returns the number of bytes actually written to the sink.

Returns
number of bytes written to the buffer ICU 4.2

◆ NumberOfBytesWritten() [2/3]

int32_t CheckedArrayByteSink::NumberOfBytesWritten ( ) const
inline

Returns the number of bytes actually written to the sink.

Returns
number of bytes written to the buffer ICU 4.2

◆ NumberOfBytesWritten() [3/3]

int32_t CheckedArrayByteSink::NumberOfBytesWritten ( ) const
inline

Returns the number of bytes actually written to the sink.

Returns
number of bytes written to the buffer ICU 4.2

◆ Overflowed() [1/3]

UBool CheckedArrayByteSink::Overflowed ( ) const
inline

Returns true if any bytes were discarded, i.e., if there was an attempt to write more than 'capacity' bytes.

Returns
TRUE if more than 'capacity' bytes were Append()ed ICU 4.2

◆ Overflowed() [2/3]

UBool CheckedArrayByteSink::Overflowed ( ) const
inline

Returns true if any bytes were discarded, i.e., if there was an attempt to write more than 'capacity' bytes.

Returns
TRUE if more than 'capacity' bytes were Append()ed ICU 4.2

◆ Overflowed() [3/3]

UBool CheckedArrayByteSink::Overflowed ( ) const
inline

Returns true if any bytes were discarded, i.e., if there was an attempt to write more than 'capacity' bytes.

Returns
TRUE if more than 'capacity' bytes were Append()ed ICU 4.2

◆ Reset() [1/3]

virtual CheckedArrayByteSink& CheckedArrayByteSink::Reset ( )
virtual

Returns the sink to its original state, without modifying the buffer. Useful for reusing both the buffer and the sink for multiple streams. Resets the state to NumberOfBytesWritten()=NumberOfBytesAppended()=0 and Overflowed()=FALSE.

Returns
*this ICU 4.6

◆ Reset() [2/3]

virtual CheckedArrayByteSink& CheckedArrayByteSink::Reset ( )
virtual

Returns the sink to its original state, without modifying the buffer. Useful for reusing both the buffer and the sink for multiple streams. Resets the state to NumberOfBytesWritten()=NumberOfBytesAppended()=0 and Overflowed()=FALSE.

Returns
*this ICU 4.6

◆ Reset() [3/3]

virtual CheckedArrayByteSink& CheckedArrayByteSink::Reset ( )
virtual

Returns the sink to its original state, without modifying the buffer. Useful for reusing both the buffer and the sink for multiple streams. Resets the state to NumberOfBytesWritten()=NumberOfBytesAppended()=0 and Overflowed()=FALSE.

Returns
*this ICU 4.6

The documentation for this class was generated from the following file: