3 #ifndef INCLUDE_NN_NLIB_INPUTSTREAM_H_
4 #define INCLUDE_NN_NLIB_INPUTSTREAM_H_
36 if (this->IsOk() && m_Cur == m_End) {
38 return this->IsOk() && m_Cur == m_End;
48 return m_Buf[m_Cur++];
61 #ifndef NLIB_NONNULL_ENABLED
63 this->SetError(EINVAL);
68 this->SetError(EINVAL);
71 if (m_Cur + nBytes <= m_End) {
76 return this->Read_(ptr, nBytes);
78 bool Close() NLIB_NOEXCEPT;
82 void ResetBuffer(
void* p,
size_t nBytes) NLIB_NOEXCEPT {
83 m_Buf =
reinterpret_cast<unsigned char*
>(p);
84 m_BufSize =
static_cast<int>(nBytes);
87 if (m_ErrorId == 0) m_ErrorId = e;
91 virtual size_t FillBuffer_(
void* p,
size_t nBytes) NLIB_NOEXCEPT = 0;
92 virtual bool Close_() NLIB_NOEXCEPT = 0;
93 virtual
void* GetWorkBuffer_(
size_t* nBytes) NLIB_NOEXCEPT;
94 size_t Read_(
void* ptr,
size_t nBytes) NLIB_NOEXCEPT;
98 virtual
size_t Skip_(
size_t nBytes) NLIB_NOEXCEPT;
101 void CheckBuffer() NLIB_NOEXCEPT;
102 bool GetWorkBuffer() NLIB_NOEXCEPT;
108 unsigned char* m_Buf;
123 char m_DummyBuf[256];
124 virtual size_t FillBuffer_(
void* p,
size_t nBytes) NLIB_NOEXCEPT
NLIB_OVERRIDE;
125 virtual bool Close_() NLIB_NOEXCEPT NLIB_OVERRIDE {
return true; }
126 virtual size_t Skip_(
size_t nBytes) NLIB_NOEXCEPT
NLIB_OVERRIDE;
131 #endif // INCLUDE_NN_NLIB_INPUTSTREAM_H_
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
#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...
#define NLIB_OVERRIDE
Defines override if it is available for use. If not, holds an empty string.
#define NLIB_CEXPR
Defines constexpr if it is available for use. If not, holds an empty string.
A file that contains the configuration information for each development environment.