#include <opennurbs_archive.h>
◆ anonymous enum
Enumerator |
---|
seek_from_beginning_of_file | |
seek_from_current_position | |
seek_from_end_of_file | |
◆ ON_Buffer() [1/2]
◆ ~ON_Buffer()
ON_Buffer::~ON_Buffer |
( |
| ) |
|
◆ ON_Buffer() [2/2]
ON_Buffer::ON_Buffer |
( |
const ON_Buffer & |
src | ) |
|
◆ AtEnd()
bool ON_Buffer::AtEnd |
( |
| ) |
const |
Returns: True if Size() == CurrentPosition(). Remarks: It is possible to seek beyond the end of the buffer. In this case, the current position will be past the end of the buffer and AtEnd() will return false.
◆ ChangeSize()
bool ON_Buffer::ChangeSize |
( |
ON__UINT64 |
buffer_size | ) |
|
Parameters: buffer_size - [in] new size of buffer. Returns: True if successful.
Remarks: The current position is not changed and may be beyond the end of the file. Use Seek to set the current position after calling ChangeSize().
◆ ClearLastError()
void ON_Buffer::ClearLastError |
( |
| ) |
|
◆ Compact()
bool ON_Buffer::Compact |
( |
| ) |
|
Description: Return unused memory to heap. Remarks: Call this function after creating an ON_Buffer that will persist for and extended amount of time. There are never more than 16 pages of unused memory (16*4096 bytes on most computers) in an ON_Buffer. Compact() can be called at any time, but calling Compact() the then writing at the end of the buffer is not an efficient use of time or memory.
◆ Compare()
Description: Compare contents of buffers. Parameters: a - [in] b - [in] Returns: -1: a < b 0: a == b 1: a > b
◆ Compress()
bool ON_Buffer::Compress |
( |
ON_Buffer & |
compressed_buffer | ) |
const |
Description: Compress this buffer
Parameters: compressed_buffer - [out] (The reference can be *this)
Example:
/ compress a buffer in place ON_Buffer buffer; buffer = ...; if ( !buffer.Compress(buffer) ) { / compression failed } else { / buffer is now compressed }
Returns: True if successful. False if failed.
◆ CRC32()
Returns: 32-bit CRC of the buffer contents. Remarks:
◆ CurrentPosition()
Returns: Current position in the buffer. Remarks: It is possible to seek beyond the end of the buffer. In this case, the current position will be past the end of the buffer and CurrentPosition() will be greater than Size().
◆ Destroy()
void ON_Buffer::Destroy |
( |
| ) |
|
◆ EmergencyDestroy()
void ON_Buffer::EmergencyDestroy |
( |
| ) |
|
◆ ErrorHandler()
◆ IsValid()
bool ON_Buffer::IsValid |
( |
const ON_TextLog * |
text_log | ) |
const |
◆ LastError()
Returns: Value that identifies most recent error. 0: no error 1: attempt to seek to a negative position
◆ operator=()
◆ Read()
◆ ReadFromBinaryArchive()
◆ Seek()
bool ON_Buffer::Seek |
( |
ON__INT64 |
offset, |
|
|
int |
origin |
|
) |
| |
Parameters: offset - [in] number of bytes to seek from origin origin - [in] initial position. 0 (SEEK_SET) Seek from beginning of file. 1 (SEEK_CUR) Seek from current position. 2 (SEEK_END) Seek from end of file. Returns: True if successful. False if the seek would result in a file position before the beginning of the file. If false is returned, the current position is not changed. Remarks: Seeking beyond the end of the buffer is succeeds. Seeking before the beginning of the buffer fails.
◆ SeekFromCurrentPosition()
bool ON_Buffer::SeekFromCurrentPosition |
( |
ON__INT64 |
offset | ) |
|
Parameters: offset - [in] number of bytes to seek from the current position. Returns: True if successful. False if the seek would result in a file position before the beginning of the file. If false is returned, the current position is not changed. Remarks: Seeking beyond the end of the buffer is succeeds. Seeking before the beginning of the buffer fails.
◆ SeekFromEnd()
bool ON_Buffer::SeekFromEnd |
( |
ON__INT64 |
offset | ) |
|
Parameters: offset - [in] number of bytes to seek from the end fo the buffer. Returns: True if successful. False if the seek would result in a file position before the beginning of the file. If false is returned, the current position is not changed. Remarks: Seeking beyond the end of the buffer is succeeds. Seeking before the beginning of the buffer fails.
◆ SeekFromStart()
bool ON_Buffer::SeekFromStart |
( |
ON__INT64 |
offset | ) |
|
Parameters: offset - [in] (>= 0) number of bytes to seek from the start of the buffer. Returns: True if successful. False if the seek would result in a file position before the beginning of the file. If false is returned, the current position is not changed. Remarks: Seeking beyond the end of the buffer is succeeds. Seeking before the beginning of the buffer fails.
◆ SetErrorHandler()
◆ Size()
Returns: Number of bytes currently in the buffer. Remarks: It is possible to seek beyond the end of the buffer. In this case, the current position will be past the end of the buffer and CurrentPosition() will be greater than Size().
◆ Uncompress()
bool ON_Buffer::Uncompress |
( |
ON_Buffer & |
uncompressed_buffer | ) |
const |
Description: Uncompress this buffer which must have been compressed using ON_Buffer::Compress().
Parameters: uncompressed_buffer - [out] (The reference can be *this)
Example: / silly example that compresses and then uncompresses a buffer in place / to show how to call the functions. ON_Buffer buffer; buffer = ...; ///< buffer is in it uncompressed form if ( buffer.Compress(buffer) ) { / buffer is now compressed if ( buffer.Uncompress(buffer) ) { / buffer is uncompressed again. } }
Returns: True if successful. False if failed.
◆ Write()
Parameters: size - [in] number of bytes to write. buffer - [in] values to write. Returns: Number of bytes written buffer.
◆ WriteToBinaryArchive()