parent
97cb1c6b15
commit
b717b1cd3e
|
@ -56,7 +56,11 @@ namespace Assimp {
|
||||||
|
|
||||||
/// @brief Will find a node by its name.
|
/// @brief Will find a node by its name.
|
||||||
struct find_node_by_name_predicate {
|
struct find_node_by_name_predicate {
|
||||||
std::string mName;
|
/// @brief The default constructor.
|
||||||
|
find_node_by_name_predicate() = default;
|
||||||
|
|
||||||
|
|
||||||
|
std::string mName; ///< The name to find.
|
||||||
find_node_by_name_predicate(const std::string &name) :
|
find_node_by_name_predicate(const std::string &name) :
|
||||||
mName(name) {
|
mName(name) {
|
||||||
// empty
|
// empty
|
||||||
|
@ -68,7 +72,7 @@ struct find_node_by_name_predicate {
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @brief Will convert an attribute to its int value.
|
/// @brief Will convert an attribute to its int value.
|
||||||
/// @tparam TNodeType The node type.
|
/// @tparam[in] TNodeType The node type.
|
||||||
template <class TNodeType>
|
template <class TNodeType>
|
||||||
struct NodeConverter {
|
struct NodeConverter {
|
||||||
public:
|
public:
|
||||||
|
@ -109,17 +113,17 @@ public:
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
/// @brief Will search for a child-node by its name
|
/// @brief Will search for a child-node by its name
|
||||||
/// @param name [in] The name of the child-node.
|
/// @param[in] name The name of the child-node.
|
||||||
/// @return The node instance or nullptr, if nothing was found.
|
/// @return The node instance or nullptr, if nothing was found.
|
||||||
TNodeType *findNode(const std::string &name);
|
TNodeType *findNode(const std::string &name);
|
||||||
|
|
||||||
/// @brief Will return true, if the node is a child-node.
|
/// @brief Will return true, if the node is a child-node.
|
||||||
/// @param name [in] The name of the child node to look for.
|
/// @param[in] name The name of the child node to look for.
|
||||||
/// @return true, if the node is a child-node or false if not.
|
/// @return true, if the node is a child-node or false if not.
|
||||||
bool hasNode(const std::string &name);
|
bool hasNode(const std::string &name);
|
||||||
|
|
||||||
/// @brief Will parse an xml-file from a given stream.
|
/// @brief Will parse an xml-file from a given stream.
|
||||||
/// @param stream The input stream.
|
/// @param[in] stream The input stream.
|
||||||
/// @return true, if the parsing was successful, false if not.
|
/// @return true, if the parsing was successful, false if not.
|
||||||
bool parse(IOStream *stream);
|
bool parse(IOStream *stream);
|
||||||
|
|
||||||
|
@ -140,87 +144,87 @@ public:
|
||||||
TNodeType getRootNode();
|
TNodeType getRootNode();
|
||||||
|
|
||||||
/// @brief Will check if a node with the given name is in.
|
/// @brief Will check if a node with the given name is in.
|
||||||
/// @param node [in] The node to look in.
|
/// @param[in] node The node to look in.
|
||||||
/// @param name [in] The name of the child-node.
|
/// @param[in] name The name of the child-node.
|
||||||
/// @return true, if node was found, false if not.
|
/// @return true, if node was found, false if not.
|
||||||
static inline bool hasNode(XmlNode &node, const char *name);
|
static inline bool hasNode(XmlNode &node, const char *name);
|
||||||
|
|
||||||
/// @brief Will check if an attribute is part of the XmlNode.
|
/// @brief Will check if an attribute is part of the XmlNode.
|
||||||
/// @param xmlNode [in] The node to search in.
|
/// @param[in] xmlNode The node to search in.
|
||||||
/// @param name [in} The attribute name to look for.
|
/// @param[in] name The attribute name to look for.
|
||||||
/// @return true, if the was found, false if not.
|
/// @return true, if the was found, false if not.
|
||||||
static inline bool hasAttribute(XmlNode &xmlNode, const char *name);
|
static inline bool hasAttribute(XmlNode &xmlNode, const char *name);
|
||||||
|
|
||||||
/// @brief Will try to get an unsigned int attribute value.
|
/// @brief Will try to get an unsigned int attribute value.
|
||||||
/// @param xmlNode [in] The node to search in.
|
/// @param[in] xmlNode The node to search in.
|
||||||
/// @param name [in] The attribute name to look for.
|
/// @param[in] name The attribute name to look for.
|
||||||
/// @param val [out] The unsigned int value from the attribute.
|
/// @param[out] val The unsigned int value from the attribute.
|
||||||
/// @return true, if the node contains an attribute with the given name and if the value is an unsigned int.
|
/// @return true, if the node contains an attribute with the given name and if the value is an unsigned int.
|
||||||
static inline bool getUIntAttribute(XmlNode &xmlNode, const char *name, unsigned int &val);
|
static inline bool getUIntAttribute(XmlNode &xmlNode, const char *name, unsigned int &val);
|
||||||
|
|
||||||
/// @brief Will try to get an int attribute value.
|
/// @brief Will try to get an int attribute value.
|
||||||
/// @param xmlNode [in] The node to search in.
|
/// @param[in] xmlNode The node to search in.
|
||||||
/// @param name [in] The attribute name to look for.
|
/// @param[in] name The attribute name to look for.
|
||||||
/// @param val [out] The int value from the attribute.
|
/// @param[out] val The int value from the attribute.
|
||||||
/// @return true, if the node contains an attribute with the given name and if the value is an int.
|
/// @return true, if the node contains an attribute with the given name and if the value is an int.
|
||||||
static inline bool getIntAttribute(XmlNode &xmlNode, const char *name, int &val);
|
static inline bool getIntAttribute(XmlNode &xmlNode, const char *name, int &val);
|
||||||
|
|
||||||
/// @brief Will try to get a real attribute value.
|
/// @brief Will try to get a real attribute value.
|
||||||
/// @param xmlNode [in] The node to search in.
|
/// @param[in] xmlNode The node to search in.
|
||||||
/// @param name [in] The attribute name to look for.
|
/// @param[in] name The attribute name to look for.
|
||||||
/// @param val [out] The real value from the attribute.
|
/// @param[out] val The real value from the attribute.
|
||||||
/// @return true, if the node contains an attribute with the given name and if the value is a real.
|
/// @return true, if the node contains an attribute with the given name and if the value is a real.
|
||||||
static inline bool getRealAttribute(XmlNode &xmlNode, const char *name, ai_real &val);
|
static inline bool getRealAttribute(XmlNode &xmlNode, const char *name, ai_real &val);
|
||||||
|
|
||||||
/// @brief Will try to get a float attribute value.
|
/// @brief Will try to get a float attribute value.
|
||||||
/// @param xmlNode [in] The node to search in.
|
/// @param[in] xmlNode The node to search in.
|
||||||
/// @param name [in] The attribute name to look for.
|
/// @param[in] name The attribute name to look for.
|
||||||
/// @param val [out] The float value from the attribute.
|
/// @param[out] val The float value from the attribute.
|
||||||
/// @return true, if the node contains an attribute with the given name and if the value is a float.
|
/// @return true, if the node contains an attribute with the given name and if the value is a float.
|
||||||
static inline bool getFloatAttribute(XmlNode &xmlNode, const char *name, float &val);
|
static inline bool getFloatAttribute(XmlNode &xmlNode, const char *name, float &val);
|
||||||
|
|
||||||
/// @brief Will try to get a double attribute value.
|
/// @brief Will try to get a double attribute value.
|
||||||
/// @param xmlNode [in] The node to search in.
|
/// @param[in] xmlNode The node to search in.
|
||||||
/// @param name [in] The attribute name to look for.
|
/// @param[in] name The attribute name to look for.
|
||||||
/// @param val [out] The double value from the attribute.
|
/// @param[out] val The double value from the attribute.
|
||||||
/// @return true, if the node contains an attribute with the given name and if the value is a double.
|
/// @return true, if the node contains an attribute with the given name and if the value is a double.
|
||||||
static inline bool getDoubleAttribute(XmlNode &xmlNode, const char *name, double &val);
|
static inline bool getDoubleAttribute(XmlNode &xmlNode, const char *name, double &val);
|
||||||
|
|
||||||
/// @brief Will try to get a std::string attribute value.
|
/// @brief Will try to get a std::string attribute value.
|
||||||
/// @param xmlNode [in] The node to search in.
|
/// @param[in] xmlNode The node to search in.
|
||||||
/// @param name [in] The attribute name to look for.
|
/// @param[in] name The attribute name to look for.
|
||||||
/// @param val [out] The std::string value from the attribute.
|
/// @param[out] val The std::string value from the attribute.
|
||||||
/// @return true, if the node contains an attribute with the given name and if the value is a std::string.
|
/// @return true, if the node contains an attribute with the given name and if the value is a std::string.
|
||||||
static inline bool getStdStrAttribute(XmlNode &xmlNode, const char *name, std::string &val);
|
static inline bool getStdStrAttribute(XmlNode &xmlNode, const char *name, std::string &val);
|
||||||
|
|
||||||
/// @brief Will try to get a bool attribute value.
|
/// @brief Will try to get a bool attribute value.
|
||||||
/// @param xmlNode [in] The node to search in.
|
/// @param[in] xmlNode The node to search in.
|
||||||
/// @param name [in] The attribute name to look for.
|
/// @param[in] name The attribute name to look for.
|
||||||
/// @param val [out] The bool value from the attribute.
|
/// @param[out] val The bool value from the attribute.
|
||||||
/// @return true, if the node contains an attribute with the given name and if the value is a bool.
|
/// @return true, if the node contains an attribute with the given name and if the value is a bool.
|
||||||
static inline bool getBoolAttribute(XmlNode &xmlNode, const char *name, bool &val);
|
static inline bool getBoolAttribute(XmlNode &xmlNode, const char *name, bool &val);
|
||||||
|
|
||||||
/// @brief Will try to get the value of the node as a string.
|
/// @brief Will try to get the value of the node as a string.
|
||||||
/// @param node [in] The node to search in.
|
/// @param[in] node The node to search in.
|
||||||
/// @param text [out] The value as a text.
|
/// @param[out] text The value as a text.
|
||||||
/// @return true, if the value can be read out.
|
/// @return true, if the value can be read out.
|
||||||
static inline bool getValueAsString(XmlNode &node, std::string &text);
|
static inline bool getValueAsString(XmlNode &node, std::string &text);
|
||||||
|
|
||||||
/// @brief Will try to get the value of the node as a float.
|
/// @brief Will try to get the value of the node as a float.
|
||||||
/// @param node [in] The node to search in.
|
/// @param[in] node The node to search in.
|
||||||
/// @param text [out] The value as a float.
|
/// @param[out] text The value as a float.
|
||||||
/// @return true, if the value can be read out.
|
/// @return true, if the value can be read out.
|
||||||
static inline bool getValueAsFloat(XmlNode &node, ai_real &v);
|
static inline bool getValueAsFloat(XmlNode &node, ai_real &v);
|
||||||
|
|
||||||
/// @brief Will try to get the value of the node as an integer.
|
/// @brief Will try to get the value of the node as an integer.
|
||||||
/// @param node [in] The node to search in.
|
/// @param[in] node The node to search in.
|
||||||
/// @param text [out] The value as a int.
|
/// @param[out] text The value as a int.
|
||||||
/// @return true, if the value can be read out.
|
/// @return true, if the value can be read out.
|
||||||
static inline bool getValueAsInt(XmlNode &node, int &v);
|
static inline bool getValueAsInt(XmlNode &node, int &v);
|
||||||
|
|
||||||
/// @brief Will try to get the value of the node as an bool.
|
/// @brief Will try to get the value of the node as an bool.
|
||||||
/// @param node [in] The node to search in.
|
/// @param[in] node The node to search in.
|
||||||
/// @param text [out] The value as a bool.
|
/// @param[out] text The value as a bool.
|
||||||
/// @return true, if the value can be read out.
|
/// @return true, if the value can be read out.
|
||||||
static inline bool getValueAsBool(XmlNode &node, bool &v);
|
static inline bool getValueAsBool(XmlNode &node, bool &v);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue