libzypp: zypp::syscontent::Writer Class Reference

libzypp 17.38.8

zypp::syscontent::Writer Class Reference

Collect and serialize a set of ResObject. More...

`#include <zypp/SysContent.h>`

## Classes
class | Impl

## Public Types
using | value_type = StorageT::value_type
using | size_type = StorageT::size_type
using | iterator = StorageT::iterator
using | const_iterator = StorageT::const_iterator

## Public Member Functions
| Writer ()
| Default Ctor.
Identification.
User provided optional data to identify the collection.
const std::string & | name () const
| Get name.
Writer & | name (const std::string &val_r)
| Set name.
const Edition & | edition () const
| Get edition.
Writer & | edition (const Edition &val_r)
| Set edition.
const std::string & | description () const
| Get description.
Writer & | description (const std::string &val_r)
| Set description.
Collecting data.
syscontent::Writer contentW; contentW.name( "mycollection" ) .edition( Edition( "1.0" ) ) .description( "All the cool stuff..." ); ResPool pool( getZYpp()->pool() ); for_each( pool.begin(), pool.end(), bind( &syscontent::Writer::addIf, ref(contentW), _1 ) ); std::ofstream my_file( "some_file" ); my_file << contentW; my_file.close(); zypp::Edition Edition represents [epoch:]version[-release]. Definition Edition.h:60 zypp::ResPool Global ResObject pool. Definition ResPool.h:62 zypp::syscontent::Writer Collect and serialize a set of ResObject. Definition SysContent.h:65 zypp::syscontent::Writer::addIf void addIf(const PoolItem &obj_r) Collect PoolItem if it stays on the system. Definition SysContent.cc:164 zypp::syscontent::Writer::name const std::string & name() const Get name. Definition SysContent.cc:138 zypp::pool Definition ByIdent.h:24 zypp::getZYpp ZYpp::Ptr getZYpp() relates: ZYppFactory Convenience to get the Pointer to the ZYpp instance. Definition ZYppFactory.h:77
void | addInstalled (const PoolItem &obj_r)
| Collect currently installed PoolItem.
void | addIf (const PoolItem &obj_r)
| Collect PoolItem if it stays on the system.
void | add (const ResObject::constPtr &obj_r)
| Unconditionally add this ResObject (or PoolItem).

## Private Types
using | StorageT = std::set<ResObject::constPtr>

## Collected data.
RWCOW_pointer< Impl > | _pimpl
bool | empty () const
| Whether no data collected so far.
size_type | size () const
| Number of items collected.
const_iterator | begin () const
| Iterator to the begin of collected data.
const_iterator | end () const
| Iterator to the end of collected data.
std::ostream & | writeXml (std::ostream &str) const
| Write collected data as XML.

## Detailed Description

Collect and serialize a set of ResObject.

<?xml version="1.0" encoding="UTF-8"?>
<syscontent>
<ident>
<name>mycollection</name>
<version epoch="0" ver="1.0" rel="1"/>
<description>All the cool stuff...</description>
<created>1165270942</created>
</ident>
<onsys>
<entry kind="package" name="pax" epoch="0" ver="3.4" rel="12" arch="x86_64"/>
<entry kind="product" name="SUSE_SLES" epoch="0" ver="10" arch="x86_64"/>
<entry ...
</onsys>
</syscontent>
zypp::syscontent::Writer::description
const std::string & description() const
Get description.
Definition SysContent.cc:150
zypp::syscontent
Definition SysContent.cc:27
zypp::xml
Definition libxmlfwd.cc:22
zypp::kind
const ResKind ResTraits< Package >::kind(ResKind::package)

See also
  Reader

Definition at line 64 of file SysContent.h.

## Member Typedef Documentation

## ◆ StorageT

using zypp::syscontent::Writer::StorageT = std::set<ResObject::constPtr>
| private

Definition at line 66 of file SysContent.h.

## ◆ value_type

using zypp::syscontent::Writer::value_type = StorageT::value_type

Definition at line 68 of file SysContent.h.

## ◆ size_type

using zypp::syscontent::Writer::size_type = StorageT::size_type

Definition at line 69 of file SysContent.h.

## ◆ iterator

using zypp::syscontent::Writer::iterator = StorageT::iterator

Definition at line 70 of file SysContent.h.

## ◆ const_iterator

using zypp::syscontent::Writer::const_iterator = StorageT::const_iterator

Definition at line 71 of file SysContent.h.

## Constructor & Destructor Documentation

## ◆ Writer()

zypp::syscontent::Writer::Writer | ( |  | ) |

Default Ctor.

Definition at line 134 of file SysContent.cc.

## Member Function Documentation

## ◆ name() [1/2]

const std::string & zypp::syscontent::Writer::name | ( |  | ) | const

Get name.

Definition at line 138 of file SysContent.cc.

## ◆ name() [2/2]

Writer & zypp::syscontent::Writer::name | ( | const std::string & | val_r | ) |

Set name.

Definition at line 141 of file SysContent.cc.

## ◆ edition() [1/2]

const Edition & zypp::syscontent::Writer::edition | ( |  | ) | const

Get edition.

Definition at line 144 of file SysContent.cc.

## ◆ edition() [2/2]

Writer & zypp::syscontent::Writer::edition | ( | const Edition & | val_r | ) |

Set edition.

Definition at line 147 of file SysContent.cc.

## ◆ description() [1/2]

const std::string & zypp::syscontent::Writer::description | ( |  | ) | const

Get description.

Definition at line 150 of file SysContent.cc.

## ◆ description() [2/2]

Writer & zypp::syscontent::Writer::description | ( | const std::string & | val_r | ) |

Set description.

Definition at line 153 of file SysContent.cc.

## ◆ addInstalled()

void zypp::syscontent::Writer::addInstalled | ( | const PoolItem & | obj_r | ) |

Collect currently installed PoolItem.

Definition at line 156 of file SysContent.cc.

## ◆ addIf()

void zypp::syscontent::Writer::addIf | ( | const PoolItem & | obj_r | ) |

Collect PoolItem if it stays on the system.

I.e. it stays installed or is tagged to be installed. Solver selected items are omitted.

Definition at line 164 of file SysContent.cc.

## ◆ add()

void zypp::syscontent::Writer::add | ( | const ResObject::constPtr & | obj_r | ) |

Unconditionally add this ResObject (or PoolItem).

Definition at line 173 of file SysContent.cc.

## ◆ empty()

bool zypp::syscontent::Writer::empty | ( |  | ) | const

Whether no data collected so far.

Definition at line 176 of file SysContent.cc.

## ◆ size()

Writer::size_type zypp::syscontent::Writer::size | ( |  | ) | const

Number of items collected.

Definition at line 179 of file SysContent.cc.

## ◆ begin()

Writer::const_iterator zypp::syscontent::Writer::begin | ( |  | ) | const

Iterator to the begin of collected data.

Definition at line 182 of file SysContent.cc.

## ◆ end()

Writer::const_iterator zypp::syscontent::Writer::end | ( |  | ) | const

Iterator to the end of collected data.

Definition at line 185 of file SysContent.cc.

## ◆ writeXml()

std::ostream & zypp::syscontent::Writer::writeXml | ( | std::ostream & | str | ) | const

Write collected data as XML.

Read them back using Reader.

Definition at line 188 of file SysContent.cc.

## Member Data Documentation

## ◆ _pimpl

RWCOW_pointer<Impl> zypp::syscontent::Writer::_pimpl
| private

Definition at line 156 of file SysContent.h.

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

- zypp/SysContent.h
- zypp/SysContent.cc