libzypp: zypp/ResObject.cc Source File

libzypp 17.38.6

ResObject.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12
13#include <zypp/ResObject.h>
14
15using namespace zypp;
16
18namespace zypp
19{
20
21 IMPL_PTR_TYPE(ResObject);
22
23 ResObject::ResObject( const sat::Solvable & solvable_r )
24 : Resolvable( solvable_r )
25 {}
26
27 ResObject::~ResObject()
28 {}
29
30 std::ostream & ResObject::dumpOn( std::ostream & str ) const
31 {
32 return Resolvable::dumpOn( str );
33 }
34
35} // namespace zypp
37
38#include <zypp/ResObjects.h>
39
41namespace zypp
42{
43 ResObject::Ptr makeResObject( const sat::Solvable & solvable_r )
44 {
45 if ( ! solvable_r )
46 return 0;
47
48 ResKind kind( solvable_r.kind() );
49#define OUTS(X) if ( kind == ResTraits<X>::kind ) return make<X>( solvable_r );
50 OUTS( Package );
51 OUTS( Patch );
52 OUTS( Pattern );
53 OUTS( Product );
54 OUTS( SrcPackage );
55 OUTS( Application );
56#undef OUTS
57 // unknow => return a plain ResObject
58 return new ResObject( solvable_r );
59 }
60} // namespace zypp
OUTS
#define OUTS(VAL)
ResObject.h
ResObjects.h
zypp::Application
Class representing an application (appdata.xml).
Definition Application.h:28
zypp::Package
Package interface.
Definition Package.h:34
zypp::Patch
Class representing a patch.
Definition Patch.h:38
zypp::Pattern
Pattern interface.
Definition Pattern.h:32
zypp::Product
Product interface.
Definition Product.h:34
zypp::ResKind
Resolvable kinds.
Definition ResKind.h:33
zypp::ResObject
Base for resolvable objects.
Definition ResObject.h:38
zypp::ResObject::ResObject
ResObject(const sat::Solvable &solvable_r)
Ctor.
Definition ResObject.cc:23
zypp::ResObject::Ptr
TraitsType::PtrType Ptr
Definition ResObject.h:42
zypp::ResObject::dumpOn
std::ostream & dumpOn(std::ostream &str) const override
Helper for stream output.
Definition ResObject.cc:30
zypp::ResObject::~ResObject
~ResObject() override
Dtor.
Definition ResObject.cc:27
zypp::Resolvable::Resolvable
Resolvable(const sat::Solvable &solvable_r)
Ctor.
Definition Resolvable.cc:21
zypp::Resolvable::dumpOn
std::ostream & dumpOn(std::ostream &str) const override
Helper for stream output.
Definition Resolvable.cc:31
zypp::SrcPackage
SrcPackage interface.
Definition SrcPackage.h:30
zypp::sat::Solvable
A Solvable object within the sat Pool.
Definition Solvable.h:54
zypp::sat::Solvable::kind
ResKind kind() const
The Solvables ResKind.
Definition Solvable.cc:279
str
String related utilities and Regular expression matching.
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::makeResObject
ResObject::Ptr makeResObject(const sat::Solvable &solvable_r)
Create ResObject from sat::Solvable.
Definition ResObject.cc:43
zypp::kind
const ResKind ResTraits< Package >::kind(ResKind::package)
IMPL_PTR_TYPE
#define IMPL_PTR_TYPE(NAME)
Definition ReferenceCounted.h:137