Class that catch XML Parser events for a specific tag and build the corresponding Object.
More...
#include <hpp/manipulation/parser/parser.hh>
Class that catch XML Parser events for a specific tag and build the corresponding Object.
Derive this class if you wish to extend the Parser. The event callbacks are called in the following order:
- Note
- The derived class must have the following construtor
hpp::manipulation::parser::ObjectFactory::ObjectFactory |
( |
ObjectFactory * |
parent = NULL , |
|
|
const XMLElement * |
element = NULL |
|
) |
| |
virtual hpp::manipulation::parser::ObjectFactory::~ObjectFactory |
( |
| ) |
|
|
inlinevirtual |
References addTextChild(), finishAttributes(), finishFile(), finishTags(), getAttribute(), getChildOfType(), getChildrenOfType(), hasAttribute(), init(), name(), setAttribute(), and tagName().
hpp::manipulation::parser::ObjectFactory::ObjectFactory |
( |
RootFactory * |
root | ) |
|
|
protected |
void hpp::manipulation::parser::ObjectFactory::addChild |
( |
ObjectFactory * |
child | ) |
|
|
protected |
virtual void hpp::manipulation::parser::ObjectFactory::addTextChild |
( |
const XMLText * |
text | ) |
|
|
virtual |
template<typename T >
T* hpp::manipulation::parser::ObjectFactory::as |
( |
| ) |
|
|
inline |
virtual bool hpp::manipulation::parser::ObjectFactory::finishAttributes |
( |
| ) |
|
|
virtual |
Called when all the attributes have been processed.
- Returns
- True to continue parsing this tag, False otherwise.
Referenced by ~ObjectFactory().
virtual void hpp::manipulation::parser::ObjectFactory::finishFile |
( |
| ) |
|
|
virtual |
virtual void hpp::manipulation::parser::ObjectFactory::finishTags |
( |
| ) |
|
|
virtual |
std::string hpp::manipulation::parser::ObjectFactory::getAttribute |
( |
const std::string & |
attr | ) |
const |
bool hpp::manipulation::parser::ObjectFactory::getChildOfType |
( |
std::string |
type, |
|
|
ObjectFactory *& |
o |
|
) |
| |
Get the ObjectFactory whose tag name is type.
- Parameters
-
[out] | o | Set to the first element of the requested type. |
- Returns
- true if there was only element of the requested type. false if there are more than one.
- Exceptions
-
std::invalid_argument | if no ObjectFactory of the requested type exists. |
Referenced by ~ObjectFactory().
ObjectFactoryList hpp::manipulation::parser::ObjectFactory::getChildrenOfType |
( |
std::string |
type | ) |
|
bool hpp::manipulation::parser::ObjectFactory::hasAttribute |
( |
const std::string & |
attr | ) |
const |
bool hpp::manipulation::parser::ObjectFactory::hasParent |
( |
| ) |
const |
|
protected |
virtual void hpp::manipulation::parser::ObjectFactory::impl_setAttribute |
( |
const XMLAttribute * |
attr | ) |
|
|
protectedvirtual |
virtual bool hpp::manipulation::parser::ObjectFactory::init |
( |
| ) |
|
|
virtual |
std::string hpp::manipulation::parser::ObjectFactory::name |
( |
| ) |
const |
Return the content of the attribute name, or an empty string.
Referenced by ~ObjectFactory().
void hpp::manipulation::parser::ObjectFactory::name |
( |
const std::string & |
n | ) |
|
Set the name.
The default value is the value of the attribute "name" of the XML tag or an empty string if this does not exist.
void hpp::manipulation::parser::ObjectFactory::name |
( |
const char * |
n | ) |
|
ObjectFactory* hpp::manipulation::parser::ObjectFactory::parent |
( |
| ) |
|
|
protected |
virtual std::ostream& hpp::manipulation::parser::ObjectFactory::print |
( |
std::ostream & |
os | ) |
const |
|
protectedvirtual |
RootFactory* hpp::manipulation::parser::ObjectFactory::root |
( |
| ) |
|
|
protected |
void hpp::manipulation::parser::ObjectFactory::setAttribute |
( |
const XMLAttribute * |
attr | ) |
|
Called for each attribute.
A few reserved name are automatocally catched. The reserved names are "name" and "id". "name" expects a string. "id" expects an unsigned integer and can be use to define pointers to elements.
Referenced by ~ObjectFactory().
std::string hpp::manipulation::parser::ObjectFactory::tagName |
( |
| ) |
const |
Return tag name of the element is any.
Returns "No element" otherwise.
Referenced by as(), and ~ObjectFactory().
const XMLElement* hpp::manipulation::parser::ObjectFactory::XMLelement |
( |
| ) |
|
|
protected |
std::ostream& operator<< |
( |
std::ostream & |
, |
|
|
const ObjectFactory & |
|
|
) |
| |
|
friend |