libzypp: zypp::parser::RepoFileReader Class Reference

libzypp 17.36.6

Public Types | Public Member Functions | Private Attributes | Friends | Related Symbols | List of all members
zypp::parser::RepoFileReader Class Reference

Read repository data from a .repo file. More...

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

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

## Public Member Functions
| RepoFileReader (const Pathname &repo_file, ProcessRepo callback, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
| Constructor.
| RepoFileReader (const InputStream &is, ProcessRepo callback, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
| Constructor.
| ~RepoFileReader ()
| Dtor.

## Private Attributes
ProcessRepo | _callback

## Friends
std::ostream & | operator<< (std::ostream &str, const RepoFileReader &obj)

## Related Symbols
(Note that these are not member symbols.)
std::ostream & | operator<< (std::ostream &str, const RepoFileReader &obj)
| Stream output.

## Detailed Description

Read repository data from a .repo file.

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

The _callback is provided on construction.

RepoFileReader reader(repo_file,
bind( &SomeClass::callbackfunc, &SomeClassInstance, _1, _2 ) );
zypp::parser::RepoFileReader::RepoFileReader
RepoFileReader(const Pathname &repo_file, ProcessRepo callback, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
Constructor.
Definition RepoFileReader.cc:236

Note
  Multiple baseurls in a repo file are supported using this style:
  baseurl=http://server.a/path/to/repo
  http://server.b/path/to/repo
  http://server.c/path/to/repo
  Repeating the `baseurl=` tag on each line is also accepted, but when the file has to be written, the preferred style is used.

Definition at line 51 of file RepoFileReader.h.

## Member Typedef Documentation

## ◆ ProcessRepo

using zypp::parser::RepoFileReader::ProcessRepo = function<bool (const RepoInfo &)>

Callback definition.

First parameter is a RepoInfo object with the resource second parameter is the resource type.

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

Definition at line 64 of file RepoFileReader.h.

## Constructor & Destructor Documentation

## ◆ RepoFileReader() [1/2]

zypp::parser::RepoFileReader::RepoFileReader | ( | const Pathname & | repo_file,
|  | ProcessRepo | callback,
|  | const ProgressData::ReceiverFnc & | progress = ProgressData::ReceiverFnc() )

Constructor.

Creates the reader and start reading.

Parameters

  repo_file | A valid .repo file
  callback | Callback that will be called for each repository.
  progress | Optional progress function.

See also
  ProgressData

Exceptions

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

Definition at line 236 of file RepoFileReader.cc.

## ◆ RepoFileReader() [2/2]

zypp::parser::RepoFileReader::RepoFileReader | ( | const InputStream & | is,
|  | ProcessRepo | callback,
|  | const ProgressData::ReceiverFnc & | progress = ProgressData::ReceiverFnc() )

Constructor.

Creates the reader and start reading.

Parameters

  is | A valid input stream
  callback | Callback that will be called for each repository.
  progress | Optional progress function.

See also
  ProgressData

Exceptions

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

Definition at line 244 of file RepoFileReader.cc.

## ◆ ~RepoFileReader()

zypp::parser::RepoFileReader::~RepoFileReader | ( |  | ) |

Dtor.

Definition at line 252 of file RepoFileReader.cc.

## Friends And Related Symbol Documentation

## ◆ operator<< [1/2]

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

Definition at line 256 of file RepoFileReader.cc.

## ◆ operator<<() [2/2]

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

Stream output.

Definition at line 256 of file RepoFileReader.cc.

## Member Data Documentation

## ◆ _callback

ProcessRepo zypp::parser::RepoFileReader::_callback
| private

Definition at line 105 of file RepoFileReader.h.

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

- zypp/parser/RepoFileReader.h
- zypp/parser/RepoFileReader.cc