nlib
ZlibInputStream.h
[詳解]
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_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);
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:223
内部でデータ変換を行う InputStream のように振る舞うクラスの基底です。
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
TypeName で指定されたクラスのコピーコンストラクタと代入演算子を禁止します。
Definition: Config.h:158
入力ストリームの基底クラスを定義しています。
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:87
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:224
int errno_t
intのtypedefで、戻り値としてPOSIXのエラー値を返すことを示します。
Definition: NMalloc.h:37