draft backup
authorMichael Andres <ma@suse.de>
Tue, 11 Oct 2005 10:35:10 +0000 (10:35 +0000)
committerMichael Andres <ma@suse.de>
Tue, 11 Oct 2005 10:35:10 +0000 (10:35 +0000)
21 files changed:
configure.ac
test/Main.cc
zypp/Makefile.am
zypp/ResArch.cc [new file with mode: 0644]
zypp/ResArch.h [new file with mode: 0644]
zypp/ResEdition.cc [new file with mode: 0644]
zypp/ResEdition.h [new file with mode: 0644]
zypp/ResKind.cc [new file with mode: 0644]
zypp/ResKind.h [new file with mode: 0644]
zypp/ResName.cc [new file with mode: 0644]
zypp/ResName.h [new file with mode: 0644]
zypp/Resolvable.cc [new file with mode: 0644]
zypp/Resolvable.h [new file with mode: 0644]
zypp/base/Makefile.am
zypp/base/PtrTypes.h [new file with mode: 0644]
zypp/base/StringVal.cc [new file with mode: 0644]
zypp/base/StringVal.h [new file with mode: 0644]
zypp/detail/.cvsignore [new file with mode: 0644]
zypp/detail/Makefile.am [new file with mode: 0644]
zypp/detail/ResolvableImpl.cc [new file with mode: 0644]
zypp/detail/ResolvableImpl.h [new file with mode: 0644]

index 9c3924f..c5f351a 100644 (file)
@@ -101,7 +101,8 @@ AC_OUTPUT(  \
        test/Makefile           \
        test/genclass           \
        zypp/Makefile           \
-       zypp/base/Makefile
+       zypp/base/Makefile      \
+       zypp/detail/Makefile
 )
 dnl ==================================================
 
index f8108d1..c6fdcf2 100644 (file)
 #include <zypp/base/Logger.h>
 #include <zypp/base/String.h>
 
-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<const std::string &>(obj); }
 
-    return size_t(__h);
-    //return str.size();
   }
-};
 
