zypp::parser::yum::YUMPrimaryParser Class Reference

Parser for YUM primary.xml files (containing package metadata) Use this class as an iterator that produces, one after one, YUMPrimaryData_Ptr(s) for the XML package elements in the input. More...

#include <YUMPrimaryParser.h>

Inheritance diagram for zypp::parser::yum::YUMPrimaryParser:

zypp::parser::XMLNodeIterator< YUMPrimaryData_Ptr > zypp::parser::XMLNodeIteratorBase iterator List of all members.

Public Member Functions

 YUMPrimaryParser (std::istream &is, const std::string &baseUrl, parser::ParserProgress::Ptr progress=parser::ParserProgress::Ptr())
 YUMPrimaryParser (const Pathname &filename, const std::string &baseUrl, parser::ParserProgress::Ptr progress=parser::ParserProgress::Ptr())
 YUMPrimaryParser ()
 YUMPrimaryParser (YUMPrimaryData_Ptr &entry)
virtual ~YUMPrimaryParser ()

Private Member Functions

virtual bool isInterested (const xmlNodePtr nodePtr)
 filter for the xml nodes The derived class decides which xml nodes it is actually interested in.
virtual YUMPrimaryData_Ptr process (const xmlTextReaderPtr reader)
 process an xml node The derived class has to produce the ENTRYTYPE object here.
void parseFormatNode (YUMPrimaryData_Ptr dataPtr, xmlNodePtr formatNode)
void parseDependencyEntries (std::list< YUMDependency > *depList, xmlNodePtr depNode)
void parseAuthorEntries (std::list< std::string > *authors, xmlNodePtr node)
void parseKeywordEntries (std::list< std::string > *keywords, xmlNodePtr node)
void parseDirsizeEntries (std::list< YUMDirSize > *sizes, xmlNodePtr node)

Private Attributes

LibXMLHelper _helper
Arch _zypp_architecture

Friends

class YUMPatchParser
class YUMProductParser
class YUMPatternParser

Detailed Description

Parser for YUM primary.xml files (containing package metadata) Use this class as an iterator that produces, one after one, YUMPrimaryData_Ptr(s) for the XML package elements in the input.

Here's an example:

for (YUMPrimaryParser iter(anIstream, baseUrl), iter != YUMOtherParser.end(), // or: iter() != 0, or ! iter.atEnd() ++iter) { doSomething(*iter) }

The iterator owns the pointer (i.e., caller must not delete it) until the next ++ operator is called. At this time, it will be destroyed (and a new ENTRYTYPE is created.)

If the input is fundamentally flawed so that it makes no sense to continue parsing, XMLNodeIterator will log it and consider the input as finished. You can query the exit status with errorStatus().

Definition at line 51 of file YUMPrimaryParser.h.


Constructor & Destructor Documentation

zypp::parser::yum::YUMPrimaryParser::YUMPrimaryParser ( std::istream &  is,
const std::string &  baseUrl,
parser::ParserProgress::Ptr  progress = parser::ParserProgress::Ptr() 
)

Definition at line 34 of file YUMPrimaryParser.cc.

References ERR, and zypp::parser::XMLNodeIteratorBase::fetchNext().

zypp::parser::yum::YUMPrimaryParser::YUMPrimaryParser ( const Pathname &  filename,
const std::string &  baseUrl,
parser::ParserProgress::Ptr  progress = parser::ParserProgress::Ptr() 
)

Definition at line 45 of file YUMPrimaryParser.cc.

References zypp::parser::XMLNodeIteratorBase::fetchNext().

zypp::parser::yum::YUMPrimaryParser::YUMPrimaryParser (  ) 

Definition at line 52 of file YUMPrimaryParser.cc.

zypp::parser::yum::YUMPrimaryParser::YUMPrimaryParser ( YUMPrimaryData_Ptr &  entry  ) 

Definition at line 56 of file YUMPrimaryParser.cc.

zypp::parser::yum::YUMPrimaryParser::~YUMPrimaryParser (  )  [virtual]

Definition at line 62 of file YUMPrimaryParser.cc.


Member Function Documentation

bool zypp::parser::yum::YUMPrimaryParser::isInterested ( const xmlNodePtr  nodePtr  )  [private, virtual]

filter for the xml nodes The derived class decides which xml nodes it is actually interested in.

For each that is selected, process() will be called an the resulting ENTRYTYPE object used as the next value for the iterator. Documentation for the node structure can be found in the libxml2 documentation. Have a look at LibXMLHelper to access node attributes and contents.

Parameters:
nodePtr points to the xml node in question. Only the node is available, not the subtree. See libxml2 documentation.
Returns:
true if interested

Implements zypp::parser::XMLNodeIterator< YUMPrimaryData_Ptr >.

Definition at line 70 of file YUMPrimaryParser.cc.

References _helper, zypp::parser::LibXMLHelper::isElement(), and zypp::parser::LibXMLHelper::name().

YUMPrimaryData_Ptr zypp::parser::yum::YUMPrimaryParser::process ( const xmlTextReaderPtr  reader  )  [private, virtual]

process an xml node The derived class has to produce the ENTRYTYPE object here.

Details about the xml reader is in the libxml2 documentation. You'll most probably want to use xmlTextReaderExpand(reader) to request the full subtree, and then use the links in the resulting node structure to traverse, and class LibXMLHelper to access the attributes and element contents. fetchNext() cannot throw an error since it will be called in the constructor. Instead, in case of a fundamental syntax error the error is saved and will be thrown with the next checkError().

Parameters:
readerPtr points to the xmlTextReader that reads the xml stream.
Returns:

Implements zypp::parser::XMLNodeIterator< YUMPrimaryData_Ptr >.

Definition at line 80 of file YUMPrimaryParser.cc.

References _helper, _zypp_architecture, zypp::parser::LibXMLHelper::attribute(), zypp::parser::LibXMLHelper::content(), DBG, zypp::parser::LibXMLHelper::isElement(), zypp::parser::LibXMLHelper::name(), name, parseFormatNode(), zypp::parser::LibXMLHelper::positionInfo(), WAR, xml_assert, and ZYPP_CAUGHT.

void zypp::parser::yum::YUMPrimaryParser::parseFormatNode ( YUMPrimaryData_Ptr  dataPtr,
xmlNodePtr  formatNode 
) [private]

Definition at line 189 of file YUMPrimaryParser.cc.

References _helper, zypp::parser::LibXMLHelper::attribute(), zypp::parser::LibXMLHelper::content(), zypp::parser::LibXMLHelper::isElement(), zypp::parser::LibXMLHelper::name(), name, parseAuthorEntries(), parseDependencyEntries(), parseDirsizeEntries(), parseKeywordEntries(), zypp::parser::LibXMLHelper::positionInfo(), WAR, and xml_assert.

Referenced by process().

void zypp::parser::yum::YUMPrimaryParser::parseDependencyEntries ( std::list< YUMDependency > *  depList,
xmlNodePtr  depNode 
) [private]

Definition at line 305 of file YUMPrimaryParser.cc.

References _helper, zypp::parser::LibXMLHelper::attribute(), zypp::parser::LibXMLHelper::content(), zypp::parser::LibXMLHelper::isElement(), zypp::parser::LibXMLHelper::name(), name, zypp::parser::LibXMLHelper::positionInfo(), WAR, and xml_assert.

Referenced by parseFormatNode(), zypp::parser::yum::YUMPatchParser::parseFormatNode(), zypp::parser::yum::YUMPatchParser::parseMessageNode(), zypp::parser::yum::YUMPatchParser::parseScriptNode(), zypp::parser::yum::YUMProductParser::process(), zypp::parser::yum::YUMPatternParser::process(), and zypp::parser::yum::YUMPatchParser::process().

void zypp::parser::yum::YUMPrimaryParser::parseAuthorEntries ( std::list< std::string > *  authors,
xmlNodePtr  node 
) [private]

Definition at line 360 of file YUMPrimaryParser.cc.

References _helper, zypp::parser::LibXMLHelper::content(), zypp::parser::LibXMLHelper::isElement(), zypp::parser::LibXMLHelper::name(), name, zypp::parser::LibXMLHelper::positionInfo(), WAR, and xml_assert.

Referenced by parseFormatNode(), and zypp::parser::yum::YUMPatchParser::parseFormatNode().

void zypp::parser::yum::YUMPrimaryParser::parseKeywordEntries ( std::list< std::string > *  keywords,
xmlNodePtr  node 
) [private]

Definition at line 386 of file YUMPrimaryParser.cc.

References _helper, zypp::parser::LibXMLHelper::content(), zypp::parser::LibXMLHelper::isElement(), zypp::parser::LibXMLHelper::name(), name, zypp::parser::LibXMLHelper::positionInfo(), WAR, and xml_assert.

Referenced by parseFormatNode(), and zypp::parser::yum::YUMPatchParser::parseFormatNode().

void zypp::parser::yum::YUMPrimaryParser::parseDirsizeEntries ( std::list< YUMDirSize > *  sizes,
xmlNodePtr  node 
) [private]

Definition at line 412 of file YUMPrimaryParser.cc.

References _helper, zypp::parser::LibXMLHelper::attribute(), zypp::parser::LibXMLHelper::isElement(), zypp::parser::LibXMLHelper::name(), name, zypp::parser::LibXMLHelper::positionInfo(), WAR, and xml_assert.

Referenced by parseFormatNode(), and zypp::parser::yum::YUMPatchParser::parseFormatNode().


Friends And Related Function Documentation

friend class YUMPatchParser [friend]

Definition at line 62 of file YUMPrimaryParser.h.

friend class YUMProductParser [friend]

Definition at line 63 of file YUMPrimaryParser.h.

friend class YUMPatternParser [friend]

Definition at line 64 of file YUMPrimaryParser.h.


Member Data Documentation

LibXMLHelper zypp::parser::yum::YUMPrimaryParser::_helper [private]

Definition at line 78 of file YUMPrimaryParser.h.

Referenced by isInterested(), parseAuthorEntries(), parseDependencyEntries(), parseDirsizeEntries(), parseFormatNode(), parseKeywordEntries(), and process().

Arch zypp::parser::yum::YUMPrimaryParser::_zypp_architecture [private]

Definition at line 79 of file YUMPrimaryParser.h.

Referenced by process().


The documentation for this class was generated from the following files:
Generated on Tue Nov 28 16:49:39 2006 for zypp by  doxygen 1.5.0