#include <zypp/base/Logger.h>
#include <zypp/base/String.h>
+///////////////////////////////////////////////////////////////////
+
+#include <zypp/Resolvable.h>
+
namespace zypp
{
- namespace base
+ namespace detail
{
- class StringVal
- {
- public:
- operator const std::string &() const
- { return _value; }
- protected:
- StringVal()
- {}
- explicit
- StringVal( const std::string & rhs )
- : _value( rhs )
- {}
- StringVal( const StringVal & rhs )
- : _value( rhs._value )
- {}
- ~StringVal()
- {}
- const StringVal & operator=( const std::string & rhs )
- { _value = rhs; return *this; }
- const StringVal & operator=( const StringVal & rhs )
- { _value = rhs._value; return *this; }
- private:
- std::string _value;
- };
-
- inline std::ostream & operator<<( std::ostream & str, const StringVal & obj )
- { return str << static_cast<const std::string &>(obj); }
-
+ class PackageImpl;
+ typedef base::shared_ptr<PackageImpl> PackageImplPtr;
}
- class ResKind : public base::StringVal
- {
- public:
- ResKind()
- {}
- explicit
- ResKind( const std::string & rhs )
- : base::StringVal( rhs )
- {}
- ResKind( const ResKind & rhs )
- : base::StringVal( rhs )
- {}
- ~ResKind()
- {}
- };
- class ResName : public base::StringVal
- {
- public:
- ResName()
- {}
- explicit
- ResName( const std::string & rhs )
- : base::StringVal( rhs )
- {}
- ResName( const ResName & rhs )
- : base::StringVal( rhs )
- {}
- ~ResName()
- {}
- };
- class ResEdition
+ class Package : public Resolvable
{
public:
- typedef unsigned epoch_t;
- ResEdition()
- {}
- ResEdition( const ResEdition & rhs )
- {}
- ~ResEdition()
- {}
- public:
- epoch_t epoch() const
- { return 0; }
- const std::string & version() const
- { return std::string(); }
- const std::string & release() const
- { return std::string(); }
+ Package();
+ Package( detail::PackageImplPtr impl_r );
+ ~Package();
+ const std::string & label() const;
private:
-
+ /** Pointer to implementation */
+ detail::PackageImplPtr _pimpl;
};
- class ResArch : public base::StringVal
+}
+
+///////////////////////////////////////////////////////////////////
+
+#include <zypp/detail/ResolvableImpl.h>
+
+namespace zypp
+{
+ namespace detail
{
- public:
- ResArch()
- {}
- explicit
- ResArch( const std::string & rhs )
- : base::StringVal( rhs )
- {}
- ResArch( const ResArch & rhs )
- : base::StringVal( rhs )
- {}
- ~ResArch()
- {}
- };
+ class PackageImpl
+ {
+ public:
+ PackageImpl()
+ {}
+
+ ResolvableImplPtr _resolvable;
+ std::string _label;
+ };
+ }
+
+ Package::Package()
+ : _pimpl( new detail::PackageImpl )
+ {}
+ Package::Package( detail::PackageImplPtr impl_r )
+ : Resolvable( impl_r->_resolvable )
+ , _pimpl( impl_r )
+ {}
+ Package::~Package()
+ {}
+ const std::string & Package::label() const
+ { return _pimpl->_label; }
}
+///////////////////////////////////////////////////////////////////
+
using namespace std;
using namespace zypp;
-void tt ( const string & s )
-{
- string t( s );
- t = string();
-}
-
/******************************************************************
**
**
{
INT << "===[START]==========================================" << endl;
- ResKind a( "fool" );
- ResName b;
- DBG << a << endl;
- DBG << b << endl;
-
- //b=a;
+ detail::PackageImplPtr pi( new detail::PackageImpl );
+ pi->_resolvable.reset( new detail::ResolvableImpl( ResKind("PKG"),
+ ResName("foo"),
+ ResEdition("1.0","42"),
+ ResArch("noarch") ) );
+ pi->_label = "label for foo";
- DBG << a << endl;
- DBG << b << endl;
+ Package p( pi );
- tt( a );
- tt( b );
+ DBG << p << endl;
+ DBG << " \"" << p.label() << "\"" << endl;
INT << "===[END]============================================" << endl;
return 0;
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/**
- \file ${FILE}
-
- \brief .
-
+/** \file ${FILE}
+ *
*/
EOF
}
ResKind.h \
ResName.h \
ResArch.h \
- ResEdition.h
+ ResEdition.h \
+ Resolvable.h
## ##################################################
ResKind.cc \
ResName.cc \
ResArch.cc \
- ResEdition.cc
+ ResEdition.cc \
+ Resolvable.cc
lib@PACKAGE@_la_LDFLAGS = @LIB_VERSION_INFO@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/**
- \file zypp/ResArch.cc
-
- \brief .
-
+/** \file zypp/ResArch.cc
+ *
*/
#include <iostream>
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/**
- \file zypp/ResArch.h
-
- \brief .
-
+/** \file zypp/ResArch.h
+ *
*/
#ifndef ZYPP_RESARCH_H
#define ZYPP_RESARCH_H
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/**
- \file zypp/ResEdition.cc
-
- \brief .
-
+/** \file zypp/ResEdition.cc
+ *
*/
#include <iostream>
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/**
- \file zypp/ResEdition.h
-
- \brief .
-
+/** \file zypp/ResEdition.h
+ *
*/
#ifndef ZYPP_RESEDITION_H
#define ZYPP_RESEDITION_H
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/**
- \file zypp/ResKind.cc
-
- \brief .
-
+/** \file zypp/ResKind.cc
+ *
*/
#include <iostream>
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/**
- \file zypp/ResKind.h
-
- \brief .
-
+/** \file zypp/ResKind.h
+ *
*/
#ifndef ZYPP_RESKIND_H
#define ZYPP_RESKIND_H
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/**
- \file zypp/ResName.cc
-
- \brief .
-
+/** \file zypp/ResName.cc
+ *
*/
#include <iostream>
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/**
- \file zypp/ResName.h
-
- \brief .
-
+/** \file zypp/ResName.h
+ *
*/
#ifndef ZYPP_RESNAME_H
#define ZYPP_RESNAME_H
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/**
- \file zypp/Resolvable.cc
-
- \brief .
-
+/** \file zypp/Resolvable.cc
+ *
*/
#include <iostream>
#include "zypp/base/Logger.h"
#include "zypp/Resolvable.h"
-#include "zypp/detailResolvableImpl.h"
+#include "zypp/detail/ResolvableImpl.h"
using namespace std;
// METHOD TYPE : Ctor
//
Resolvable::Resolvable()
- : _pimpl( new ResolvableImpl )
+ : _pimpl( new detail::ResolvableImpl )
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : Resolvable::Resolvable
+ // METHOD TYPE : Ctor
+ //
+ Resolvable::Resolvable( detail::ResolvableImplPtr impl_r )
+ : _pimpl( impl_r )
{}
///////////////////////////////////////////////////////////////////
const ResKind & Resolvable::kind() const
{ return _pimpl->kind(); }
+
const ResName & Resolvable::name() const
{ return _pimpl->name(); }
+
const ResEdition & Resolvable::edition() const
{ return _pimpl->edition(); }
+
const ResArch & Resolvable::arch() const
{ return _pimpl->arch(); }
*/
std::ostream & operator<<( std::ostream & str, const Resolvable & obj )
{
+ str << '[' << obj.kind() << ']' << obj.name() << '-' << obj.edition() << '.' << obj.arch();
return str;
}
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/**
- \file zypp/Resolvable.h
-
- \brief .
-
+/** \file zypp/Resolvable.h
+ *
*/
#ifndef ZYPP_RESOLVABLE_H
#define ZYPP_RESOLVABLE_H
{ /////////////////////////////////////////////////////////////////
/** Hides implementation */
class ResolvableImpl;
+ typedef base::shared_ptr<ResolvableImpl> ResolvableImplPtr;
/////////////////////////////////////////////////////////////////
} // namespace detail
///////////////////////////////////////////////////////////////////
public:
/** Default ctor */
Resolvable();
+ /** ctor */
+ Resolvable( detail::ResolvableImplPtr impl_r );
/** Dtor */
~Resolvable();
public:
const ResEdition & edition() const;
/** */
const ResArch & arch() const;
-
private:
/** Pointer to implementation */
- base::shared_ptr<detail::ResolvableImpl> _pimpl;
+ detail::ResolvableImplPtr _pimpl;
};
///////////////////////////////////////////////////////////////////
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/**
- \file zypp/base/Logger.cc
-
- \brief .
-
+/** \file zypp/base/Logger.cc
+ *
*/
#include <iostream>
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/**
- \file zypp/base/Logger.h
-
- \brief .
-
+/** \file zypp/base/Logger.h
+ *
*/
#ifndef ZYPP_BASE_LOGGER_H
#define ZYPP_BASE_LOGGER_H
#include <iosfwd>
-/** \defgroup ZYPP_BASE_LOGGER_MACROS
+/** \defgroup ZYPP_BASE_LOGGER_MACROS ZYPP_BASE_LOGGER_MACROS
* Convenience macros for logging.
*
* The macros finaly call @ref getStream, providing appropriate arguments,
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/base/PtrTypes.h
+ *
+*/
#ifndef ZYPP_BASE_PTRTYPES_H
#define ZYPP_BASE_PTRTYPES_H
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/base/String.cc
+ *
+*/
#include <cstdio>
#include <cstdarg>
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/base/String.h
+ *
+*/
#ifndef ZYPP_BASE_STRING_H
#define ZYPP_BASE_STRING_H
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/**
- \file zypp/base/StringVal.cc
-
- \brief .
-
+/** \file zypp/base/StringVal.cc
+ *
*/
#include "zypp/base/StringVal.h"
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/**
- \file zypp/base/StringVal.h
-
- \brief .
-
+/** \file zypp/base/StringVal.h
+ *
*/
#ifndef ZYPP_BASE_STRINGVAL_H
#define ZYPP_BASE_STRINGVAL_H
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/**
- \file zypp/detail/ResolvableImpl.cc
-
- \brief .
-
+/** \file zypp/detail/ResolvableImpl.cc
+ *
*/
#include <iostream>
///////////////////////////////////////////////////////////////////
//
- // METHOD NAME : ResolvableImpl::ResolvableImpl
- // METHOD TYPE : Ctor
+ // CLASS NAME : ResolvableImpl
//
- ResolvableImpl::ResolvableImpl()
- {}
-
///////////////////////////////////////////////////////////////////
- //
- // METHOD NAME : ResolvableImpl::~ResolvableImpl
- // METHOD TYPE : Dtor
- //
- ResolvableImpl::~ResolvableImpl()
- {}
/////////////////////////////////////////////////////////////////
} // namespace detail
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/**
- \file zypp/detail/ResolvableImpl.h
-
- \brief .
-
+/** \file zypp/detail/ResolvableImpl.h
+ *
*/
#ifndef ZYPP_DETAIL_RESOLVABLEIMPL_H
#define ZYPP_DETAIL_RESOLVABLEIMPL_H
{
public:
/** Default ctor */
- ResolvableImpl();
-
+ ResolvableImpl()
+ {}
+ /** ctor */
+ ResolvableImpl( const ResKind & kind_r,
+ const ResName & name_r,
+ const ResEdition & edition_r,
+ const ResArch & arch_r )
+ : _kind( kind_r )
+ , _name( name_r )
+ , _edition( edition_r )
+ , _arch( arch_r )
+ {}
/** Dtor */
- ~ResolvableImpl();
-
+ ~ResolvableImpl()
+ {}
public:
/** */
const ResKind & kind() const
/** */
const ResArch & arch() const
{ return _arch; }
-
private:
ResKind _kind;
ResName _name;