libzypp 17.31.23
zypp::parser::ProductFileReader Class Reference

Parser for /etc/products.d enries (just relevant entires). More...

#include <parser/ProductFileReader.h>

Public Types

typedef function< bool(const ProductFileData &)> Consumer
 Callback being invoked for each ProductFileData parsed.
 

Public Member Functions

 ProductFileReader ()
 
 ProductFileReader (const Consumer &consumer_r)
 
 ProductFileReader (const Consumer &consumer_r, const InputStream &input_r)
 
const Consumerconsumer () const
 
void setConsumer (const Consumer &consumer_r)
 
bool parse (const InputStream &input_r=InputStream()) const
 Parse the input stream and call _consumer for each parsed section.
 

Static Public Member Functions

static bool scanDir (const Consumer &consumer_r, const Pathname &dir_r)
 Parse all files (no symlinks) in dir_r and call consumer_r for each ProductFileData parsed.
 
static ProductFileData scanFile (const Pathname &file_r)
 Parse one file (or symlink) and return the ProductFileData parsed.
 

Private Attributes

Consumer _consumer
 

Detailed Description

Parser for /etc/products.d enries (just relevant entires).

#include "zypp/base/Functional.h" // functor::getAll
std::vector<ProductFileData> result;
ProductFileReader::scanDir( functor::getAll( std::back_inserter( result ) ),
"/etc/products.d" );
static bool scanDir(const Consumer &consumer_r, const Pathname &dir_r)
Parse all files (no symlinks) in dir_r and call consumer_r for each ProductFileData parsed.
GetAll< TOutputIterator > getAll(TOutputIterator result_r)
Convenience function for creating GetAll.
Definition: Functional.h:270

Definition at line 120 of file ProductFileReader.h.

Member Typedef Documentation

◆ Consumer

Callback being invoked for each ProductFileData parsed.

Return false to stop parsing.

Definition at line 126 of file ProductFileReader.h.

Constructor & Destructor Documentation

◆ ProductFileReader() [1/3]

zypp::parser::ProductFileReader::ProductFileReader ( )
inline

Definition at line 129 of file ProductFileReader.h.

◆ ProductFileReader() [2/3]

zypp::parser::ProductFileReader::ProductFileReader ( const Consumer consumer_r)
inline

Definition at line 132 of file ProductFileReader.h.

◆ ProductFileReader() [3/3]

zypp::parser::ProductFileReader::ProductFileReader ( const Consumer consumer_r,
const InputStream input_r 
)
inline

Definition at line 136 of file ProductFileReader.h.

Member Function Documentation

◆ consumer()

const Consumer & zypp::parser::ProductFileReader::consumer ( ) const
inline

Definition at line 141 of file ProductFileReader.h.

◆ setConsumer()

void zypp::parser::ProductFileReader::setConsumer ( const Consumer consumer_r)
inline

Definition at line 144 of file ProductFileReader.h.

◆ parse()

bool zypp::parser::ProductFileReader::parse ( const InputStream input_r = InputStream()) const

Parse the input stream and call _consumer for each parsed section.

Returns false if the _consumer requested to stop parsing.

Definition at line 217 of file ProductFileReader.cc.

◆ scanDir()

bool zypp::parser::ProductFileReader::scanDir ( const Consumer consumer_r,
const Pathname dir_r 
)
static

Parse all files (no symlinks) in dir_r and call consumer_r for each ProductFileData parsed.

Returns false if the _consumer requested to stop parsing.

Definition at line 251 of file ProductFileReader.cc.

◆ scanFile()

ProductFileData zypp::parser::ProductFileReader::scanFile ( const Pathname file_r)
static

Parse one file (or symlink) and return the ProductFileData parsed.

Definition at line 272 of file ProductFileReader.cc.

Member Data Documentation

◆ _consumer

Consumer zypp::parser::ProductFileReader::_consumer
private

Definition at line 168 of file ProductFileReader.h.


The documentation for this class was generated from the following files: