nlib
ConsoleOutputStream.h
Go to the documentation of this file.
1 
2 /*---------------------------------------------------------------------------*
3 
4  Project: CrossRoad
5  Copyright (C)2012-2016 Nintendo. All rights reserved.
6 
7  These coded instructions, statements, and computer programs contain
8  proprietary information of Nintendo of America Inc. and/or Nintendo
9  Company Ltd., and are protected by Federal copyright law. They may
10  not be disclosed to third parties or copied or duplicated in any form,
11  in whole or in part, without the prior written consent of Nintendo.
12 
13  *---------------------------------------------------------------------------*/
14 
15 #pragma once
16 #ifndef INCLUDE_NN_NLIB_CONSOLEOUTPUTSTREAM_H_
17 #define INCLUDE_NN_NLIB_CONSOLEOUTPUTSTREAM_H_
18 
19 #include "nn/nlib/OutputStream.h"
20 
21 NLIB_NAMESPACE_BEGIN
22 
24  static const size_t kBufSize = 512;
25  char cos_buf_[kBufSize + 1];
26 
27  public:
30  bool result = this->Close();
31  NLIB_UNUSED(result);
32  }
33 
34  private:
35  virtual bool PushBuffer_(const void* p, size_t nbytes,
36  bool do_flush) NLIB_NOEXCEPT NLIB_OVERRIDE;
37  virtual bool Close_() NLIB_NOEXCEPT NLIB_OVERRIDE { return this->Flush(); }
38 };
39 
40 NLIB_NAMESPACE_END
41 
42 #endif // INCLUDE_NN_NLIB_CONSOLEOUTPUTSTREAM_H_
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:98
#define NLIB_OVERRIDE
Defines override if it is available for use. If not, holds an empty string.
Definition: Config.h:223
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:87
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
Definition: Config.h:99
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
Definition: Config.h:224
Defines the base class for output streams.
The base class for output streams. This class cannot be instantiated.
Definition: OutputStream.h:30