-/******************************************************************
-**
-*/
-template<typename Cont>
-  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<typename Cont>
-  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<typename Cont>
-  void lookup( const Cont & unames )
+  class ResEdition
   {
-    for ( unsigned i = 0; i < 1000; ++i ) {
-      for_each( unames.begin(), unames.end(), lookupKey<Cont>( unames ) );
-      for_each( unames.begin(), unames.end(), lookupNoKey<Cont>( 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<typename Cont>
-  void lookupTest( const vector<string> & 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<string> names( (istream_iterator<string>(f)), istream_iterator<string>() );
-  MIL << "Total names: " << names.size() << endl;
-  memusage();
+  ResKind a( "fool" );
+  ResName b;
+  DBG << a << endl;
+  DBG << b << endl;
+
+  //b=a;
 
-  INT << ">===[lookupTest<set<string> >]" << endl;
-  lookupTest<set<string> >( names );
-  memusage();
+  DBG << a << endl;
+  DBG << b << endl;
 
-  INT << ">===[lookupTest<hash_set<string> >]" << endl;
-  lookupTest<hash_set<string,StringHashFnc> >( names );
-  memusage();
+  tt( a );
+  tt( b );
 
   INT << "===[END]============================================" << endl;
   return 0;
index 6b8c31e..e3811d8 100644 (file)
@@ -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 (file)
index 0000000..dcc244c
--- /dev/null
@@ -0,0 +1,61 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/**
+ \file zypp/ResArch.cc
+
+ \brief        .
+
+*/
+#include <iostream>
+
+#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 (file)
index 0000000..9a2ac9a
--- /dev/null
@@ -0,0 +1,49 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/**
+ \file zypp/ResArch.h
+
+ \brief        .
+
+*/
+#ifndef ZYPP_RESARCH_H
+#define ZYPP_RESARCH_H
+
+#include <iosfwd>
+
+#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 (file)
index 0000000..b89d85b
--- /dev/null
@@ -0,0 +1,96 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/**
+ \file zypp/ResEdition.cc
+
+ \brief        .
+
+*/
+#include <iostream>
+
+#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 (file)
index 0000000..888d655
--- /dev/null
@@ -0,0 +1,66 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/**
+ \file zypp/ResEdition.h
+
+ \brief        .
+
+*/
+#ifndef ZYPP_RESEDITION_H
+#define ZYPP_RESEDITION_H
+
+#include <iosfwd>
+#include <string>
+
+#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<Impl> _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 (file)
index 0000000..82ed99b
--- /dev/null
@@ -0,0 +1,61 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/**
+ \file zypp/ResKind.cc
+
+ \brief        .
+
+*/
+#include <iostream>
+
+#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 (file)
index 0000000..2e25f1b
--- /dev/null
@@ -0,0 +1,49 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/**
+ \file zypp/ResKind.h
+
+ \brief        .
+
+*/
+#ifndef ZYPP_RESKIND_H
+#define ZYPP_RESKIND_H
+
+#include <iosfwd>
+
+#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 (file)
index 0000000..ee4d74c
--- /dev/null
@@ -0,0 +1,61 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/**
+ \file zypp/ResName.cc
+
+ \brief        .
+
+*/
+#include <iostream>
+
+#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 (file)
index 0000000..2eea2fa
--- /dev/null
@@ -0,0 +1,49 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/**
+ \file zypp/ResName.h
+
+ \brief        .
+
+*/
+#ifndef ZYPP_RESNAME_H
+#define ZYPP_RESNAME_H
+
+#include <iosfwd>
+
+#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 (file)
index 0000000..7661137
--- /dev/null
@@ -0,0 +1,65 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/**
+ \file zypp/Resolvable.cc
+
+ \brief        .
+
+*/
+#include <iostream>
+
+#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 (file)
index 0000000..213cb4c
--- /dev/null
@@ -0,0 +1,74 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/**
+ \file zypp/Resolvable.h
+
+ \brief        .
+
+*/
+#ifndef ZYPP_RESOLVABLE_H
+#define ZYPP_RESOLVABLE_H
+
+#include <iosfwd>
+
+#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<detail::ResolvableImpl> _pimpl;
+  };
+  ///////////////////////////////////////////////////////////////////
+
+  /** \relates Resolvable Stream output */
+  extern std::ostream & operator<<( std::ostream & str, const Resolvable & obj );
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_RESOLVABLE_H
index e26917d..da74ac2 100644 (file)
@@ -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 (file)
index 0000000..07088ce
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef ZYPP_BASE_PTRTYPES_H
+#define ZYPP_BASE_PTRTYPES_H
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/weak_ptr.hpp>
+
+///////////////////////////////////////////////////////////////////
+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 (file)
index 0000000..35e7f86
--- /dev/null
@@ -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 (file)
index 0000000..66b5663
--- /dev/null
@@ -0,0 +1,66 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/**
+ \file zypp/base/StringVal.h
+
+ \brief        .
+
+*/
+#ifndef ZYPP_BASE_STRINGVAL_H
+#define ZYPP_BASE_STRINGVAL_H
+
+#include <iosfwd>
+#include <string>
+
+///////////////////////////////////////////////////////////////////
+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<const std::string &>(obj); }
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace base
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_BASE_STRINGVAL_H
diff --git a/zypp/detail/.cvsignore b/zypp/detail/.cvsignore
new file mode 100644 (file)
index 0000000..5c94a2f
--- /dev/null
@@ -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 (file)
index 0000000..487169f
--- /dev/null
@@ -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 (file)
index 0000000..4dfad23
--- /dev/null
@@ -0,0 +1,50 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/**
+ \file zypp/detail/ResolvableImpl.cc
+
+ \brief        .
+
+*/
+#include <iostream>
+
+#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 (file)
index 0000000..46bedc1
--- /dev/null
@@ -0,0 +1,74 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/**
+ \file zypp/detail/ResolvableImpl.h
+
+ \brief        .
+
+*/
+#ifndef ZYPP_DETAIL_RESOLVABLEIMPL_H
+#define ZYPP_DETAIL_RESOLVABLEIMPL_H
+
+#include <iosfwd>
+
+#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