cgv
Loading...
Searching...
No Matches
cgv::xml::FindElementByNameVisitor Class Reference

Finds a tinyxml2::XMLElement by name. More...

#include <query.h>

Inheritance diagram for cgv::xml::FindElementByNameVisitor:

Public Member Functions

 FindElementByNameVisitor (const std::string &name)
 
void SetQueryName (const std::string &name)
 Changes the name used to find a matching element.
 
const tinyxml2::XMLElement * Result () const
 Get the query result.
 
bool VisitEnter (const tinyxml2::XMLElement &element, const tinyxml2::XMLAttribute *attribute) override
 

Detailed Description

Finds a tinyxml2::XMLElement by name.

Implements a tinyxml2::XMLVisitor for tinyxml2::XMLNode::Accept.

Example usage:

tinyxml2::XMLDocument document;
cgv::xml::FindElementByNameVisitor findElementByName("Name");
document.Accept(&findElementByName);
if(auto color_maps_elem = findElementByName.Result()) {
// element with name was found
}
Finds a tinyxml2::XMLElement by name.
Definition query.h:27

Definition at line 27 of file query.h.

Constructor & Destructor Documentation

◆ FindElementByNameVisitor() [1/2]

cgv::xml::FindElementByNameVisitor::FindElementByNameVisitor ( )
inline

Definition at line 33 of file query.h.

◆ FindElementByNameVisitor() [2/2]

cgv::xml::FindElementByNameVisitor::FindElementByNameVisitor ( const std::string &  name)
inline

Definition at line 35 of file query.h.

Member Function Documentation

◆ Result()

const tinyxml2::XMLElement * cgv::xml::FindElementByNameVisitor::Result ( ) const
inline

Get the query result.

Returns
the pointer to the matching tinyxml::XMLElement; if no match was found return nullptr

Definition at line 46 of file query.h.

◆ SetQueryName()

void cgv::xml::FindElementByNameVisitor::SetQueryName ( const std::string &  name)
inline

Changes the name used to find a matching element.

Parameters
namethe query name string.

Definition at line 39 of file query.h.

◆ VisitEnter()

bool cgv::xml::FindElementByNameVisitor::VisitEnter ( const tinyxml2::XMLElement &  element,
const tinyxml2::XMLAttribute *  attribute 
)
inlineoverride

Definition at line 51 of file query.h.


The documentation for this class was generated from the following file: