A class for reading data from a buffer. This class provides functionality to read data from a buffer. It allows reading strings, raw data, and numeric values from the buffer. Example
More...
|
| | CReadStream () |
| | Default constructor for CReadStream. More...
|
| |
| | CReadStream (const char *i_pBuffer, const size_t i_nSize, const bool i_fCopyBuffer) |
| | Constructor for CReadStream with a buffer. More...
|
| |
| | CReadStream (const CReadStream &i_oOther) |
| | Copy constructor for CReadStream. More...
|
| |
| | CReadStream (CReadStream &&i_oOther) noexcept |
| | Move constructor for CReadStream. More...
|
| |
|
virtual | ~CReadStream ()=default |
| | Destructor for CReadStream.
|
| |
| void | setBuffer (const char *i_pBuffer, size_t i_nSize, bool i_fCopyBuffer=false) |
| | Sets the buffer for the CReadStream. More...
|
| |
| void | setPosition (const size_t i_nPosition) |
| | Sets the current position of the CReadStream. More...
|
| |
| void | seek (const size_t i_nBytes) |
| | Moves the current position of the CReadStream. More...
|
| |
|
void | clear () |
| | Clears the CReadStream.
|
| |
| const char * | buffer () const |
| | Returns the buffer of the CReadStream. More...
|
| |
| size_t | size () const |
| | Returns the size of the buffer. More...
|
| |
| size_t | position () const |
| | Returns the current position of the CReadStream. More...
|
| |
| size_t | leftBytes (const size_t i_nPosition) const |
| | Returns the number of bytes left from the current position to the end of the buffer. More...
|
| |
| size_t | leftBytes () const |
| | Returns the number of bytes left from the current position to the end of the buffer. More...
|
| |
| bool | isEndOfBuffer () const |
| | Checks if the current position is at the end of the buffer. More...
|
| |
| bool | isEoB () const |
| | Checks if the current position is at the end of the buffer. More...
|
| |
| std::string | getString (const size_t i_nPosition, const size_t i_nLength, const bool i_fIsZeroTerminated, const bool i_fSetPosition) |
| | Reads a string from the buffer. More...
|
| |
| std::string | getString (const size_t i_nPosition, const size_t i_nLength, const bool i_fSetPosition=true) |
| | Reads a string from the buffer. More...
|
| |
| std::string | getString (const size_t i_nLength, const bool i_fSetPosition=true) |
| | Reads a string from the buffer. More...
|
| |
| std::string | getString (const bool i_fSetPosition=true) |
| | Reads a null-terminated string from the buffer. More...
|
| |
| std::wstring | getWString (const size_t i_nPosition, const size_t i_nLength, const bool i_fIsZeroTerminated, const bool i_fSetPosition) |
| | Reads a wide string from the buffer. More...
|
| |
| std::wstring | getWString (const size_t i_nPosition, const size_t i_nLength, const bool i_fSetPosition=true) |
| | Reads a wide string from the buffer. More...
|
| |
| std::wstring | getWString (const size_t i_nLength, const bool i_fSetPosition=true) |
| | Reads a wide string from the buffer. More...
|
| |
| std::wstring | getWString (const bool i_fSetPosition=true) |
| | Reads a null-terminated wide string from the buffer. More...
|
| |
| void | getRaw (void *i_pDestination, size_t i_nReadBytes, size_t i_nPosition, bool i_fSetPosition) |
| | Reads raw data from the buffer. More...
|
| |
| void | getRaw (void *i_pDestination, const size_t i_nReadBytes, const bool i_fSetPosition) |
| | Reads raw data from the buffer. More...
|
| |
| void | getRaw (void *i_pDestination, const size_t i_nReadBytes) |
| | Reads raw data from the buffer. More...
|
| |
| template<typename T , typename std::enable_if_t< std::is_arithmetic_v< T >> * = nullptr> |
| T | get (const size_t i_nPosition, const bool i_fSetPosition) |
| | Reads a value of type T from the buffer. More...
|
| |
| template<typename T , typename std::enable_if_t< std::is_arithmetic_v< T >> * = nullptr> |
| T | get (const size_t i_nPosition) |
| | Reads a value of type T from the buffer. More...
|
| |
| template<typename T , typename std::enable_if_t< std::is_arithmetic_v< T >> * = nullptr> |
| T | get () |
| | Reads a value of type T from the buffer. More...
|
| |
| template<typename T , typename std::enable_if_t< std::is_enum_v< T >> * = nullptr> |
| T | get (const size_t i_nPosition) |
| | Reads an enum value from the buffer. More...
|
| |
| template<typename T , typename std::enable_if_t< std::is_enum_v< T >> * = nullptr> |
| T | get () |
| | Reads an enum value from the buffer. More...
|
| |
| template<size_t TSize> |
| CCharArray< TSize > | getArray (const size_t i_nPosition, const bool i_fSetPosition) |
| | Reads an array from the buffer. More...
|
| |
| template<size_t TSize> |
| CCharArray< TSize > | getArray () |
| | Reads an array from the buffer. More...
|
| |
| const char & | operator[] (const size_t i_nIndex) const |
| | Overload of the subscript operator. More...
|
| |
| CReadStream & | operator= (const CReadStream &i_oOther) |
| | Assignment operator. More...
|
| |
| CReadStream & | operator= (CReadStream &&i_oOther) noexcept |
| | Move assignment operator. More...
|
| |
A class for reading data from a buffer. This class provides functionality to read data from a buffer. It allows reading strings, raw data, and numeric values from the buffer. Example
const char*
buffer =
"Hello, World!";
size_t bufferSize = strlen(
buffer) + 1;
std::string str = stream.getString();
std::cout << "String: " << str << std::endl;
char rawData[6];
stream.getRaw(rawData, 6);
std::cout << "Raw Data: ";
for (int i = 0; i < 6; ++i) {
std::cout << rawData[i];
}
std::cout << std::endl;
int num = stream.get<int>();
std::cout << "Numeric Value: " << num << std::endl;
A class for reading data from a buffer. This class provides functionality to read data from a buffer....
Definition: ReadStream.h:37
const char * buffer() const
Returns the buffer of the CReadStream.
Definition: ReadStream.h:145