libzypp  17.3.0
zypp::parser::ServiceFileReader Class Reference

Read service data from a .service file. More...

#include <ServiceFileReader.h>

Classes

class  Impl
 

Public Types

typedef function< bool(const ServiceInfo &)> ProcessService
 Callback definition. More...
 

Public Member Functions

 ServiceFileReader (const Pathname &serviceFile, const ProcessService &callback)
 Constructor. More...
 
 ~ServiceFileReader ()
 Dtor. More...
 

Friends

std::ostream & operator<< (std::ostream &str, const ServiceFileReader &obj)
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &str, const ServiceFileReader &obj)
 

Detailed Description

Read service data from a .service file.

After each service is read, a ServiceInfo is prepared and _callback is called with the object passed in.

The _callback is provided on construction.

ServiceFileReader reader(service_file,
bind( &SomeClass::callbackfunc, &SomeClassInstance, _1 ) );

Definition at line 43 of file ServiceFileReader.h.

Member Typedef Documentation

◆ ProcessService

Callback definition.

First parameter is a ServiceInfo object with the resource.

Return false from the callback to get a AbortRequestException to be thrown and the processing to be cancelled.

Definition at line 55 of file ServiceFileReader.h.

Constructor & Destructor Documentation

◆ ServiceFileReader()

zypp::parser::ServiceFileReader::ServiceFileReader ( const Pathname serviceFile,
const ProcessService callback 
)

Constructor.

Creates the reader and start reading.

Parameters
serviceFileA valid .repo file
callbackCallback that will be called for each repository.
Exceptions
AbortRequestExceptionIf the callback returns false
ExceptionIf a error occurs at reading / parsing

Definition at line 158 of file ServiceFileReader.cc.

◆ ~ServiceFileReader()

zypp::parser::ServiceFileReader::~ServiceFileReader ( )

Dtor.

Definition at line 166 of file ServiceFileReader.cc.

Friends And Related Function Documentation

◆ operator<< [1/2]

std::ostream& operator<< ( std::ostream &  str,
const ServiceFileReader obj 
)
friend

Definition at line 169 of file ServiceFileReader.cc.

◆ operator<<() [2/2]

std::ostream & operator<< ( std::ostream &  str,
const ServiceFileReader obj 
)
related

Stream output

Definition at line 169 of file ServiceFileReader.cc.


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