16 #ifndef INCLUDE_NN_NLIB_MEMORYOUTPUTSTREAM_H_ 17 #define INCLUDE_NN_NLIB_MEMORYOUTPUTSTREAM_H_ 27 : mos_buf_(static_cast<nlib_byte_t*>(buf)), mos_pos_(0), mos_size_(n) {}
28 template <
class T,
size_t N>
30 : mos_buf_(static_cast<nlib_byte_t*>(static_cast<void*>(&buf[0]))),
32 mos_size_(N *
sizeof(T)) {}
37 return Init(static_cast<nlib_byte_t*>(buf), n);
39 template <
class T,
size_t N>
41 return this->Init(&buf[0], N *
sizeof(T));
45 virtual bool PushBuffer_(
const void* p,
size_t nbytes,
64 #endif // INCLUDE_NN_NLIB_MEMORYOUTPUTSTREAM_H_ #define NLIB_OVERRIDE
Defines override if it is available for use. If not, holds an empty string.
constexpr MemoryOutputStream() noexcept
Instantiates the object with default parameters (default constructor). You must call the Init functio...
constexpr MemoryOutputStream(T(&buf)[N]) noexcept
Constructs and initializes MemoryOutputStream.
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
Prohibits use of the copy constructor and assignment operator for the class specified by TypeName...
constexpr MemoryOutputStream(void *buf, size_t n) noexcept
Constructs and initializes MemoryOutputStream.
The class for creating an output stream that makes use of memory.
errno_t Init(void *buf, size_t n) noexcept
Initializes MemoryOuputStream and makes it available for use.
const void * data() const noexcept
Gets a pointer to the start of the output data.
errno_t Init(T(&buf)[N]) noexcept
Initializes MemoryOuputStream and makes it available for use.
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
#define NLIB_CEXPR
Defines constexpr if it is available for use. If not, holds an empty string.
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
Defines the base class for output streams.
The base class for output streams. This class cannot be instantiated.