A class for writing data to a buffer. This class provides functionality to write data to a buffer. It allows pushing strings, raw data, and numeric values to the buffer.
More...
|
|
| CWriteStream () |
| | Default constructor.
|
| |
| | CWriteStream (const size_t i_nSize) |
| | Constructor with initial size. More...
|
| |
| | CWriteStream (const CWriteStream &i_oOther) |
| | Copy constructor. More...
|
| |
| | CWriteStream (CWriteStream &&i_oWriteStream) noexcept |
| | Move constructor. More...
|
| |
|
virtual | ~CWriteStream () |
| | Destructor.
|
| |
|
void | clear () |
| | Clears the stream by setting the size to 0.
|
| |
| void | reallocate (size_t i_nSize) |
| | Reallocates the buffer to the given size. More...
|
| |
| void | push (const void *i_pBuffer, size_t i_nSize) |
| | Pushes the specified data to the buffer. More...
|
| |
| void | push (const CWriteStream &i_oStream) |
| | Pushes the data from another CWriteStream to the buffer. More...
|
| |
| void | push (const char *i_szString) |
| | Pushes a null-terminated string to the buffer. More...
|
| |
| void | push (const std::string &i_oString, const bool i_fZeroTerminated=true) |
| | Pushes a std::string to the buffer. More...
|
| |
| void | push (const std::wstring &i_oString, const bool i_fZeroTerminated=true) |
| | Pushes a std::wstring to the buffer. More...
|
| |
| template<typename T , typename std::enable_if_t< std::is_arithmetic_v< T >> * = nullptr> |
| void | push (const T &i_oValue) |
| | Pushes a numeric value to the buffer. More...
|
| |
| template<typename T , typename std::enable_if_t< std::is_enum_v< T >> * = nullptr> |
| void | push (const T &i_oValue) |
| | Pushes an enum value to the buffer. More...
|
| |
| template<size_t TSize> |
| void | push (const CCharArray< TSize > &i_oValue, const bool i_bMaxLength=true) |
| | Pushes a CCharArray to the buffer. More...
|
| |
| void | replace (const size_t i_nPosition, const void *i_pBuffer, const size_t i_nSize) const |
| | Replaces a portion of the buffer with the specified data. More...
|
| |
| void | replace (const size_t i_nPosition, const CWriteStream &i_oStream) const |
| | Replaces a portion of the buffer with the data from another CWriteStream. More...
|
| |
| void | replace (const size_t i_nPosition, const char *i_szString) const |
| | Replaces a portion of the buffer with a null-terminated string. More...
|
| |
| void | replace (const size_t i_nPosition, const std::string &i_oString) const |
| | Replaces a portion of the buffer with a std::string. More...
|
| |
| template<typename T , typename std::enable_if_t< std::is_arithmetic_v< T >> * = nullptr> |
| void | replace (const size_t i_nPosition, const T &i_oValue) |
| | Replaces a portion of the buffer with a numeric value. More...
|
| |
| template<typename T , typename std::enable_if_t< std::is_enum_v< T >> * = nullptr> |
| void | replace (const size_t i_nPosition, const T &i_oValue) |
| | Replaces a portion of the buffer with an enum value. More...
|
| |
| size_t | allocatedSize () const |
| | Gets the allocated size of the buffer. More...
|
| |
| size_t | size () const |
| | Gets the current size of the buffer. More...
|
| |
| const char * | buffer () const |
| | Gets a const pointer to the buffer. More...
|
| |
| CWriteStream & | operator= (const CWriteStream &i_oOther) |
| | Copy assignment operator. More...
|
| |
| CWriteStream & | operator= (CWriteStream &&i_oOther) noexcept |
| | Move assignment operator. More...
|
| |
A class for writing data to a buffer. This class provides functionality to write data to a buffer. It allows pushing strings, raw data, and numeric values to the buffer.
Example
stream.
push(
"Hello, World!");
char rawData[] = { 'R', 'a', 'w', 'D', 'a', 't', 'a' };
stream.
push(rawData,
sizeof(rawData));
int num = 42;
size_t bufferSize = stream.
size();
std::cout << "Buffer: ";
for (size_t i = 0; i < bufferSize; ++i) {
}
std::cout << std::endl;
A class for writing data to a buffer. This class provides functionality to write data to a buffer....
Definition: WriteStream.h:42
void push(const void *i_pBuffer, size_t i_nSize)
Pushes the specified data to the buffer.
Definition: WriteStream.cpp:30
const char * buffer() const
Gets a const pointer to the buffer.
Definition: WriteStream.h:234
size_t size() const
Gets the current size of the buffer.
Definition: WriteStream.h:228