From 66d6c541efec049f1ebdb81381efe2fd3366f965 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Tue, 11 Oct 2005 10:35:10 +0000 Subject: [PATCH] draft backup --- configure.ac | 3 +- test/Main.cc | 174 +++++++++++++++++++++++++----------------- zypp/Makefile.am | 17 ++++- zypp/ResArch.cc | 61 +++++++++++++++ zypp/ResArch.h | 49 ++++++++++++ zypp/ResEdition.cc | 96 +++++++++++++++++++++++ zypp/ResEdition.h | 66 ++++++++++++++++ zypp/ResKind.cc | 61 +++++++++++++++ zypp/ResKind.h | 49 ++++++++++++ zypp/ResName.cc | 61 +++++++++++++++ zypp/ResName.h | 49 ++++++++++++ zypp/Resolvable.cc | 65 ++++++++++++++++ zypp/Resolvable.h | 74 ++++++++++++++++++ zypp/base/Makefile.am | 7 +- zypp/base/PtrTypes.h | 30 ++++++++ zypp/base/StringVal.cc | 87 +++++++++++++++++++++ zypp/base/StringVal.h | 66 ++++++++++++++++ zypp/detail/.cvsignore | 8 ++ zypp/detail/Makefile.am | 19 +++++ zypp/detail/ResolvableImpl.cc | 50 ++++++++++++ zypp/detail/ResolvableImpl.h | 74 ++++++++++++++++++ 21 files changed, 1091 insertions(+), 75 deletions(-) create mode 100644 zypp/ResArch.cc create mode 100644 zypp/ResArch.h create mode 100644 zypp/ResEdition.cc create mode 100644 zypp/ResEdition.h create mode 100644 zypp/ResKind.cc create mode 100644 zypp/ResKind.h create mode 100644 zypp/ResName.cc create mode 100644 zypp/ResName.h create mode 100644 zypp/Resolvable.cc create mode 100644 zypp/Resolvable.h create mode 100644 zypp/base/PtrTypes.h create mode 100644 zypp/base/StringVal.cc create mode 100644 zypp/base/StringVal.h create mode 100644 zypp/detail/.cvsignore create mode 100644 zypp/detail/Makefile.am create mode 100644 zypp/detail/ResolvableImpl.cc create mode 100644 zypp/detail/ResolvableImpl.h diff --git a/configure.ac b/configure.ac index 9c3924f..c5f351a 100644 --- a/configure.ac +++ b/configure.ac @@ -101,7 +101,8 @@ AC_OUTPUT( \ test/Makefile \ test/genclass \ zypp/Makefile \ - zypp/base/Makefile + zypp/base/Makefile \ + zypp/detail/Makefile ) dnl ================================================== diff --git a/test/Main.cc b/test/Main.cc index f8108d1..c6fdcf2 100644 --- a/test/Main.cc +++ b/test/Main.cc @@ -13,78 +13,116 @@ #include #include -using namespace std; -using __gnu_cxx::hash_set; - -/****************************************************************** -** -*/ -inline void memusage() -{ - system( zypp::base::string::form( "ps v %d", getpid() ).c_str() ); -} - -/****************************************************************** -** -*/ -struct StringHashFnc +namespace zypp { - size_t operator()( const string & str ) const + namespace base { - unsigned long __h = 0; - for ( const char* __s = str.c_str(); *__s; ++__s) - __h = 5*__h + *__s; + 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(obj); } - return size_t(__h); - //return str.size(); } -}; -/****************************************************************** -** -*/ -template - struct lookupKey + class ResKind : public base::StringVal { - const Cont & _cont; - lookupKey( const Cont & cont ) - : _cont( cont ) + public: + ResKind() + {} + explicit + ResKind( const std::string & rhs ) + : base::StringVal( rhs ) + {} + ResKind( const ResKind & rhs ) + : base::StringVal( rhs ) + {} + ~ResKind() {} - void operator()( const string & key ) const - { - typename Cont::const_iterator it = _cont.find( key ); - } }; - -template - struct lookupNoKey + class ResName : public base::StringVal { - const Cont & _cont; - lookupNoKey( const Cont & cont ) - : _cont( cont ) + public: + ResName() + {} + explicit + ResName( const std::string & rhs ) + : base::StringVal( rhs ) + {} + ResName( const ResName & rhs ) + : base::StringVal( rhs ) + {} + ~ResName() {} - void operator()( const string & key ) - { - typename Cont::const_iterator it = _cont.find( key+'x' ); - } }; - -template - void lookup( const Cont & unames ) + class ResEdition { - for ( unsigned i = 0; i < 1000; ++i ) { - for_each( unames.begin(), unames.end(), lookupKey( unames ) ); - for_each( unames.begin(), unames.end(), lookupNoKey( unames ) ); - } - } + 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(); } + private: -template - void lookupTest( const vector & names ) + }; + class ResArch : public base::StringVal { - Cont unames( names.begin(), names.end() ); - MIL << "Unique names: " << unames.size() << endl; - lookup( unames ); - } + public: + ResArch() + {} + explicit + ResArch( const std::string & rhs ) + : base::StringVal( rhs ) + {} + ResArch( const ResArch & rhs ) + : base::StringVal( rhs ) + {} + ~ResArch() + {} + }; + +} + +using namespace std; +using namespace zypp; + +void tt ( const string & s ) +{ + string t( s ); + t = string(); +} /****************************************************************** ** @@ -98,18 +136,18 @@ int main( int argc, char * argv[] ) { INT << "===[START]==========================================" << endl; - ifstream f( "./NameList" ); - vector names( (istream_iterator(f)), istream_iterator() ); - MIL << "Total names: " << names.size() << endl; - memusage(); + ResKind a( "fool" ); + ResName b; + DBG << a << endl; + DBG << b << endl; + + //b=a; - INT << ">===[lookupTest >]" << endl; - lookupTest >( names ); - memusage(); + DBG << a << endl; + DBG << b << endl; - INT << ">===[lookupTest >]" << endl; - lookupTest >( names ); - memusage(); + tt( a ); + tt( b ); INT << "===[END]============================================" << endl; return 0; diff --git a/zypp/Makefile.am b/zypp/Makefile.am index 6b8c31e..e3811d8 100644 --- a/zypp/Makefile.am +++ b/zypp/Makefile.am @@ -1,11 +1,15 @@ ## Process this file with automake to produce Makefile.in ## ################################################## -SUBDIRS = base +SUBDIRS = base detail ## ################################################## -include_HEADERS = +include_HEADERS = \ + ResKind.h \ + ResName.h \ + ResArch.h \ + ResEdition.h ## ################################################## @@ -13,10 +17,15 @@ lib_LTLIBRARIES = lib@PACKAGE@.la ## ################################################## -lib@PACKAGE@_la_SOURCES = +lib@PACKAGE@_la_SOURCES = \ + ResKind.cc \ + ResName.cc \ + ResArch.cc \ + ResEdition.cc lib@PACKAGE@_la_LDFLAGS = @LIB_VERSION_INFO@ -lib@PACKAGE@_la_LIBADD = base/lib@PACKAGE@_base.la +lib@PACKAGE@_la_LIBADD = base/lib@PACKAGE@_base.la \ + detail/lib@PACKAGE@_detail.la ## ################################################## diff --git a/zypp/ResArch.cc b/zypp/ResArch.cc new file mode 100644 index 0000000..dcc244c --- /dev/null +++ b/zypp/ResArch.cc @@ -0,0 +1,61 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** + \file zypp/ResArch.cc + + \brief . + +*/ +#include + +#include "zypp/ResArch.h" + +using namespace std; + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : ResArch::ResArch + // METHOD TYPE : Ctor + // + ResArch::ResArch() + {} + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : ResArch::ResArch + // METHOD TYPE : Ctor + // + ResArch::ResArch( const std::string & rhs ) + : base::StringVal( rhs ) + {} + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : ResArch::ResArch + // METHOD TYPE : Ctor + // + ResArch::ResArch( const ResArch & rhs ) + : base::StringVal( rhs ) + {} + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : ResArch::~ResArch + // METHOD TYPE : Dtor + // + ResArch::~ResArch() + {} + + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// diff --git a/zypp/ResArch.h b/zypp/ResArch.h new file mode 100644 index 0000000..9a2ac9a --- /dev/null +++ b/zypp/ResArch.h @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** + \file zypp/ResArch.h + + \brief . + +*/ +#ifndef ZYPP_RESARCH_H +#define ZYPP_RESARCH_H + +#include + +#include "zypp/base/StringVal.h" + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////// + // + // CLASS NAME : ResArch + // + /** */ + class ResArch : public base::StringVal + { + public: + /** Default ctor */ + ResArch(); + /** */ + explicit + ResArch( const std::string & rhs ); + /** */ + ResArch( const ResArch & rhs ); + /** Dtor */ + ~ResArch(); + }; + /////////////////////////////////////////////////////////////////// + + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// +#endif // ZYPP_RESARCH_H diff --git a/zypp/ResEdition.cc b/zypp/ResEdition.cc new file mode 100644 index 0000000..b89d85b --- /dev/null +++ b/zypp/ResEdition.cc @@ -0,0 +1,96 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** + \file zypp/ResEdition.cc + + \brief . + +*/ +#include + +#include "zypp/base/Logger.h" +#include "zypp/ResEdition.h" + +using namespace std; + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////// + // + // CLASS NAME : ResEdition::Impl + // + /** ResEdition implementation */ + struct ResEdition::Impl + { + /** Default ctor*/ + Impl() + : _epoch( 0 ) + {} + + Impl( const std::string & version_r, + const std::string & release_r, + epoch_t epoch_r ) + : _epoch( epoch_r ) + , _version( version_r ) + , _release( release_r ) + {} + + /** Dtor */ + ~Impl() + {} + + epoch_t _epoch; + std::string _version; + std::string _release; + }; + /////////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////// + // + // CLASS NAME : ResEdition + // + /////////////////////////////////////////////////////////////////// + + ResEdition::ResEdition() + : _pimpl( new Impl ) + {} + + ResEdition::ResEdition( const std::string & version_r, + const std::string & release_r, + epoch_t epoch_r ) + : _pimpl( new Impl( version_r, release_r, epoch_r ) ) + {} + + ResEdition::~ResEdition() + {} + + ResEdition::epoch_t ResEdition::epoch() const + { return _pimpl->_epoch; } + + const std::string & ResEdition::version() const + { return _pimpl->_version; } + + const std::string & ResEdition::release() const + { return _pimpl->_release; } + + /****************************************************************** + ** + ** FUNCTION NAME : operator<< + ** FUNCTION TYPE : std::ostream & + */ + std::ostream & operator<<( std::ostream & str, const ResEdition & obj ) + { + return str << obj.version() << '-' << obj.release(); + } + + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// diff --git a/zypp/ResEdition.h b/zypp/ResEdition.h new file mode 100644 index 0000000..888d655 --- /dev/null +++ b/zypp/ResEdition.h @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** + \file zypp/ResEdition.h + + \brief . + +*/ +#ifndef ZYPP_RESEDITION_H +#define ZYPP_RESEDITION_H + +#include +#include + +#include "zypp/base/PtrTypes.h" + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////// + // + // CLASS NAME : ResEdition + // + /** */ + class ResEdition + { + public: + typedef unsigned epoch_t; + public: + /** Default ctor */ + ResEdition(); + /** */ + ResEdition( const std::string & version_r, + const std::string & release_r, + epoch_t epoch = 0 ); + /** Dtor */ + ~ResEdition(); + public: + /** */ + epoch_t epoch() const; + /** */ + const std::string & version() const; + /** */ + const std::string & release() const; + private: + /** Hides implementation */ + struct Impl; + /** Pointer to implementation */ + base::shared_ptr _pimpl; + }; + /////////////////////////////////////////////////////////////////// + + /** \relates ResEdition Stream output */ + extern std::ostream & operator<<( std::ostream & str, const ResEdition & obj ); + + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// +#endif // ZYPP_RESEDITION_H diff --git a/zypp/ResKind.cc b/zypp/ResKind.cc new file mode 100644 index 0000000..82ed99b --- /dev/null +++ b/zypp/ResKind.cc @@ -0,0 +1,61 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** + \file zypp/ResKind.cc + + \brief . + +*/ +#include + +#include "zypp/ResKind.h" + +using namespace std; + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : ResKind::ResKind + // METHOD TYPE : Ctor + // + ResKind::ResKind() + {} + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : ResKind::ResKind + // METHOD TYPE : Ctor + // + ResKind::ResKind( const std::string & rhs ) + : base::StringVal( rhs ) + {} + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : ResKind::ResKind + // METHOD TYPE : Ctor + // + ResKind::ResKind( const ResKind & rhs ) + : base::StringVal( rhs ) + {} + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : ResKind::~ResKind + // METHOD TYPE : Dtor + // + ResKind::~ResKind() + {} + + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// diff --git a/zypp/ResKind.h b/zypp/ResKind.h new file mode 100644 index 0000000..2e25f1b --- /dev/null +++ b/zypp/ResKind.h @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** + \file zypp/ResKind.h + + \brief . + +*/ +#ifndef ZYPP_RESKIND_H +#define ZYPP_RESKIND_H + +#include + +#include "zypp/base/StringVal.h" + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////// + // + // CLASS NAME : ResKind + // + /** */ + class ResKind : public base::StringVal + { + public: + /** Default ctor */ + ResKind(); + /** */ + explicit + ResKind( const std::string & rhs ); + /** */ + ResKind( const ResKind & rhs ); + /** Dtor */ + ~ResKind(); + }; + /////////////////////////////////////////////////////////////////// + + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// +#endif // ZYPP_RESKIND_H diff --git a/zypp/ResName.cc b/zypp/ResName.cc new file mode 100644 index 0000000..ee4d74c --- /dev/null +++ b/zypp/ResName.cc @@ -0,0 +1,61 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** + \file zypp/ResName.cc + + \brief . + +*/ +#include + +#include "zypp/ResName.h" + +using namespace std; + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : ResName::ResName + // METHOD TYPE : Ctor + // + ResName::ResName() + {} + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : ResName::ResName + // METHOD TYPE : Ctor + // + ResName::ResName( const std::string & rhs ) + : base::StringVal( rhs ) + {} + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : ResName::ResName + // METHOD TYPE : Ctor + // + ResName::ResName( const ResName & rhs ) + : base::StringVal( rhs ) + {} + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : ResName::~ResName + // METHOD TYPE : Dtor + // + ResName::~ResName() + {} + + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// diff --git a/zypp/ResName.h b/zypp/ResName.h new file mode 100644 index 0000000..2eea2fa --- /dev/null +++ b/zypp/ResName.h @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** + \file zypp/ResName.h + + \brief . + +*/ +#ifndef ZYPP_RESNAME_H +#define ZYPP_RESNAME_H + +#include + +#include "zypp/base/StringVal.h" + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////// + // + // CLASS NAME : ResName + // + /** */ + class ResName : public base::StringVal + { + public: + /** Default ctor */ + ResName(); + /** */ + explicit + ResName( const std::string & rhs ); + /** */ + ResName( const ResName & rhs ); + /** Dtor */ + ~ResName(); + }; + /////////////////////////////////////////////////////////////////// + + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// +#endif // ZYPP_RESNAME_H diff --git a/zypp/Resolvable.cc b/zypp/Resolvable.cc new file mode 100644 index 0000000..7661137 --- /dev/null +++ b/zypp/Resolvable.cc @@ -0,0 +1,65 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** + \file zypp/Resolvable.cc + + \brief . + +*/ +#include + +#include "zypp/base/Logger.h" +#include "zypp/Resolvable.h" +#include "zypp/detailResolvableImpl.h" + +using namespace std; + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : Resolvable::Resolvable + // METHOD TYPE : Ctor + // + Resolvable::Resolvable() + : _pimpl( new ResolvableImpl ) + {} + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : Resolvable::~Resolvable + // METHOD TYPE : Dtor + // + Resolvable::~Resolvable() + {} + + 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(); } + + /****************************************************************** + ** + ** FUNCTION NAME : operator<< + ** FUNCTION TYPE : std::ostream & + */ + std::ostream & operator<<( std::ostream & str, const Resolvable & obj ) + { + return str; + } + + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// diff --git a/zypp/Resolvable.h b/zypp/Resolvable.h new file mode 100644 index 0000000..213cb4c --- /dev/null +++ b/zypp/Resolvable.h @@ -0,0 +1,74 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** + \file zypp/Resolvable.h + + \brief . + +*/ +#ifndef ZYPP_RESOLVABLE_H +#define ZYPP_RESOLVABLE_H + +#include + +#include "zypp/base/PtrTypes.h" + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + + class ResKind; + class ResName; + class ResEdition; + class ResArch; + + /////////////////////////////////////////////////////////////////// + namespace detail + { ///////////////////////////////////////////////////////////////// + /** Hides implementation */ + class ResolvableImpl; + ///////////////////////////////////////////////////////////////// + } // namespace detail + /////////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////// + // + // CLASS NAME : Resolvable + // + /** */ + class Resolvable + { + public: + /** Default ctor */ + Resolvable(); + /** Dtor */ + ~Resolvable(); + public: + /** */ + const ResKind & kind() const; + /** */ + const ResName & name() const; + /** */ + const ResEdition & edition() const; + /** */ + const ResArch & arch() const; + + private: + /** Pointer to implementation */ + base::shared_ptr _pimpl; + }; + /////////////////////////////////////////////////////////////////// + + /** \relates Resolvable Stream output */ + extern std::ostream & operator<<( std::ostream & str, const Resolvable & obj ); + + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// +#endif // ZYPP_RESOLVABLE_H diff --git a/zypp/base/Makefile.am b/zypp/base/Makefile.am index e26917d..da74ac2 100644 --- a/zypp/base/Makefile.am +++ b/zypp/base/Makefile.am @@ -6,8 +6,10 @@ SUBDIRS = ## ################################################## include_HEADERS = \ + PtrTypes.h \ String.h \ - Logger.h + Logger.h \ + StringVal.h noinst_LTLIBRARIES = lib@PACKAGE@_base.la @@ -16,7 +18,8 @@ noinst_LTLIBRARIES = lib@PACKAGE@_base.la lib@PACKAGE@_base_la_SOURCES = \ String.cc \ - Logger.cc + Logger.cc \ + StringVal.cc ## ################################################## diff --git a/zypp/base/PtrTypes.h b/zypp/base/PtrTypes.h new file mode 100644 index 0000000..07088ce --- /dev/null +++ b/zypp/base/PtrTypes.h @@ -0,0 +1,30 @@ +#ifndef ZYPP_BASE_PTRTYPES_H +#define ZYPP_BASE_PTRTYPES_H + +#include +#include +#include + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////// + namespace base + { ///////////////////////////////////////////////////////////////// + + /** */ + using boost::scoped_ptr; + + /** */ + using boost::shared_ptr; + + /** */ + using boost::weak_ptr; + + ///////////////////////////////////////////////////////////////// + } // namespace base + /////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// +#endif // ZYPP_BASE_PTRTYPES_H diff --git a/zypp/base/StringVal.cc b/zypp/base/StringVal.cc new file mode 100644 index 0000000..35e7f86 --- /dev/null +++ b/zypp/base/StringVal.cc @@ -0,0 +1,87 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** + \file zypp/base/StringVal.cc + + \brief . + +*/ +#include "zypp/base/StringVal.h" + +using namespace std; + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////// + namespace base + { ///////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : StringVal::StringVal + // METHOD TYPE : Ctor + // + StringVal::StringVal() + {} + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : StringVal::StringVal + // METHOD TYPE : Ctor + // + StringVal::StringVal( const std::string & rhs ) + : _value( rhs ) + {} + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : StringVal::StringVal + // METHOD TYPE : Ctor + // + StringVal::StringVal( const StringVal & rhs ) + : _value( rhs._value ) + {} + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : StringVal::~StringVal + // METHOD TYPE : Dtor + // + StringVal::~StringVal() + {} + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : StringVal::operator= + // METHOD TYPE : const StringVal & + // + const StringVal & StringVal::operator=( const std::string & rhs ) + { + _value = rhs; + return *this; + } + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : StringVal::operator= + // METHOD TYPE : const StringVal & + // + const StringVal & StringVal::operator=( const StringVal & rhs ) + { + _value = rhs._value; + return *this; + } + + ///////////////////////////////////////////////////////////////// + } // namespace base + /////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// diff --git a/zypp/base/StringVal.h b/zypp/base/StringVal.h new file mode 100644 index 0000000..66b5663 --- /dev/null +++ b/zypp/base/StringVal.h @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** + \file zypp/base/StringVal.h + + \brief . + +*/ +#ifndef ZYPP_BASE_STRINGVAL_H +#define ZYPP_BASE_STRINGVAL_H + +#include +#include + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////// + namespace base + { ///////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////// + // + // CLASS NAME : StringVal + // + /** */ + class StringVal + { + public: + operator const std::string &() const + { return _value; } + protected: + /** */ + StringVal(); + /** */ + explicit + StringVal( const std::string & rhs ); + /** */ + StringVal( const StringVal & rhs ); + /** */ + ~StringVal(); + /** */ + const StringVal & operator=( const std::string & rhs ); + /** */ + const StringVal & operator=( const StringVal & rhs ); + private: + std::string _value; + }; + /////////////////////////////////////////////////////////////////// + + inline std::ostream & operator<<( std::ostream & str, const StringVal & obj ) + { return str << static_cast(obj); } + + ///////////////////////////////////////////////////////////////// + } // namespace base + /////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// +#endif // ZYPP_BASE_STRINGVAL_H diff --git a/zypp/detail/.cvsignore b/zypp/detail/.cvsignore new file mode 100644 index 0000000..5c94a2f --- /dev/null +++ b/zypp/detail/.cvsignore @@ -0,0 +1,8 @@ +Makefile.in +Makefile +.deps +.libs +*.o +*.lo +*.a +*.la diff --git a/zypp/detail/Makefile.am b/zypp/detail/Makefile.am new file mode 100644 index 0000000..487169f --- /dev/null +++ b/zypp/detail/Makefile.am @@ -0,0 +1,19 @@ +## Process this file with automake to produce Makefile.in +## ################################################## + +SUBDIRS = + +## ################################################## + +include_HEADERS = \ + ResolvableImpl.h + + +noinst_LTLIBRARIES = lib@PACKAGE@_detail.la + +## ################################################## + +lib@PACKAGE@_detail_la_SOURCES = \ + ResolvableImpl.cc + +## ################################################## diff --git a/zypp/detail/ResolvableImpl.cc b/zypp/detail/ResolvableImpl.cc new file mode 100644 index 0000000..4dfad23 --- /dev/null +++ b/zypp/detail/ResolvableImpl.cc @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** + \file zypp/detail/ResolvableImpl.cc + + \brief . + +*/ +#include + +#include "zypp/base/Logger.h" +#include "zypp/detail/ResolvableImpl.h" + +using namespace std; + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////// + namespace detail + { ///////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : ResolvableImpl::ResolvableImpl + // METHOD TYPE : Ctor + // + ResolvableImpl::ResolvableImpl() + {} + + /////////////////////////////////////////////////////////////////// + // + // METHOD NAME : ResolvableImpl::~ResolvableImpl + // METHOD TYPE : Dtor + // + ResolvableImpl::~ResolvableImpl() + {} + + ///////////////////////////////////////////////////////////////// + } // namespace detail + /////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// diff --git a/zypp/detail/ResolvableImpl.h b/zypp/detail/ResolvableImpl.h new file mode 100644 index 0000000..46bedc1 --- /dev/null +++ b/zypp/detail/ResolvableImpl.h @@ -0,0 +1,74 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** + \file zypp/detail/ResolvableImpl.h + + \brief . + +*/ +#ifndef ZYPP_DETAIL_RESOLVABLEIMPL_H +#define ZYPP_DETAIL_RESOLVABLEIMPL_H + +#include + +#include "zypp/ResKind.h" +#include "zypp/ResName.h" +#include "zypp/ResEdition.h" +#include "zypp/ResArch.h" + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////// + namespace detail + { ///////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////// + // + // CLASS NAME : ResolvableImpl + // + /** */ + class ResolvableImpl + { + public: + /** Default ctor */ + ResolvableImpl(); + + /** Dtor */ + ~ResolvableImpl(); + + public: + /** */ + const ResKind & kind() const + { return _kind; } + /** */ + const ResName & name() const + { return _name; } + /** */ + const ResEdition & edition() const + { return _edition; } + /** */ + const ResArch & arch() const + { return _arch; } + + private: + ResKind _kind; + ResName _name; + ResEdition _edition; + ResArch _arch; + }; + /////////////////////////////////////////////////////////////////// + + ///////////////////////////////////////////////////////////////// + } // namespace detail + /////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// +#endif // ZYPP_DETAIL_RESOLVABLEIMPL_H -- 2.7.4