nlib
ZlibInputStream.h
[詳解]
1 
2 /*--------------------------------------------------------------------------------*
3  Project: CrossRoad
4  Copyright (C)Nintendo All rights reserved.
5 
6  These coded instructions, statements, and computer programs contain proprietary
7  information of Nintendo and/or its licensed developers and are protected by
8  national and international copyright laws. They may not be disclosed to third
9  parties or copied or duplicated in any form, in whole or in part, without the
10  prior written consent of Nintendo.
11 
12  The content herein is highly confidential and should be handled accordingly.
13  *--------------------------------------------------------------------------------*/
14 
15 #pragma once
16 #ifndef INCLUDE_NN_NLIB_ZLIBINPUTSTREAM_H_
17 #define INCLUDE_NN_NLIB_ZLIBINPUTSTREAM_H_
18 
19 #include "nn/nlib/Platform.h"
20 #ifdef NLIB_HAS_ZLIB
21 
22 #include "nn/nlib/InputStream.h"
24 
25 NLIB_NAMESPACE_BEGIN
26 
28  typedef void* (*ReallocFunc)(void* p, size_t n) NLIB_NOEXCEPT_FUNCPTR;
29  void* buf_in;
30  void* buf_out;
31  size_t buffer_size;
32  ReallocFunc realloc_func;
33 
34  public:
36  buf_out(NULL),
37  buffer_size(64 * 1024),
38  realloc_func(::nlib_realloc) {}
39  NLIB_CEXPR ZlibInputStreamSettings(void* buf_in_, void* buf_out_,
40  size_t buffer_size_) NLIB_NOEXCEPT
41  : buf_in(buf_in_),
42  buf_out(buf_out_),
43  buffer_size(buffer_size_),
44  realloc_func(::nlib_realloc) {}
45  NLIB_CEXPR ZlibInputStreamSettings(void* buf_in_, void* buf_out_, size_t buffer_size_,
46  ReallocFunc realloc_func_) NLIB_NOEXCEPT
47  : buf_in(buf_in_),
48  buf_out(buf_out_),
49  buffer_size(buffer_size_),
50  realloc_func(realloc_func_) {}
51 };
52 
54  : public InputConverterStream {
55  public:
56  ZlibInputStream() NLIB_NOEXCEPT : prv_(NULL) {}
60  return this->Init(settings);
61  }
62  errno_t Init(const ZlibInputStreamSettings& settings) NLIB_NOEXCEPT;
63 
64  private:
65  struct ZlibInputStreamPrivate;
66  ZlibInputStreamPrivate* prv_;
68 };
69 
70 NLIB_NAMESPACE_END
71 
72 #endif
73 #endif // INCLUDE_NN_NLIB_ZLIBINPUTSTREAM_H_
#define NLIB_OVERRIDE
利用可能であればoverrideが定義されます。そうでない場合は空文字列です。
Definition: Config.h:228
内部でデータ変換を行う InputStream のように振る舞うクラスの基底です。
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
TypeName で指定されたクラスのコピーコンストラクタと代入演算子を禁止します。
Definition: Config.h:163
入力ストリームの基底クラスを定義しています。
ZlibInputStreamの各種設定が格納されている構造体です。 コンストラクト時にはデフォルトの設定が格納され...
ZlibInputStream() noexcept
デフォルトコンストラクタです。
ReallocFunc realloc_func
ZlibInputStream内部で利用するrealloc又はreallocと同等の関数です。
size_t buffer_size
ZlibInputStreamSettings::buf_in, ZlibInputStreamSettings::buf_outのサイズです。
constexpr ZlibInputStreamSettings(void *buf_in_, void *buf_out_, size_t buffer_size_) noexcept
それぞれのデータメンバを設定します。
基本的なAPIがCリンケージで宣言されています。
#define NLIB_VIS_PUBLIC
関数やクラス等のシンボルをライブラリの外部に公開します。
Definition: Platform_unix.h:89
constexpr ZlibInputStreamSettings() noexcept
デフォルトコンストラクタです。デフォルト値を設定します。
void * buf_in
z_stream::next_inに設定されるバッファです。
errno_t Init() noexcept
デフォルト設定で初期化します。
constexpr ZlibInputStreamSettings(void *buf_in_, void *buf_out_, size_t buffer_size_, ReallocFunc realloc_func_) noexcept
それぞれのデータメンバを設定します。
zlibを用いて圧縮したデータを読み込むためのストリームクラスです。
#define NLIB_NOEXCEPT
環境に合わせてnoexcept 又は同等の定義がされます。
Definition: Config.h:99
#define NLIB_CEXPR
利用可能であればconstexprが定義されます。そうでない場合は空文字列です。
Definition: Config.h:93
NLIB_CHECK_RESULT void * nlib_realloc(void *ptr, size_t size)
C標準関数のrealloc()を呼び出すweak関数です。nlibはこの関数を経由してrealloc()を呼び出します。 ...
void * buf_out
z_stream::next_outに設定されるバッファです。
#define NLIB_FINAL
利用可能であればfinalが定義されます。そうでない場合は空文字列です。
Definition: Config.h:229
int errno_t
intのtypedefで、戻り値としてPOSIXのエラー値を返すことを示します。
Definition: NMalloc.h:37