nlib
Base64InputStream.h
Go to the documentation of this file.
1 
2 #pragma once
3 #ifndef INCLUDE_NN_NLIB_BASE64INPUTSTREAM_H_
4 #define INCLUDE_NN_NLIB_BASE64INPUTSTREAM_H_
5 
7 
8 NLIB_NAMESPACE_BEGIN
9 
10 class InputStream;
11 
12 namespace detail {
13 
14 class NLIB_VIS_PUBLIC Base64InputTransform NLIB_FINAL : public InputTransform {
15  public:
16  Base64InputTransform();
17 
18  virtual errno_t Transform(InputStream* is, void* p, size_t nBytes,
19  size_t* written) NLIB_OVERRIDE;
20  virtual void* GetWorkBuffer(size_t* n) NLIB_OVERRIDE;
21  virtual errno_t OnSetStream(InputStream* is) NLIB_OVERRIDE;
22  virtual errno_t OnClose() NLIB_OVERRIDE;
23 
24  private:
25  unsigned char m_DropBuf[4];
26  // Read 4 bytes and write 3 bytes ->
27  // Read 256 bytes and buffer 192 bytes
28  unsigned char m_Buf[192];
29 
30  NLIB_DISALLOW_COPY_AND_ASSIGN(Base64InputTransform);
31 };
32 
33 } // namespace detail
34 
35 #ifndef NLIB_DOXYGEN
37 #else
38 // NOTE: we don't use typedef for doxygen.
39 class NLIB_VIS_PUBLIC Base64InputStream NLIB_FINAL
40  : public InputConverterStreamTempl<detail::Base64InputTransform> {};
41 #endif
42 
43 NLIB_NAMESPACE_END
44 
45 #endif // INCLUDE_NN_NLIB_BASE64INPUTSTREAM_H_
#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...
Definition: Config.h:126
#define NLIB_OVERRIDE
Defines override if it is available for use. If not, holds an empty string.
The class for reading Base64-encoded data.
The base class for input streams. This class cannot be instantiated.
Definition: InputStream.h:15
#define NLIB_VIS_PUBLIC
Symbols for functions and classes are made available outside of the library.
Definition: Platform_unix.h:51
int errno_t
Indicates with an int-type typedef that a POSIX error value is returned as the return value...
Definition: NMalloc.h:24