3 #ifndef INCLUDE_NN_NLIB_EXI_XMLSTREAMREADER_H_ 4 #define INCLUDE_NN_NLIB_EXI_XMLSTREAMREADER_H_ 9 #if defined(_MSC_VER) && defined(nx_exi_EXPORTS) 10 #undef NLIB_VIS_PUBLIC 11 #define NLIB_VIS_PUBLIC NLIB_WINEXPORT 34 isVersionIgnored(false),
36 tempStringMaxLength(1023) {}
40 class ExiStringAllocator;
49 PROCESSING_INSTRUCTION = 3,
68 return Create(stream, settings, al);
72 return Create(stream, settings);
76 return Create(stream, settings, al);
81 if (is_local_al_) ExiAllocator::Swap(al_);
84 ExiAllocatorSwapper swapper(al_);
88 ExiAllocatorSwapper swapper(al_);
89 return this->GetAttributeCountV();
92 ExiAllocatorSwapper swapper(al_);
93 return this->GetAttributeLocalNameV(index);
96 ExiAllocatorSwapper swapper(al_);
97 return this->GetAttributeNamespaceUriV(index);
100 ExiAllocatorSwapper swapper(al_);
101 return this->GetAttributePrefixV(index);
103 const ExiChar* GetAttributeType(
size_t index) NLIB_NOEXCEPT {
104 ExiAllocatorSwapper swapper(al_);
105 return this->GetAttributeTypeV(index);
108 ExiAllocatorSwapper swapper(al_);
109 return this->GetAttributeValueV(index);
112 const ExiChar* local_name) NLIB_NOEXCEPT {
113 ExiAllocatorSwapper swapper(al_);
114 return this->GetAttributeValueV(namespace_uri, local_name);
117 ExiAllocatorSwapper swapper(al_);
118 return this->GetNamespaceCountV();
121 ExiAllocatorSwapper swapper(al_);
122 return this->GetNamespacePrefixV(index);
125 ExiAllocatorSwapper swapper(al_);
126 return this->GetNamespaceUriV(index);
129 ExiAllocatorSwapper swapper(al_);
130 return this->GetElementTextV();
133 ExiAllocatorSwapper swapper(al_);
134 return this->GetLocalNameV();
137 ExiAllocatorSwapper swapper(al_);
138 return this->GetNamespaceUriV();
141 ExiAllocatorSwapper swapper(al_);
142 return this->GetPrefixV();
145 ExiAllocatorSwapper swapper(al_);
146 return this->GetTextV();
148 int GetLineNo() const NLIB_NOEXCEPT {
return this->GetLineNoV(); }
149 int GetColumnNo() const NLIB_NOEXCEPT {
return this->GetColumnNoV(); }
151 ExiAllocatorSwapper swapper(al_);
152 return this->NextV();
158 return state_ == START_ELEMENT || state_ == END_ELEMENT ||
159 state_ == PROCESSING_INSTRUCTION;
161 bool HasNext() const NLIB_NOEXCEPT {
return state_ != END_DOCUMENT && state_ != NONE; }
163 return state_ == CHARACTERS || state_ == CDATA || state_ == COMMENT ||
164 state_ == PROCESSING_INSTRUCTION;
166 bool IsCharacters() const NLIB_NOEXCEPT {
return state_ == CHARACTERS || state_ == CDATA; }
167 bool IsEndElement() const NLIB_NOEXCEPT {
return state_ == END_ELEMENT; }
179 state_(START_DOCUMENT) {}
181 void SetExiErrorStatus(
ExiErrorStatus* p) NLIB_NOEXCEPT { error_status_ = p; }
182 ExiErrorStatus* GetExiErrorStatus()
const NLIB_NOEXCEPT {
return error_status_; }
185 template <
class DECODER>
187 template <
class DECODER>
189 template <
class DECODER>
191 template <
class DECODER>
193 template <
class DECODER>
195 template <
class DECODER>
196 const ExiChar* GetAttributeValue_(DECODER* decoder,
const ExiChar* namespace_uri,
198 template <
class DECODER>
200 template <
class DECODER>
202 template <
class DECODER>
205 template <
class DECODER>
207 template <
class DECODER>
209 template <
class DECODER>
211 template <
class DECODER>
216 virtual void CloseV() NLIB_NOEXCEPT = 0;
217 virtual size_t GetAttributeCountV() NLIB_NOEXCEPT = 0;
218 virtual const ExiChar* GetAttributeLocalNameV(
size_t index) NLIB_NOEXCEPT = 0;
219 virtual const ExiChar* GetAttributeNamespaceUriV(
size_t index) NLIB_NOEXCEPT = 0;
220 virtual const ExiChar* GetAttributePrefixV(
size_t index) NLIB_NOEXCEPT = 0;
221 virtual const ExiChar* GetAttributeTypeV(
size_t index) NLIB_NOEXCEPT = 0;
222 virtual const ExiChar* GetAttributeValueV(
size_t index) NLIB_NOEXCEPT = 0;
223 virtual const ExiChar* GetAttributeValueV(
const ExiChar* namespace_uri,
224 const ExiChar* local_name) NLIB_NOEXCEPT = 0;
225 virtual size_t GetNamespaceCountV() NLIB_NOEXCEPT = 0;
226 virtual const ExiChar* GetNamespacePrefixV(
size_t index) NLIB_NOEXCEPT = 0;
227 virtual const ExiChar* GetNamespaceUriV(
size_t index) NLIB_NOEXCEPT = 0;
228 virtual const ExiChar* GetElementTextV() NLIB_NOEXCEPT = 0;
229 virtual const ExiChar* GetLocalNameV() NLIB_NOEXCEPT = 0;
230 virtual const ExiChar* GetNamespaceUriV() NLIB_NOEXCEPT = 0;
231 virtual const ExiChar* GetPrefixV() NLIB_NOEXCEPT = 0;
232 virtual const ExiChar* GetTextV() NLIB_NOEXCEPT = 0;
233 virtual int GetLineNoV()
const NLIB_NOEXCEPT {
return 0; }
234 virtual int GetColumnNoV()
const NLIB_NOEXCEPT {
return 0; }
250 #if defined(_MSC_VER) && defined(nx_exi_EXPORTS) 251 #undef NLIB_VIS_PUBLIC 252 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT 255 #endif // INCLUDE_NN_NLIB_EXI_XMLSTREAMREADER_H_ XmlStreamConstants Next() noexcept
ストリームから次のXMLストリームイベントを読み込みます。
static XmlStreamReader * Create(InputStream *stream, const ExiAllocatorEx &al) noexcept
オブジェクト単位のアロケータを指定してXmlStreamReaderのインスタンスを作成します。 ...
size_t GetAttributeCount() noexcept
属性の数を取得します。
文字列型のtypedefやユーティリティマクロ等が定義されています。
static XmlStreamReader * Create(InputStream *stream, const XmlStreamReaderSettings &settings) noexcept
XmlStreamReaderのインスタンスを作成します。
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
TypeName で指定されたクラスのコピーコンストラクタと代入演算子を禁止します。
const ExiChar * GetNamespacePrefix(size_t index) noexcept
名前空間宣言のプレフィックスを取得します。
const ExiChar * GetLocalName() noexcept
ローカル名を取得します。
#define NLIB_SAFE_BOOL(class_name, exp)
クラス内に安全なoperator bool()を定義します。 可能であればC++11のexplicit boolを利用します。 ...
const ExiChar * GetAttributePrefix(size_t index) noexcept
属性のプレフィックスを取得します。
読み書きするバイナリXMLのデータ保持オプションです。
const ExiChar * GetAttributeValue(const ExiChar *namespace_uri, const ExiChar *local_name) noexcept
名前空間URIとローカル名を指定して属性の値を取得します。
const ExiChar * GetAttributeLocalName(size_t index) noexcept
属性のローカル名を取得します。
const ExiChar * GetNamespaceUri(size_t index) noexcept
名前空間宣言の名前空間URIを取得します。
const ExiChar * GetPrefix() noexcept
XMLの名前空間プレフィックスを取得します。
const ExiChar * GetAttributeValue(size_t index) noexcept
属性の値を取得します。
constexpr XmlStreamReaderSettings() noexcept
デフォルト設定がセットされます。
static XmlStreamReader * Create(InputStream *stream) noexcept
XmlStreamReaderSettingsをデフォルト設定でXmlStreamReaderのインスタンスを作成します。 ...
virtual ~XmlStreamReader() noexcept
デストラクタです。
const ExiChar * GetText() noexcept
テキストデータを取得します。
const ExiChar * GetElementText() noexcept
連続したテキストイベントを読み込んで1つのテキストを返す
int GetColumnNo() const noexcept
XmlStreamReader が指し示しているカラム番号を取得します。
Preserve preserve
各種フィデリティオプションを設定します。
const ExiChar * GetNamespaceUri() noexcept
XML名前空間のURIを取得します。
XMLストリームからの読み出しを行う抽象クラスです。
ExiErrorStatus::ErrorValue GetError() const noexcept
エラー値を取得します。
ExiErrorStatus * GetErrorStatus() const noexcept
エラー状態オブジェクトを取得します。
int GetLineNo() const noexcept
XmlStreamReader が指し示している行番号を取得します。
Alignment
読み書きするバイナリXMLのアライメントを指定します。
const ExiChar * GetAttributeNamespaceUri(size_t index) noexcept
属性の名前空間URIを取得します。
XmlStreamReader, XmlStreamWriter の各インスタンス毎に設定できるアロケータです。
size_t GetNamespaceCount() noexcept
新たに宣言された名前空間の数を取得します。
XmlProcessor
利用するXmlプロセッサの指定オプションです。
size_t tempStringMaxLength
XMLコメントとProcessingInstructionの読み込みに用いるテンポラリバッファが格納できる文字列長を指定しま...
XmlProcessor processor
バイナリXMLを読み込むかテキストXMLを読み込むか指定します。
#define NLIB_NOEXCEPT
環境に合わせてnoexcept 又は同等の定義がされます。
#define NLIB_CEXPR
利用可能であればconstexprが定義されます。そうでない場合は空文字列です。
Alignment alignment
読み込むバイナリXMLのアライメントを指定します。
bool IsStartElement() const noexcept
読み込んだデータが開始タグかどうかを取得します。
XmlStreamConstants GetEventType() const noexcept
直近のXMLストリームイベントの値を返します。
bool HasName() const noexcept
ローカル名等を取得できるかどうかを返します。
bool isVersionIgnored
読み込み時にtrueにすると、バイナリXML読み込み時にバージョンのチェックを行いません。 ...
bool IsCharacters() const noexcept
読み込んだデータがテキストノードかどうかを取得します。
XmlStreamConstants
XMLストリームの読み込みで発生したXMLストリームイベントの値です。
bool IsEndElement() const noexcept
読み込んだデータが終了タグかどうかを取得します。
void Close() noexcept
XmlStreamReaderをクローズします。基となるストリームは参照されなくなるだけでクローズされません。 ...
bool fragment
複数のルートノードを持つXML(XMLフラグメント)をサポートしたバイナリXMLを読み込みます。 ...
bool HasNext() const noexcept
次のXMLストリームイベントを取得できるかどうかを返します。
ビット単位にデータが詰められたEXIストリームを読み書きします(デフォルト)。
bool HasText() const noexcept
GetText()でテキストを取得できる状態かどうかを返します。
wchar_t ExiChar
XMLパーサーの内部文字列型のtypedefです。
XmlStreamReaderの初期化オプションとなる構造体です。