webkit
2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
|
#include <bytestream.h>
Public Member Functions | |
ByteSink () | |
virtual | ~ByteSink () |
virtual void | Append (const char *bytes, int32_t n)=0 |
virtual char * | GetAppendBuffer (int32_t min_capacity, int32_t desired_capacity_hint, char *scratch, int32_t scratch_capacity, int32_t *result_capacity) |
virtual void | Flush () |
ByteSink () | |
virtual | ~ByteSink () |
virtual void | Append (const char *bytes, int32_t n)=0 |
virtual char * | GetAppendBuffer (int32_t min_capacity, int32_t desired_capacity_hint, char *scratch, int32_t scratch_capacity, int32_t *result_capacity) |
virtual void | Flush () |
ByteSink () | |
virtual | ~ByteSink () |
virtual void | Append (const char *bytes, int32_t n)=0 |
virtual char * | GetAppendBuffer (int32_t min_capacity, int32_t desired_capacity_hint, char *scratch, int32_t scratch_capacity, int32_t *result_capacity) |
virtual void | Flush () |
|
inline |
Default constructor. ICU 4.2
|
virtual |
Virtual destructor. ICU 4.2
|
inline |
Default constructor. ICU 4.2
|
virtual |
Virtual destructor. ICU 4.2
|
inline |
Default constructor. ICU 4.2
|
virtual |
Virtual destructor. ICU 4.2
Append "bytes[0,n-1]" to this.
bytes | the pointer to the bytes |
n | the number of bytes; must be non-negative ICU 4.2 |
Implemented in CheckedArrayByteSink, CheckedArrayByteSink, and CheckedArrayByteSink.
Append "bytes[0,n-1]" to this.
bytes | the pointer to the bytes |
n | the number of bytes; must be non-negative ICU 4.2 |
Implemented in CheckedArrayByteSink, CheckedArrayByteSink, and CheckedArrayByteSink.
Append "bytes[0,n-1]" to this.
bytes | the pointer to the bytes |
n | the number of bytes; must be non-negative ICU 4.2 |
Implemented in CheckedArrayByteSink, CheckedArrayByteSink, and CheckedArrayByteSink.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Returns a writable buffer for appending and writes the buffer's capacity to *result_capacity. Guarantees *result_capacity>=min_capacity. May return a pointer to the caller-owned scratch buffer which must have scratch_capacity>=min_capacity. The returned buffer is only valid until the next operation on this ByteSink.
After writing at most *result_capacity bytes, call Append() with the pointer returned from this function and the number of bytes written. Many Append() implementations will avoid copying bytes if this function returned an internal buffer.
Partial usage example: int32_t capacity; char* buffer = sink->GetAppendBuffer(..., &capacity); ... Write n bytes into buffer, with n <= capacity. sink->Append(buffer, n); In many implementations, that call to Append will avoid copying bytes.
If the ByteSink allocates or reallocates an internal buffer, it should use the desired_capacity_hint if appropriate. If a caller cannot provide a reasonable guess at the desired capacity, it should pass desired_capacity_hint=0.
If a non-scratch buffer is returned, the caller may only pass a prefix to it to Append(). That is, it is not correct to pass an interior pointer to Append().
The default implementation always returns the scratch buffer.
min_capacity | required minimum capacity of the returned buffer; must be non-negative |
desired_capacity_hint | desired capacity of the returned buffer; must be non-negative |
scratch | default caller-owned buffer |
scratch_capacity | capacity of the scratch buffer |
result_capacity | pointer to an integer which will be set to the capacity of the returned buffer |
Reimplemented in CheckedArrayByteSink, CheckedArrayByteSink, and CheckedArrayByteSink.
|
virtual |
Returns a writable buffer for appending and writes the buffer's capacity to *result_capacity. Guarantees *result_capacity>=min_capacity. May return a pointer to the caller-owned scratch buffer which must have scratch_capacity>=min_capacity. The returned buffer is only valid until the next operation on this ByteSink.
After writing at most *result_capacity bytes, call Append() with the pointer returned from this function and the number of bytes written. Many Append() implementations will avoid copying bytes if this function returned an internal buffer.
Partial usage example: int32_t capacity; char* buffer = sink->GetAppendBuffer(..., &capacity); ... Write n bytes into buffer, with n <= capacity. sink->Append(buffer, n); In many implementations, that call to Append will avoid copying bytes.
If the ByteSink allocates or reallocates an internal buffer, it should use the desired_capacity_hint if appropriate. If a caller cannot provide a reasonable guess at the desired capacity, it should pass desired_capacity_hint=0.
If a non-scratch buffer is returned, the caller may only pass a prefix to it to Append(). That is, it is not correct to pass an interior pointer to Append().
The default implementation always returns the scratch buffer.
min_capacity | required minimum capacity of the returned buffer; must be non-negative |
desired_capacity_hint | desired capacity of the returned buffer; must be non-negative |
scratch | default caller-owned buffer |
scratch_capacity | capacity of the scratch buffer |
result_capacity | pointer to an integer which will be set to the capacity of the returned buffer |
Reimplemented in CheckedArrayByteSink, CheckedArrayByteSink, and CheckedArrayByteSink.
|
virtual |
Returns a writable buffer for appending and writes the buffer's capacity to *result_capacity. Guarantees *result_capacity>=min_capacity. May return a pointer to the caller-owned scratch buffer which must have scratch_capacity>=min_capacity. The returned buffer is only valid until the next operation on this ByteSink.
After writing at most *result_capacity bytes, call Append() with the pointer returned from this function and the number of bytes written. Many Append() implementations will avoid copying bytes if this function returned an internal buffer.
Partial usage example: int32_t capacity; char* buffer = sink->GetAppendBuffer(..., &capacity); ... Write n bytes into buffer, with n <= capacity. sink->Append(buffer, n); In many implementations, that call to Append will avoid copying bytes.
If the ByteSink allocates or reallocates an internal buffer, it should use the desired_capacity_hint if appropriate. If a caller cannot provide a reasonable guess at the desired capacity, it should pass desired_capacity_hint=0.
If a non-scratch buffer is returned, the caller may only pass a prefix to it to Append(). That is, it is not correct to pass an interior pointer to Append().
The default implementation always returns the scratch buffer.
min_capacity | required minimum capacity of the returned buffer; must be non-negative |
desired_capacity_hint | desired capacity of the returned buffer; must be non-negative |
scratch | default caller-owned buffer |
scratch_capacity | capacity of the scratch buffer |
result_capacity | pointer to an integer which will be set to the capacity of the returned buffer |
Reimplemented in CheckedArrayByteSink, CheckedArrayByteSink, and CheckedArrayByteSink.