3 #ifndef INCLUDE_NN_NLIB_TEXTWRITER_H_
4 #define INCLUDE_NN_NLIB_TEXTWRITER_H_
7 #include "nn/nlib/Swap.h"
24 NLIB_MOVE_MEMBER_HELPER_2(
TextWriter, m_Stream, m_ErrorValue);
34 bool Flush() NLIB_NOEXCEPT;
35 bool Close() NLIB_NOEXCEPT;
36 errno_t GetErrorValue() const NLIB_NOEXCEPT {
return m_ErrorValue; }
38 bool WriteFormat(_Printf_format_string_
const wchar_t* fmt, ...) NLIB_NOEXCEPT;
39 bool WriteFormat(_Printf_format_string_ const
char* fmt, ...) NLIB_NOEXCEPT;
40 void SetError(
errno_t e) const NLIB_NOEXCEPT {
41 if (m_ErrorValue == 0) m_ErrorValue = e;
46 swap(m_Stream, rhs.m_Stream);
47 swap(m_ErrorValue, rhs.m_ErrorValue);
59 unsigned char m_Utf8Idx;
60 unsigned char m_Utf16Idx;
73 #endif // INCLUDE_NN_NLIB_TEXTWRITER_H_
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
OutputStream * GetStream() noexcept
Gets the stream for the text writer to write to.
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
Prohibits use of the copy constructor and assignment operator for the class specified by TypeName...
#define NLIB_SAFE_BOOL(class_name, exp)
Defines a safe operator bool function in the class. Uses the C++11 explicit bool if it is available f...
bool Write(BinaryWriter *w, T x)
You can write user-defined class objects by specializing this function template.
A file that contains the configuration information for each development environment.
void swap(TextWriter &rhs) noexcept
Swaps the contents of an object.
~TextWriter() noexcept
Destructor. The stream is not closed.
The class for writing text to streams.
The base class for output streams. This class cannot be instantiated.