17#include <zypp/base/Logger.h>
18#include <zypp/base/String.h>
19#include <zypp-core/base/DtorReset>
20#include <zypp-core/base/DefaultIntegral>
99 typedef std::map<std::string, ImplPtr>
SubNodes;
115 it->second->_parent =
NULL;
157 std::ostringstream
str;
163 std::ostringstream
str;
188 std::pair<SubNodes::iterator, bool>
res
195 if (
res.first->second->_parent )
199 res.first->second->_parent =
this;
250 for (
bool done =
false; ! done ; )
274 WAR <<
"Skip unknown node " << *
reader_r <<
" in "<< *
this << endl;
282 if (
reader_r->depth() == _parseDepth
312 for ( SubNodes::iterator
it = _subnodes.begin();
it != _subnodes.end(); ++
it )
314 if ( !
it->second->_visited &&
it->second->isMandatory() )
318 it->second->_visited = 0;
335 ( exstr(
str::form(
"EOF while looking for [%d] <\\%s>",
350 return str <<
"ParseDef(" <<
obj._name
352 <<
", visits " <<
obj._visited
396 {
return _pimpl->isOptional(); }
399 {
return _pimpl->isMandatory(); }
402 {
return _pimpl->singleDef(); }
405 {
return _pimpl->multiDef(); }
408 {
return _pimpl->_visited; }
433 {
_pimpl->_callback.cancelRedirect(); }
436 {
return _pimpl->_callback.getRedirect(); }
451#define X(T) case ParseDef::T: return str << #T
454 X(MULTIPLE_OPTIONAL);
455 X(MULTIPLE_MANDTAORY);
std::unordered_set< sat::detail::IdType > _visited
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
shared_ptr< Impl > _pimpl
Integral type with defined initial value when default constructed.
Assign a vaiable a certain value when going out of scope.
xmlTextReader based interface to Reader's current node.
ParseDef consumer redirecting all events to another consumer.
virtual void start(const Node &_node)
virtual void startSubnode(const Node &_node)
virtual void doneSubnode(const Node &_node)
virtual void done(const Node &_node)
virtual void text(const Node &_node)
void setRedirect(const shared_ptr< ParseDefConsume > &target_r)
virtual void cdata(const Node &_node)
bool skipNode(Reader &reader_r)
Skip the current node.
void take(Reader &reader_r)
DefaultIntegral< int,-1 > _parseDepth
std::string exstr(const std::string &what_r, const Impl &impl_r) const
ImplPtr getNode(const std::string &name_r) const
ParseDefImplConsume _callback
void addNode(const ImplPtr &subnode_r)
DefaultIntegral< unsigned, 0 > _visited
shared_ptr< Impl > ImplPtr
friend std::ostream & operator<<(std::ostream &str, const ParseDef::Impl &obj)
Impl(const std::string &name_r, Mode mode_r, const shared_ptr< ParseDefConsume > &target_r=shared_ptr< ParseDefConsume >())
std::map< std::string, ImplPtr > SubNodes
std::string exstr(const std::string &what_r, const Impl &impl_r, const Reader &reader_r) const
Define a xml node structure to parse.
void setConsumer(const shared_ptr< ParseDefConsume > &target_r)
Set data consumer.
const std::string & name() const
void cancelConsumer()
Unset data consumer.
RW_pointer< Impl > _pimpl
Pointer to implementation (shared!)
ParseDef & addNode(ParseDef &subnode_r)
Add subnode definition.
shared_ptr< ParseDefConsume > getConsumer() const
Get data consumer.
friend std::ostream & operator<<(std::ostream &str, const ParseDef &obj)
ParseDef operator[](const std::string &name_r)
Get subnode by name.
void take(Reader &reader_r)
Parse the node.
ParseDef(const std::string &name_r, Mode mode_r)
xmlTextReader based interface to iterate xml streams.
const ProcessCredentials & _callback
String related utilities and Regular expression matching.
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
std::ostream & operator<<(std::ostream &str, const ReadState &obj)
Easy-to use interface to the ZYPP dependency resolver.
Range of bits starting at bit _begin with length _size.
Exceptions when building a ParseDef tree.
Base class for ParseDef consumer.
virtual void text(const Node &node_r)
virtual void startSubnode(const Node &node_r)
virtual void cdata(const Node &node_r)
void debuglog(const char *const tag_r, const Node &node_r)
virtual void doneSubnode(const Node &node_r)
virtual void done(const Node &node_r)
virtual void start(const Node &node_r)
bit::BitField< ModeBitsType > ModeBits
Parse exceptions related to the documents node structure.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.