This interface provides read-only access to an XML-node.
More...
#include <libCZI_Metadata.h>
This interface provides read-only access to an XML-node.
◆ EnumAttributes()
virtual void libCZI::IXmlNodeRead::EnumAttributes |
( |
const std::function< bool(const std::wstring &attribName, const std::wstring &attribValue)> & |
enumFunc | ) |
const |
|
pure virtual |
Enumerate the attributes in the node. The attribute-name and their respective value will be passed to the specified functor.
- Parameters
-
enumFunc | The enumeration function. If the function returns false, the enumeration will be cancelled immediately. |
◆ EnumChildren()
virtual void libCZI::IXmlNodeRead::EnumChildren |
( |
const std::function< bool(std::shared_ptr< IXmlNodeRead >)> & |
enumChildren | ) |
|
|
pure virtual |
Enumerate the children of the node. The functor will be called until there are no more children or if the function return false.
- Parameters
-
enumChildren | The function to be called with the children nodes. |
◆ GetChildNodeReadonly()
virtual std::shared_ptr< IXmlNodeRead > libCZI::IXmlNodeRead::GetChildNodeReadonly |
( |
const char * |
path | ) |
|
|
pure virtual |
Gets a child node for the specified path/attribute specification if it exists. Otherwise, a nullptr is returned. The path is specified as node-names separated by slashes. A path "A/B/C" selects a node-structure like this
Attributes can be specified with a node, in the form 'NodeName[attr1=abc,attr2=xyz]'. This will search for nodes with the specified attributes, and if not found, create one. In this example "A/B[Id=ab,Name=xy]/C" we will get
<A>
<B Id="ab" Name="xy">
<C/>
</B>
</A>
It is also possible to specify a number inside the square brackets, which indicates that the n-th element is to be selected. This index is zero-based. In this example
<A>
<B Id="ab" Name="xy">
<C Id="first"></C>
<C Id="second"></C>
<C Id="third"></C>
</B>
</A>
the path "A/B/C[1]" will select the second node of name 'C'.
If the path does not exist, then a nullptr is returned. This method may throw an exception if the path is not well-formed and syntactically valid.
- Parameters
-
path | The path (in UTF8-encoding). |
- Returns
- Either the requested node if it exists or nullptr.
◆ Name()
virtual std::wstring libCZI::IXmlNodeRead::Name |
( |
| ) |
const |
|
pure virtual |
Gets the name of the node.
- Returns
- The name of the node.
◆ TryGetAttribute()
virtual bool libCZI::IXmlNodeRead::TryGetAttribute |
( |
const wchar_t * |
attributeName, |
|
|
std::wstring * |
attribValue |
|
) |
| const |
|
pure virtual |
Attempts to get the attribute with the name specified by "attributeName". If it exists, the value is stored in "attribValue" (if it is non-null) and the return value is true. Otherwise, the return value is false.
- Parameters
-
| attributeName | Name of the attribute. |
[out] | attribValue | If non-null, the attribute value will be put here (if the attribute exists). |
- Returns
- True if it succeeds, false if it fails.
◆ TryGetValue()
virtual bool libCZI::IXmlNodeRead::TryGetValue |
( |
std::wstring * |
value | ) |
const |
|
pure virtual |
Attempts to get value of the XML-node. If the specified pointer "value" is non-null, the value will be put there.
- Parameters
-
[out] | value | If non-null, the value of the XML-node will be put here (if successful). |
- Returns
- True if it succeeds, false if it fails.
◆ TryGetValueAsBool()
bool libCZI::IXmlNodeRead::TryGetValueAsBool |
( |
bool * |
p | ) |
|
Attempts to get value of this node as an unsigned long integer (64-bit). Valid values for true are: "true", "yes" or "1"; valid values for false are "false", "no" or "0" (case insensitive comparison).
- Parameters
-
[in,out] | p | If non-null, a pointer to a bool to store the result in. |
- Returns
- True if it succeeds, false if it fails.
◆ TryGetValueAsDouble()
bool libCZI::IXmlNodeRead::TryGetValueAsDouble |
( |
double * |
p | ) |
|
Attempts to get value of this node as a double. If the text does not parse correctly (or is empty), we return false.
- Parameters
-
[in,out] | p | If non-null, a pointer to a double to store the result in. |
- Returns
- True if it succeeds, false if it fails.
◆ TryGetValueAsFloat()
bool libCZI::IXmlNodeRead::TryGetValueAsFloat |
( |
float * |
p | ) |
|
Attempts to get value of this node as a float. If the text does not parse correctly (or is empty), we return false.
- Parameters
-
[in,out] | p | If non-null, a pointer to a float to store the result in. |
- Returns
- True if it succeeds, false if it fails.
◆ TryGetValueAsInt32()
bool libCZI::IXmlNodeRead::TryGetValueAsInt32 |
( |
std::int32_t * |
p | ) |
|
Attempts to get value of this node as an integer (32-bit). If the text does not parse correctly (or is empty), we return false.
- Parameters
-
[in,out] | p | If non-null, a pointer to an integer to store the result in. |
- Returns
- True if it succeeds, false if it fails.
◆ TryGetValueAsInt64()
bool libCZI::IXmlNodeRead::TryGetValueAsInt64 |
( |
std::int64_t * |
p | ) |
|
Attempts to get value of this node as a long integer (64-bit). If the text does not parse correctly (or is empty), we return false.
- Parameters
-
[in,out] | p | If non-null, a pointer to a long integer (64-bit) to store the result in. |
- Returns
- True if it succeeds, false if it fails.
◆ TryGetValueAsUInt32()
bool libCZI::IXmlNodeRead::TryGetValueAsUInt32 |
( |
std::uint32_t * |
p | ) |
|
Attempts to get value of this node as an unsigned integer (32-bit). If the text does not parse correctly (or is empty), we return false.
- Parameters
-
[in,out] | p | If non-null, a pointer to an unsigned integer to store the result in. |
- Returns
- True if it succeeds, false if it fails.
◆ TryGetValueAsUInt64()
bool libCZI::IXmlNodeRead::TryGetValueAsUInt64 |
( |
std::uint64_t * |
p | ) |
|
Attempts to get value of this node as an unsigned long integer (64-bit). If the text does not parse correctly (or is empty), we return false.
- Parameters
-
[in,out] | p | If non-null, a pointer to an unsigned long integer (64-bit) to store the result in. |
- Returns
- True if it succeeds, false if it fails.
The documentation for this class was generated from the following file: