24 #undef ZYPP_BASE_LOGGER_LOGGROUP 25 #define ZYPP_BASE_LOGGER_LOGGROUP "parser::yum" 49 Reader reader( repomd_file );
50 MIL <<
"Reading " << repomd_file << endl;
51 reader.
foreachNode( bind( &RepomdFileReader::Impl::consumeNode,
this, _1 ) );
57 bool consumeNode(
Reader & reader_r );
92 bool RepomdFileReader::Impl::consumeNode(
Reader & reader_r )
94 if ( reader_r->
nodeType() == XML_READER_TYPE_ELEMENT )
97 if ( reader_r->
name() ==
"repomd" )
103 if ( reader_r->
name() ==
"data" )
110 if ( reader_r->
name() ==
"location" )
118 if ( reader_r->
name() ==
"checksum" )
120 _location.setChecksum( getChecksum( reader_r ) );
125 if ( reader_r->
name() ==
"header-checksum" )
127 _location.setHeaderChecksum( getChecksum( reader_r ) );
132 if ( reader_r->
name() ==
"timestamp" )
139 if ( reader_r->
name() ==
"size" )
141 _location.setDownloadSize( getSize( reader_r ) );
146 if ( reader_r->
name() ==
"header-size" )
148 _location.setHeaderSize( getSize( reader_r ) );
155 else if ( reader_r->
nodeType() == XML_READER_TYPE_END_ELEMENT )
158 if ( reader_r->
name() ==
"data" )
161 _callback( std::move(_location), _typeStr );
180 : _pimpl( new
Impl(repomd_file, callback) )
std::string _typeStr
The resource type string.
Store and operate with byte count.
NodeType nodeType() const
Get the node type of the current node.
function< bool(OnMediaLocation &&, const std::string &)> ProcessResource
Callback taking OnMediaLocation and the resource type string.
const ProcessCredentials & _callback
ByteCount getSize(Reader &reader_r)
Retrieve a size node.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
OnMediaLocation _location
Location of metadata file.
XmlString getAttribute(const char *name_r) const
Provides a copy of the attribute value with the specified qualified name.
Impl(const Pathname &repomd_file, const ProcessResource &callback)
Ctro taking a ProcessResource callback.
XmlString nodeText()
If the current node is not empty, advances the reader to the next node, and returns the value...
CheckSum getChecksum(Reader &reader_r)
Retrieve a checksum node.
std::string asString() const
Explicit conversion to std::string.
bool foreachNode(ProcessNode fnc_r)
XmlString name() const
The qualified name of the node, equal to Prefix :LocalName.
Interface of repomd.xml file reader.
ProcessResource _callback
Function for processing collected data.
Easy-to use interface to the ZYPP dependency resolver.
xmlTextReader based interface to iterate xml streams.