16 #ifndef INCLUDE_NN_NLIB_EXI_XMLSTREAMREADER_H_ 17 #define INCLUDE_NN_NLIB_EXI_XMLSTREAMREADER_H_ 22 #if defined(_MSC_VER) && defined(nx_exi_EXPORTS) 23 #undef NLIB_VIS_PUBLIC 24 #define NLIB_VIS_PUBLIC NLIB_WINEXPORT 47 isVersionIgnored(false),
49 tempStringMaxLength(1023) {}
53 class ExiStringAllocator;
62 kProcessingInstruction = 3,
71 PROCESSING_INSTRUCTION = 3,
90 return Create(stream, settings, al);
94 return Create(stream, settings);
98 return Create(stream, settings, al);
103 if (is_local_al_) ExiAllocator::Swap(al_);
106 ExiAllocatorSwapper swapper(al_);
110 ExiAllocatorSwapper swapper(al_);
111 return this->GetAttributeCountV();
114 ExiAllocatorSwapper swapper(al_);
115 return this->GetAttributeLocalNameV(index);
118 ExiAllocatorSwapper swapper(al_);
119 return this->GetAttributeNamespaceUriV(index);
122 ExiAllocatorSwapper swapper(al_);
123 return this->GetAttributePrefixV(index);
126 ExiAllocatorSwapper swapper(al_);
127 return this->GetAttributeTypeV(index);
130 ExiAllocatorSwapper swapper(al_);
131 return this->GetAttributeValueV(index);
135 ExiAllocatorSwapper swapper(al_);
136 return this->GetAttributeValueV(namespace_uri, local_name);
139 ExiAllocatorSwapper swapper(al_);
140 return this->GetNamespaceCountV();
143 ExiAllocatorSwapper swapper(al_);
144 return this->GetNamespacePrefixV(index);
147 ExiAllocatorSwapper swapper(al_);
148 return this->GetNamespaceUriV(index);
151 ExiAllocatorSwapper swapper(al_);
152 return this->GetElementTextV();
155 ExiAllocatorSwapper swapper(al_);
156 return this->GetLocalNameV();
159 ExiAllocatorSwapper swapper(al_);
160 return this->GetNamespaceUriV();
163 ExiAllocatorSwapper swapper(al_);
164 return this->GetPrefixV();
167 ExiAllocatorSwapper swapper(al_);
168 return this->GetTextV();
173 ExiAllocatorSwapper swapper(al_);
174 return this->NextV();
180 return state_ == START_ELEMENT || state_ == END_ELEMENT || state_ == PROCESSING_INSTRUCTION;
184 return state_ == CHARACTERS || state_ == CDATA || state_ == COMMENT ||
185 state_ == PROCESSING_INSTRUCTION;
198 state_(START_DOCUMENT) {}
200 void SetExiErrorStatus(ExiErrorStatus* p)
NLIB_NOEXCEPT { error_status_ = p; }
201 ExiErrorStatus* GetExiErrorStatus() const
NLIB_NOEXCEPT {
return error_status_; }
204 template<
class DECODER>
206 template<
class DECODER>
208 template<
class DECODER>
210 template<
class DECODER>
212 template<
class DECODER>
214 template<
class DECODER>
215 const ExiChar* GetAttributeValue_(DECODER* decoder,
const ExiChar* namespace_uri,
217 template<
class DECODER>
219 template<
class DECODER>
221 template<
class DECODER>
224 template<
class DECODER>
226 template<
class DECODER>
228 template<
class DECODER>
230 template<
class DECODER>
257 ExiErrorStatus* error_status_;
269 #if defined(_MSC_VER) && defined(nx_exi_EXPORTS) 270 #undef NLIB_VIS_PUBLIC 271 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT 274 #endif // INCLUDE_NN_NLIB_EXI_XMLSTREAMREADER_H_ XmlStreamConstants Next() noexcept
Reads the next XML stream event from the stream.
static XmlStreamReader * Create(InputStream *stream, const ExiAllocatorEx &al) noexcept
Creates an XmlStreamReader instance by specifying an objectwise allocator.
size_t GetAttributeCount() noexcept
Gets the number of attributes.
Defines constructs such as string-type typedef statements and utility macros.
static XmlStreamReader * Create(InputStream *stream, const XmlStreamReaderSettings &settings) noexcept
Creates an instance of XmlStreamReader.
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
Prohibits use of the copy constructor and assignment operator for the class specified by TypeName...
const ExiChar * GetNamespacePrefix(size_t index) noexcept
Gets the prefix of a namespace declaration.
const ExiChar * GetLocalName() noexcept
Gets the local name.
#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...
const ExiChar * GetAttributePrefix(size_t index) noexcept
Gets the prefix of an attribute.
Set of options that preserve the binary XML to read or write.
const ExiChar * GetAttributeValue(const ExiChar *namespace_uri, const ExiChar *local_name) noexcept
Gets the value of the attribute based on a particular namespace URI and local name.
const ExiChar * GetAttributeLocalName(size_t index) noexcept
Gets the local name of an attribute.
const ExiChar * GetNamespaceUri(size_t index) noexcept
Gets the namespace URI of a namespace declaration.
const ExiChar * GetPrefix() noexcept
Gets the namespace prefix of the XML.
const ExiChar * GetAttributeValue(size_t index) noexcept
Gets the value of an attribute.
constexpr XmlStreamReaderSettings() noexcept
Configures the default settings.
static XmlStreamReader * Create(InputStream *stream) noexcept
Creates an XmlStreamReader instance using default settings for XmlStreamReaderSettings.
virtual ~XmlStreamReader() noexcept
Destructor.
const ExiChar * GetText() noexcept
Gets text data.
Sets and stores the error status of the XML parser.
const ExiChar * GetElementText() noexcept
Reads a series of text events and returns a single text element.
int GetColumnNo() const noexcept
Gets the column number indicated by the XmlStreamReader.
Preserve preserve
Sets the fidelity options.
const ExiChar * GetNamespaceUri() noexcept
Gets the URI of the XML namespace.
Abstract class that reads from an XML stream.
ExiErrorStatus::ErrorValue GetError() const noexcept
Gets the error value.
ExiErrorStatus * GetErrorStatus() const noexcept
Gets an error status object.
int GetLineNo() const noexcept
Gets the line number indicated by the XmlStreamReader.
Alignment
Specifies the alignment of the binary XML to read or write.
const ExiChar * GetAttributeNamespaceUri(size_t index) noexcept
Gets the namespace URI of an attribute.
Allocator that can be set for each instance of XmlStreamReader and XmlStreamWriter.
size_t GetNamespaceCount() noexcept
Gets the number of newly defined namespaces.
XmlProcessor
Option that specifies which XML processor to use.
size_t tempStringMaxLength
Specifies the length of the string that stores the temporary buffer used when reading XML comments an...
ErrorValue
Enumerates error statuses.
XmlProcessor processor
Specifies whether to read binary XML or text-based XML.
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
#define NLIB_CEXPR
Defines constexpr if it is available for use. If not, holds an empty string.
Alignment alignment
Specifies the alignment of the binary XML to read.
bool IsStartElement() const noexcept
Gets whether the data that was read is an opening tag.
XmlStreamConstants GetEventType() const noexcept
Returns the value for the most recent XML stream event.
Defines the errors returned by the XML parser.
bool HasName() const noexcept
Returns whether data like a local name can be obtained.
bool isVersionIgnored
By setting this option to true during read operations, you can ignore the version check when reading ...
bool IsCharacters() const noexcept
Gets whether the data that was read is a text node.
XmlStreamConstants
Values of XML stream events that occurred while reading an XML stream.
bool IsEndElement() const noexcept
Gets whether the data that was read is a closing tag.
void Close() noexcept
Closes an XmlStreamReader. The original stream is not actually closed; it merely stops being referenc...
bool fragment
Reads binary XML that supports multiple root nodes (aka XML fragments).
bool HasNext() const noexcept
Returns whether the next XML stream event can be obtained.
Reads from and writes to a bit-packed EXI stream (default).
bool HasText() const noexcept
Returns whether text is ready to be obtained using GetText().
nlib_utf8_t ExiChar
A string-type typedef used internally by the XML parser.
Structure used as the initialization options for XmlStreamReader.