winapi_common
Public Types | Public Member Functions | List of all members
winapi::Buffer Class Reference

Binary data container. More...

Inheritance diagram for winapi::Buffer:

Public Types

typedef std::vector< unsigned char > Parent
 

Public Member Functions

 Buffer (std::initializer_list< unsigned char > lst)
 
 Buffer (Parent &&src)
 
template<typename CharT >
 Buffer (const std::basic_string< CharT > &src)
 
 Buffer (const void *src, std::size_t nb)
 
template<typename CharT >
void set (const std::basic_string< CharT > &src)
 
void set (const void *src, std::size_t nb)
 
std::string as_utf8 () const
 
std::wstring as_utf16 () const
 
void add (const Buffer &src)
 

Detailed Description

Binary data container.

This class wraps a blob of binary data.

Definition at line 24 of file buffer.hpp.

Constructor & Destructor Documentation

◆ Buffer() [1/4]

winapi::Buffer::Buffer ( std::initializer_list< unsigned char >  lst)
inline

Construct a buffer from an explicit list of byte values.

Definition at line 31 of file buffer.hpp.

◆ Buffer() [2/4]

winapi::Buffer::Buffer ( Parent &&  src)
inlineexplicit

Construct a buffer from an instance of std::vector<unsigned char>.

Definition at line 34 of file buffer.hpp.

◆ Buffer() [3/4]

template<typename CharT >
winapi::Buffer::Buffer ( const std::basic_string< CharT > &  src)
inlineexplicit

Construct a buffer from an instance of std::basic_string.

Definition at line 38 of file buffer.hpp.

◆ Buffer() [4/4]

winapi::Buffer::Buffer ( const void *  src,
std::size_t  nb 
)
inline

Construct a buffer from a memory region.

Definition at line 43 of file buffer.hpp.

Member Function Documentation

◆ set() [1/2]

template<typename CharT >
void winapi::Buffer::set ( const std::basic_string< CharT > &  src)
inline

Replace the buffer's contents with the data from std::basic_string.

Definition at line 47 of file buffer.hpp.

◆ set() [2/2]

void winapi::Buffer::set ( const void *  src,
std::size_t  nb 
)
inline

Replace the buffer's contents with the data from a memory region.

Definition at line 52 of file buffer.hpp.

◆ as_utf8()

std::string winapi::Buffer::as_utf8 ( ) const
inline

Interpret the buffer's contents as a std::string.

Definition at line 58 of file buffer.hpp.

◆ as_utf16()

std::wstring winapi::Buffer::as_utf16 ( ) const
inline

Interpret the buffer's contents as a std::wstring.

Definition at line 66 of file buffer.hpp.

◆ add()

void winapi::Buffer::add ( const Buffer src)
inline

Append another buffer to the end of this one.

Definition at line 79 of file buffer.hpp.


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