libzypp: zypp::parser::ServiceFileReader Class Reference

libzypp 17.38.11

zypp::parser::ServiceFileReader Class Reference

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

`#include <zypp/parser/ServiceFileReader.h>`

## Classes
class | Impl

## Public Types
using | ProcessService = function<bool (const ServiceInfo &)>
| Callback definition.

## Public Member Functions
| ServiceFileReader (const Pathname &serviceFile, const ProcessService &callback)
| Constructor.
| ~ServiceFileReader ()
| Dtor.

## Friends
std::ostream & | operator<< (std::ostream &str, const ServiceFileReader &obj)
| relates: ServiceFileReader Stream output

## 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 ) );
zypp::parser::ServiceFileReader::ServiceFileReader
ServiceFileReader(const Pathname &serviceFile, const ProcessService &callback)
Constructor.
Definition ServiceFileReader.cc:162

Definition at line 43 of file ServiceFileReader.h.

## Member Typedef Documentation

## ◆ ProcessService

using zypp::parser::ServiceFileReader::ProcessService = function<bool (const ServiceInfo &)>

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

  serviceFile | A valid .repo file
  callback | Callback that will be called for each repository.

Exceptions

  AbortRequestException | If the callback returns false
  Exception | If a error occurs at reading / parsing

Definition at line 162 of file ServiceFileReader.cc.

## ◆ ~ServiceFileReader()

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

Dtor.

Definition at line 170 of file ServiceFileReader.cc.

## Friends And Related Symbol Documentation

## ◆ operator<<

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

relates: ServiceFileReader Stream output

Definition at line 173 of file ServiceFileReader.cc.

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

- zypp/parser/ServiceFileReader.h
- zypp/parser/ServiceFileReader.cc