nlib
ConsoleOutputStream.h
Go to the documentation of this file.
1 
2 #pragma once
3 #ifndef INCLUDE_NN_NLIB_CONSOLEOUTPUTSTREAM_H_
4 #define INCLUDE_NN_NLIB_CONSOLEOUTPUTSTREAM_H_
5 
6 #include "nn/nlib/OutputStream.h"
7 
8 NLIB_NAMESPACE_BEGIN
9 
11  static const size_t kBufSize = 512;
12  char m_Buf[kBufSize + 1];
13 
14  public:
17  bool result = this->Close();
18  NLIB_UNUSED(result);
19  }
20 
21  private:
22  virtual bool PushBuffer_(const void* p, size_t nBytes,
23  bool doFlush) NLIB_NOEXCEPT NLIB_OVERRIDE;
24  virtual bool Close_() NLIB_NOEXCEPT NLIB_OVERRIDE { return this->Flush(); }
25 };
26 
27 NLIB_NAMESPACE_END
28 
29 #endif // INCLUDE_NN_NLIB_CONSOLEOUTPUTSTREAM_H_
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
Definition: Platform.h:2151
The class for creating a stream to output to the console as a text string using nlib_printf.
bool Flush() noexcept
Flushes the stream.
Definition: OutputStream.h:85
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
#define NLIB_OVERRIDE
Defines override if it is available for use. If not, holds an empty string.
bool Close() noexcept
Closes the stream after it has been flushed. Returns true if successful.
#define NLIB_VIS_PUBLIC
Symbols for functions and classes are made available outside of the library.
Definition: Platform_unix.h:51
Defines the base class for output streams.
The base class for output streams. This class cannot be instantiated.
Definition: OutputStream.h:17