37 inline std::string attrIf(
const std::string & tag_r,
38 const std::string & value_r )
41 if ( ! value_r.empty() )
64 std::ostream &
writeXml( std::ostream &
str )
const;
84 {
return new Impl( *
this ); }
96 str <<
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
97 str <<
"<syscontent>\n";
100 str <<
" <name>" <<
_name <<
"</name>\n";
103 << attrIf(
"ver",
_edition.version() )
104 << attrIf(
"rel",
_edition.release() )
108 str <<
" </ident>\n";
114 << attrIf(
"kind", (*it)->kind().asString() )
115 << attrIf(
"name", (*it)->name() )
117 << attrIf(
"ver", (*it)->edition().version() )
118 << attrIf(
"rel", (*it)->edition().release() )
119 << attrIf(
"arch", (*it)->arch().asString() )
122 str <<
" </onsys>\n";
124 str <<
"</syscontent>" << endl;
142 {
_pimpl->_name = val_r;
return *
this; }
145 {
return _pimpl->_edition; }
148 {
_pimpl->_edition = val_r;
return *
this; }
151 {
return _pimpl->_description; }
154 {
_pimpl->_description = val_r;
return *
this; }
174 {
_pimpl->_onsys.insert( obj_r ); }
177 {
return _pimpl->_onsys.empty(); }
180 {
return _pimpl->_onsys.size(); }
183 {
return _pimpl->_onsys.begin(); }
186 {
return _pimpl->_onsys.end(); }
226 {
return _pimpl->_edition; }
242 Impl( std::istream & input_r );
264 {
return new Impl( *
this ); }
275 struct SycontentNode :
public ParseDef
277 SycontentNode( Mode mode_r )
278 : ParseDef(
"syscontent", mode_r )
280 (*this)(
"ident", OPTIONAL)
286 (
"version", OPTIONAL)
287 (
"description", OPTIONAL)
288 (
"created", OPTIONAL)
292 (
"entry", MULTIPLE_OPTIONAL)
298 struct ConsumeEdition :
public ParseDefConsume
300 ConsumeEdition( Edition & value_r )
301 : _value( & value_r )
304 void start(
const Node & node_r )
override
306 *_value =
Edition( node_r.getAttribute(
"ver").asString(),
307 node_r.getAttribute(
"rel").asString(),
308 node_r.getAttribute(
"epoch").asString() );
315 struct ConsumeString :
public ParseDefConsume
317 ConsumeString( std::string & value_r )
318 : _value( & value_r )
321 void text(
const Node & node_r )
override
323 *_value = node_r.value().asString();
330 struct ConsumeDate :
public ParseDefConsume
332 ConsumeDate( Date & value_r )
333 : _value( & value_r )
336 void text(
const Node & node_r )
override
338 *_value = Date(node_r.value().asString());
345 struct ConsumeEntries :
public ParseDefConsume
347 ConsumeEntries( std::list<Reader::Entry> & value_r )
348 : _value( & value_r )
351 void start(
const Node & node_r )
override
353 shared_ptr<Reader::Entry::Impl> centry(
new Reader::Entry::Impl );
355 centry->_kind = node_r.getAttribute(
"kind").asString();
356 centry->_name = node_r.getAttribute(
"name").asString();
357 centry->_edition =
Edition( node_r.getAttribute(
"ver").asString(),
358 node_r.getAttribute(
"rel").asString(),
359 node_r.getAttribute(
"epoch").asString() );
360 centry->_arch = Arch( node_r.getAttribute(
"arch").asString() );
362 _value->push_back( Reader::Entry( centry ) );
365 std::list<Reader::Entry> *_value;
379 xml::Reader reader( input_r );
382 rootNode[
"ident"][
"name"].setConsumer
383 (
new ConsumeString(
_name ) );
385 rootNode[
"ident"][
"version"].setConsumer
388 rootNode[
"ident"][
"description"].setConsumer
391 rootNode[
"ident"][
"created"].setConsumer
394 rootNode[
"onsys"][
"entry"].setConsumer
398 rootNode.take( reader );
419 {
return _pimpl->_edition; }
422 {
return _pimpl->_description; }
425 {
return _pimpl->_created; }
428 {
return _pimpl->_content.empty(); }
431 {
return _pimpl->_content.size(); }
434 {
return _pimpl->_content.begin(); }
437 {
return _pimpl->_content.end(); }
446 return str <<
"syscontent(" << obj.name() <<
"-" << obj.edition()
447 <<
", " << obj.size() <<
" entries"
448 <<
", created " << obj.ctime()
Store and operate on date (time_t).
std::string asSeconds() const
Convert to string representation of calendar time in numeric form (like "1029255142").
static Date now()
Return the current time.
Edition represents [epoch:]version[-release]
Combining sat::Solvable and ResStatus.
ResObject::constPtr resolvable() const
Returns the ResObject::constPtr.
ResStatus & status() const
Returns the current status.
TraitsType::constPtrType constPtr
const Arch & arch() const
const std::string & name() const
RW_pointer< Impl > _pimpl
const Edition & edition() const
const std::string & kind() const
static shared_ptr< Impl > nullimpl()
Offer default Impl.
friend Impl * rwcowClone(const Impl *rhs)
Impl * clone() const
clone for RWCOW_pointer
std::list< Entry > _content
const Date & ctime() const
Get creation date.
const_iterator end() const
Iterator to the end of collected data.
StorageT::const_iterator const_iterator
const Edition & edition() const
Get edition.
StorageT::size_type size_type
const std::string & description() const
Get description.
RWCOW_pointer< Impl > _pimpl
bool empty() const
Whether no data collected so far.
const_iterator begin() const
Iterator to the begin of collected data.
const std::string & name() const
Get name.
size_type size() const
Number of items collected.
friend Impl * rwcowClone(const Impl *rhs)
Impl * clone() const
clone for RWCOW_pointer
static shared_ptr< Impl > nullimpl()
Offer default Impl.
std::ostream & writeXml(std::ostream &str) const
StorageT::size_type size_type
const Edition & edition() const
Get edition.
std::set< ResObject::constPtr > StorageT
std::ostream & writeXml(std::ostream &str) const
Write collected data as XML.
const std::string & description() const
Get description.
void addIf(const PoolItem &obj_r)
Collect PoolItem if it stays on the system.
StorageT::const_iterator const_iterator
RWCOW_pointer< Impl > _pimpl
void addInstalled(const PoolItem &obj_r)
Collect currently installed PoolItem.
const_iterator begin() const
Iterator to the begin of collected data.
bool empty() const
Whether no data collected so far.
size_type size() const
Number of items collected.
void add(const ResObject::constPtr &obj_r)
Unconditionally add this ResObject (or PoolItem).
const std::string & name() const
Get name.
StorageT::iterator iterator
const_iterator end() const
Iterator to the end of collected data.
Reader(const InputStream &stream_r, const Validate &validate_r=Validate::none())
Ctor.
String related utilities and Regular expression matching.
@ Edition
Editions with v-r setparator highlighted.
std::string numstring(char n, int w=0)
std::ostream & operator<<(std::ostream &str, const ReadState &obj)
Easy-to use interface to the ZYPP dependency resolver.