XML helper utilities

Overview

A PUGIXML wrappers to safely extract values of requested type. More…

// namespaces

namespace XMLParseUtils;

// structs

struct parse_result;

// global functions

int XMLParseUtils::GetIntAttr(const pugi::xml_node& node, const char \* str);

int64_t XMLParseUtils::GetInt64Attr(
    const pugi::xml_node& node,
    const char \* str
    );

int64_t XMLParseUtils::GetInt64Attr(
    const pugi::xml_node& node,
    const char \* str,
    int64_t defVal
    );

uint64_t XMLParseUtils::GetUInt64Attr(
    const pugi::xml_node& node,
    const char \* str
    );

uint64_t XMLParseUtils::GetUInt64Attr(
    const pugi::xml_node& node,
    const char \* str,
    uint64_t defVal
    );

unsigned int XMLParseUtils::GetUIntAttr(
    const pugi::xml_node& node,
    const char \* str
    );

unsigned int XMLParseUtils::GetUIntAttr(
    const pugi::xml_node& node,
    const char \* str,
    unsigned int defVal
    );

std::string XMLParseUtils::GetStrAttr(
    const pugi::xml_node& node,
    const char \* str
    );

std::string XMLParseUtils::GetStrAttr(
    const pugi::xml_node& node,
    const char \* str,
    const char \* def
    );

bool XMLParseUtils::GetBoolAttr(const pugi::xml_node& node, const char \* str);

bool XMLParseUtils::GetBoolAttr(
    const pugi::xml_node& node,
    const char \* str,
    const bool def
    );

float XMLParseUtils::GetFloatAttr(const pugi::xml_node& node, const char \* str);

float XMLParseUtils::GetFloatAttr(
    const pugi::xml_node& node,
    const char \* str,
    float defVal
    );

InferenceEngine::Precision XMLParseUtils::GetPrecisionAttr(
    const pugi::xml_node& node,
    const char \* str
    );

InferenceEngine::Precision XMLParseUtils::GetPrecisionAttr(
    const pugi::xml_node& node,
    const char \* str,
    InferenceEngine::Precision def
    );

int XMLParseUtils::GetIntChild(
    const pugi::xml_node& node,
    const char \* str,
    int defVal
    );

parse_result ParseXml(const char \* file_path);

// macros

#define FOREACH_CHILD(c, p, tag)

Detailed Documentation

A PUGIXML wrappers to safely extract values of requested type.

Global Functions

int XMLParseUtils::GetIntAttr(const pugi::xml_node& node, const char \* str)

Gets the integer attribute from pugi::xml_node

Parameters:

node

The node

str

The string

Returns:

An integer value

int64_t XMLParseUtils::GetInt64Attr(
    const pugi::xml_node& node,
    const char \* str
    )

Gets the int64_t attribute from pugi::xml_node

Parameters:

node

The node

str

The string identifying value name

Returns:

An int64_t value

int64_t XMLParseUtils::GetInt64Attr(
    const pugi::xml_node& node,
    const char \* str,
    int64_t defVal
    )

Gets the int64_t attribute from pugi::xml_node

Parameters:

node

The node

str

The string identifying value name

defVal

The default value

Returns:

An int64_t value

uint64_t XMLParseUtils::GetUInt64Attr(
    const pugi::xml_node& node,
    const char \* str
    )

Gets the uint64_t attribute from pugi::xml_node

Parameters:

node

The node

str

The string identifying value name

Returns:

An uint64_t value

uint64_t XMLParseUtils::GetUInt64Attr(
    const pugi::xml_node& node,
    const char \* str,
    uint64_t defVal
    )

Gets the uint64_t attribute from pugi::xml_node

Parameters:

node

The node

str

The string identifying value name

defVal

The default value

Returns:

An uint64_t value

unsigned int XMLParseUtils::GetUIntAttr(
    const pugi::xml_node& node,
    const char \* str
    )

Gets the unsigned integer attribute from pugi::xml_node

Parameters:

node

The node

str

The string identifying value name

Returns:

An unsigned integer value

unsigned int XMLParseUtils::GetUIntAttr(
    const pugi::xml_node& node,
    const char \* str,
    unsigned int defVal
    )

Gets the unsigned integer attribute from pugi::xml_node

Parameters:

node

The node

str

The string identifying value name

defVal

The default value

Returns:

An unsigned integer value

std::string XMLParseUtils::GetStrAttr(
    const pugi::xml_node& node,
    const char \* str
    )

Gets the string attribute from pugi::xml_node

Parameters:

node

The node

str

The string identifying value name

Returns:

A string value

std::string XMLParseUtils::GetStrAttr(
    const pugi::xml_node& node,
    const char \* str,
    const char \* def
    )

Gets the string attribute from pugi::xml_node

Parameters:

node

The node

str

The string identifying value name

def

The default value

Returns:

A string value

bool XMLParseUtils::GetBoolAttr(const pugi::xml_node& node, const char \* str)

Gets the bool attribute from pugi::xml_node

Parameters:

node

The node

str

The string identifying value name

Returns:

A boolean value

bool XMLParseUtils::GetBoolAttr(
    const pugi::xml_node& node,
    const char \* str,
    const bool def
    )

Gets the bool attribute from pugi::xml_node

Parameters:

node

The node

str

The string identifying value name

def

The default value

Returns:

A boolean value

float XMLParseUtils::GetFloatAttr(const pugi::xml_node& node, const char \* str)

Gets the float attribute from pugi::xml_node

Parameters:

node

The node

str

The string identifying value name

Returns:

A single-precision floating point value

float XMLParseUtils::GetFloatAttr(
    const pugi::xml_node& node,
    const char \* str,
    float defVal
    )

Gets the float attribute from pugi::xml_node

Parameters:

node

The node

str

The string identifying value name

defVal

The default value

Returns:

A single-precision floating point value

InferenceEngine::Precision XMLParseUtils::GetPrecisionAttr(
    const pugi::xml_node& node,
    const char \* str
    )

Gets the Precision attribute from pugi::xml_node

Parameters:

node

The node

str

The string identifying value name

Returns:

A Precision value

InferenceEngine::Precision XMLParseUtils::GetPrecisionAttr(
    const pugi::xml_node& node,
    const char \* str,
    InferenceEngine::Precision def
    )

Gets the Precision attribute from pugi::xml_node

Parameters:

node

The node

str

The string identifying value name

def

The default value

Returns:

A Precision value

int XMLParseUtils::GetIntChild(
    const pugi::xml_node& node,
    const char \* str,
    int defVal
    )

Gets the integer value located in a child node.

Parameters:

node

The node

str

The string value identifying a child node

defVal

The default value

Returns:

An ingeter value located in a child node, devVal otherwise.

parse_result ParseXml(const char \* file_path)

Parses a file and returns parse_result.

Parameters:

file_path

The file path

Returns:

The parse_result.

Macros

#define FOREACH_CHILD(c, p, tag)

Defines convinient for-each based cycle to iterate over node children.

Parameters:

c

Child node name

p

Parent node name

tag

The tag represented as a string value