|
libzypp 17.37.10
|
Define a xml node structure to parse. More...
#include <zypp/parser/xml/ParseDef.h>
Classes | |
| class | Impl |
| ParseDef implementation. More... | |
Public Types | |
| enum | Mode { OPTIONAL = Traits::BIT_OPTIONAL | Traits::BIT_ONCE , MANDTAORY = Traits::BIT_MANDTAORY | Traits::BIT_ONCE , MULTIPLE_OPTIONAL = Traits::BIT_OPTIONAL | Traits::BIT_MULTIPLE , MULTIPLE_MANDTAORY = Traits::BIT_MANDTAORY | Traits::BIT_MULTIPLE } |
Public Member Functions | |
| ParseDef (std::string name_r, Mode mode_r) | |
| ParseDef (std::string name_r, Mode mode_r, shared_ptr< ParseDefConsume > target_r) | |
| virtual | ~ParseDef () |
| const std::string & | name () const |
| Mode | mode () const |
| bool | isOptional () const |
| bool | isMandatory () const |
| bool | singleDef () const |
| bool | multiDef () const |
| unsigned | visited () const |
| ParseDef & | addNode (ParseDef &subnode_r) |
| Add subnode definition. | |
| ParseDef & | addNode (const std::string &name_r, Mode mode_r) |
| ParseDef & | addNode (const std::string &name_r, Mode mode_r, const shared_ptr< ParseDefConsume > &target_r) |
| ParseDef & | operator() (ParseDef &subnode_r) |
| Add subnode definition. | |
| ParseDef & | operator() (const std::string &name_r, Mode mode_r) |
| ParseDef & | operator() (const std::string &name_r, Mode mode_r, const shared_ptr< ParseDefConsume > &target_r) |
| ParseDef | operator[] (const std::string &name_r) |
| Get subnode by name. | |
| void | setConsumer (const shared_ptr< ParseDefConsume > &target_r) |
| Set data consumer. | |
| void | setConsumer (ParseDefConsume *allocatedTarget_r) |
| Set data consumer. | |
| void | setConsumer (ParseDefConsume &target_r) |
| Set data consumer. | |
| void | cancelConsumer () |
| Unset data consumer. | |
| shared_ptr< ParseDefConsume > | getConsumer () const |
| Get data consumer. | |
| void | take (Reader &reader_r) |
| Parse the node. | |
Static Public Attributes | |
| static bool | _debug = false |
Private Types | |
| using | Traits = ParseDefTraits |
Private Member Functions | |
| ParseDef (const shared_ptr< Impl > &pimpl_r) | |
Private Attributes | |
| RW_pointer< Impl > | _pimpl |
| Pointer to implementation (shared!) | |
Friends | |
| std::ostream & | operator<< (std::ostream &str, const ParseDef &obj) |
| std::ostream & | operator<< (std::ostream &str, const ParseDef::Impl &obj) |
Related Symbols | |
(Note that these are not member symbols.) | |
| std::ostream & | operator<< (std::ostream &str, ParseDef::Mode obj) |
| ParseDef::Mode stream output. | |
| std::ostream & | operator<< (std::ostream &str, const ParseDef &obj) |
| Stream output. | |
Define a xml node structure to parse.
An xml file like this:
Could be described by:
To parse it using an xml::Reader:
Whithout data consumers this will just parse the file but not retrieve any data. You may attach a consumer derived from xml::ParseDefConsume to each node:
That's just one way to collect the data. You could as well use a xml::ParseDefConsumeCallback, and redirect the start call to some arbitrary function or method.
Definition at line 128 of file ParseDef.h.
|
private |
Definition at line 130 of file ParseDef.h.
| Enumerator | |
|---|---|
| OPTIONAL | |
| MANDTAORY | |
| MULTIPLE_OPTIONAL | |
| MULTIPLE_MANDTAORY | |
Definition at line 133 of file ParseDef.h.
| zypp::xml::ParseDef::ParseDef | ( | std::string | name_r, |
| Mode | mode_r ) |
Definition at line 374 of file ParseDef.cc.
| zypp::xml::ParseDef::ParseDef | ( | std::string | name_r, |
| Mode | mode_r, | ||
| shared_ptr< ParseDefConsume > | target_r ) |
Definition at line 378 of file ParseDef.cc.
|
virtual |
Definition at line 391 of file ParseDef.cc.
|
private |
Definition at line 382 of file ParseDef.cc.
| const std::string & zypp::xml::ParseDef::name | ( | ) | const |
Definition at line 394 of file ParseDef.cc.
| ParseDef::Mode zypp::xml::ParseDef::mode | ( | ) | const |
Definition at line 397 of file ParseDef.cc.
| bool zypp::xml::ParseDef::isOptional | ( | ) | const |
Definition at line 400 of file ParseDef.cc.
| bool zypp::xml::ParseDef::isMandatory | ( | ) | const |
Definition at line 403 of file ParseDef.cc.
| bool zypp::xml::ParseDef::singleDef | ( | ) | const |
Definition at line 406 of file ParseDef.cc.
| bool zypp::xml::ParseDef::multiDef | ( | ) | const |
Definition at line 409 of file ParseDef.cc.
| unsigned zypp::xml::ParseDef::visited | ( | ) | const |
Definition at line 412 of file ParseDef.cc.
Add subnode definition.
| ParseDefBuildException | if a subnode with the same name is already defined, or if the subnode is already subnode of an other ParseDef. |
Definition at line 415 of file ParseDef.cc.
Definition at line 167 of file ParseDef.h.
|
inline |
Definition at line 170 of file ParseDef.h.
Definition at line 179 of file ParseDef.h.
|
inline |
Definition at line 182 of file ParseDef.h.
| ParseDef zypp::xml::ParseDef::operator[] | ( | const std::string & | name_r | ) |
Get subnode by name.
| ParseDefBuildException | if no subnode with name_r exists. |
Definition at line 418 of file ParseDef.cc.
| void zypp::xml::ParseDef::setConsumer | ( | const shared_ptr< ParseDefConsume > & | target_r | ) |
Set data consumer.
Definition at line 428 of file ParseDef.cc.
| void zypp::xml::ParseDef::setConsumer | ( | ParseDefConsume * | allocatedTarget_r | ) |
Set data consumer.
Definition at line 431 of file ParseDef.cc.
| void zypp::xml::ParseDef::setConsumer | ( | ParseDefConsume & | target_r | ) |
Set data consumer.
Definition at line 434 of file ParseDef.cc.
| void zypp::xml::ParseDef::cancelConsumer | ( | ) |
Unset data consumer.
Definition at line 437 of file ParseDef.cc.
| shared_ptr< ParseDefConsume > zypp::xml::ParseDef::getConsumer | ( | ) | const |
Get data consumer.
Definition at line 440 of file ParseDef.cc.
| void zypp::xml::ParseDef::take | ( | Reader & | reader_r | ) |
Parse the node.
This parses the node and all defined subnodes. Unknown subnodes are skipped and leave a warning in the logfile.
| ParseDefException | on error. |
Definition at line 444 of file ParseDef.cc.
|
friend |
Definition at line 471 of file ParseDef.cc.
|
friend |
Definition at line 353 of file ParseDef.cc.
|
ParseDef::Mode stream output.
Definition at line 452 of file ParseDef.cc.
|
Stream output.
Definition at line 471 of file ParseDef.cc.
|
private |
Pointer to implementation (shared!)
Definition at line 222 of file ParseDef.h.
|
static |
Definition at line 229 of file ParseDef.h.