draft backup
authorMichael Andres <ma@suse.de>
Tue, 11 Oct 2005 13:09:58 +0000 (13:09 +0000)
committerMichael Andres <ma@suse.de>
Tue, 11 Oct 2005 13:09:58 +0000 (13:09 +0000)
22 files changed:
test/Main.cc
test/genclass.in
zypp/Makefile.am
zypp/ResArch.cc
zypp/ResArch.h
zypp/ResEdition.cc
zypp/ResEdition.h
zypp/ResKind.cc
zypp/ResKind.h
zypp/ResName.cc
zypp/ResName.h
zypp/Resolvable.cc
zypp/Resolvable.h
zypp/base/Logger.cc
zypp/base/Logger.h
zypp/base/PtrTypes.h
zypp/base/String.cc
zypp/base/String.h
zypp/base/StringVal.cc
zypp/base/StringVal.h
zypp/detail/ResolvableImpl.cc
zypp/detail/ResolvableImpl.h

index c6fdcf2..644f06f 100644 (file)
 #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();
-}
-
 /******************************************************************
 **
 **
@@ -136,18 +88,17 @@ int main( int argc, char * argv[] )
 {
   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;
index f9c539a..08cbbc8 100755 (executable)
@@ -61,11 +61,8 @@ cat <<EOF
 |                         /_____||_| |_| |_|                           |
 |                                                                      |
 \---------------------------------------------------------------------*/
-/**
- \file ${FILE}
-
- \brief        .
-
+/** \file      ${FILE}
+ *
 */
 EOF
 }
index e3811d8..1e5c2a7 100644 (file)
@@ -9,7 +9,8 @@ include_HEADERS = \
        ResKind.h       \
        ResName.h       \
        ResArch.h       \
-       ResEdition.h
+       ResEdition.h    \
+       Resolvable.h
 
 ## ##################################################
 
@@ -21,7 +22,8 @@ lib@PACKAGE@_la_SOURCES = \
        ResKind.cc      \
        ResName.cc      \
        ResArch.cc      \
-       ResEdition.cc
+       ResEdition.cc   \
+       Resolvable.cc
 
 lib@PACKAGE@_la_LDFLAGS =      @LIB_VERSION_INFO@
 
index dcc244c..eeea70c 100644 (file)
@@ -6,11 +6,8 @@
 |                         /_____||_| |_| |_|                           |
 |                                                                      |
 \---------------------------------------------------------------------*/
-/**
- \file zypp/ResArch.cc
-
- \brief        .
-
+/** \file zypp/ResArch.cc
+ *
 */
 #include <iostream>
 
index 9a2ac9a..9716ce2 100644 (file)
@@ -6,11 +6,8 @@
 |                         /_____||_| |_| |_|                           |
 |                                                                      |
 \---------------------------------------------------------------------*/
-/**
- \file zypp/ResArch.h
-
- \brief        .
-
+/** \file zypp/ResArch.h
+ *
 */
 #ifndef ZYPP_RESARCH_H
 #define ZYPP_RESARCH_H
index b89d85b..2e907db 100644 (file)
@@ -6,11 +6,8 @@
 |                         /_____||_| |_| |_|                           |
 |                                                                      |
 \---------------------------------------------------------------------*/
-/**
- \file zypp/ResEdition.cc
-
- \brief        .
-
+/** \file zypp/ResEdition.cc
+ *
 */
 #include <iostream>
 
index 888d655..4cb006e 100644 (file)
@@ -6,11 +6,8 @@
 |                         /_____||_| |_| |_|                           |
 |                                                                      |
 \---------------------------------------------------------------------*/
-/**
- \file zypp/ResEdition.h
-
- \brief        .
-
+/** \file zypp/ResEdition.h
+ *
 */
 #ifndef ZYPP_RESEDITION_H
 #define ZYPP_RESEDITION_H
index 82ed99b..ea52751 100644 (file)
@@ -6,11 +6,8 @@
 |                         /_____||_| |_| |_|                           |
 |                                                                      |
 \---------------------------------------------------------------------*/
-/**
- \file zypp/ResKind.cc
-
- \brief        .
-
+/** \file zypp/ResKind.cc
+ *
 */
 #include <iostream>
 
index 2e25f1b..222f866 100644 (file)
@@ -6,11 +6,8 @@
 |                         /_____||_| |_| |_|                           |
 |                                                                      |
 \---------------------------------------------------------------------*/
-/**
- \file zypp/ResKind.h
-
- \brief        .
-
+/** \file zypp/ResKind.h
+ *
 */
 #ifndef ZYPP_RESKIND_H
 #define ZYPP_RESKIND_H
index ee4d74c..d851d01 100644 (file)
@@ -6,11 +6,8 @@
 |                         /_____||_| |_| |_|                           |
 |                                                                      |
 \---------------------------------------------------------------------*/
-/**
- \file zypp/ResName.cc
-
- \brief        .
-
+/** \file zypp/ResName.cc
+ *
 */
 #include <iostream>
 
index 2eea2fa..c1fb36f 100644 (file)
@@ -6,11 +6,8 @@
 |                         /_____||_| |_| |_|                           |
 |                                                                      |
 \---------------------------------------------------------------------*/
-/**
- \file zypp/ResName.h
-
- \brief        .
-
+/** \file zypp/ResName.h
+ *
 */
 #ifndef ZYPP_RESNAME_H
 #define ZYPP_RESNAME_H
index 7661137..81bc4e2 100644 (file)
@@ -6,17 +6,14 @@
 |                         /_____||_| |_| |_|                           |
 |                                                                      |
 \---------------------------------------------------------------------*/
-/**
- \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;
 
@@ -30,7 +27,16 @@ namespace zypp
   //   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 )
   {}
 
   ///////////////////////////////////////////////////////////////////
@@ -43,10 +49,13 @@ namespace zypp
 
   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(); }
 
@@ -57,6 +66,7 @@ namespace zypp
   */
   std::ostream & operator<<( std::ostream & str, const Resolvable & obj )
   {
+    str << '[' << obj.kind() << ']' << obj.name() << '-' << obj.edition() << '.' << obj.arch();
     return str;
   }
 
index 213cb4c..dd9487f 100644 (file)
@@ -6,11 +6,8 @@
 |                         /_____||_| |_| |_|                           |
 |                                                                      |
 \---------------------------------------------------------------------*/
-/**
- \file zypp/Resolvable.h
-
- \brief        .
-
+/** \file zypp/Resolvable.h
+ *
 */
 #ifndef ZYPP_RESOLVABLE_H
 #define ZYPP_RESOLVABLE_H
@@ -33,6 +30,7 @@ namespace zypp
   { /////////////////////////////////////////////////////////////////
     /** Hides implementation */
     class ResolvableImpl;
+    typedef base::shared_ptr<ResolvableImpl> ResolvableImplPtr;
     /////////////////////////////////////////////////////////////////
   } // namespace detail
   ///////////////////////////////////////////////////////////////////
@@ -47,6 +45,8 @@ namespace zypp
   public:
     /** Default ctor */
     Resolvable();
+    /** ctor */
+    Resolvable( detail::ResolvableImplPtr impl_r );
     /** Dtor */
     ~Resolvable();
   public:
@@ -58,10 +58,9 @@ namespace zypp
     const ResEdition & edition() const;
     /**  */
     const ResArch & arch() const;
-
   private:
     /** Pointer to implementation */
-    base::shared_ptr<detail::ResolvableImpl> _pimpl;
+    detail::ResolvableImplPtr _pimpl;
   };
   ///////////////////////////////////////////////////////////////////
 
index eeb2b33..6ae9a53 100644 (file)
@@ -6,11 +6,8 @@
 |                         /_____||_| |_| |_|                           |
 |                                                                      |
 \---------------------------------------------------------------------*/
-/**
- \file zypp/base/Logger.cc
-
- \brief        .
-
+/** \file zypp/base/Logger.cc
+ *
 */
 #include <iostream>
 
index a73b43a..8e3ca62 100644 (file)
@@ -6,18 +6,15 @@
 |                         /_____||_| |_| |_|                           |
 |                                                                      |
 \---------------------------------------------------------------------*/
-/**
- \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,
index 07088ce..b881588 100644 (file)
@@ -1,3 +1,14 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/base/PtrTypes.h
+ *
+*/
 #ifndef ZYPP_BASE_PTRTYPES_H
 #define ZYPP_BASE_PTRTYPES_H
 
index 9524422..db1c182 100644 (file)
@@ -1,3 +1,14 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/base/String.cc
+ *
+*/
 #include <cstdio>
 #include <cstdarg>
 
index 2d6b526..f188e43 100644 (file)
@@ -1,3 +1,14 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/base/String.h
+ *
+*/
 #ifndef ZYPP_BASE_STRING_H
 #define ZYPP_BASE_STRING_H
 
index 35e7f86..22c75da 100644 (file)
@@ -6,11 +6,8 @@
 |                         /_____||_| |_| |_|                           |
 |                                                                      |
 \---------------------------------------------------------------------*/
-/**
- \file zypp/base/StringVal.cc
-
- \brief        .
-
+/** \file zypp/base/StringVal.cc
+ *
 */
 #include "zypp/base/StringVal.h"
 
index 66b5663..542b8d4 100644 (file)
@@ -6,11 +6,8 @@
 |                         /_____||_| |_| |_|                           |
 |                                                                      |
 \---------------------------------------------------------------------*/
-/**
- \file zypp/base/StringVal.h
-
- \brief        .
-
+/** \file zypp/base/StringVal.h
+ *
 */
 #ifndef ZYPP_BASE_STRINGVAL_H
 #define ZYPP_BASE_STRINGVAL_H
index 4dfad23..24cddc7 100644 (file)
@@ -6,11 +6,8 @@
 |                         /_____||_| |_| |_|                           |
 |                                                                      |
 \---------------------------------------------------------------------*/
-/**
- \file zypp/detail/ResolvableImpl.cc
-
- \brief        .
-
+/** \file zypp/detail/ResolvableImpl.cc
+ *
 */
 #include <iostream>
 
@@ -28,19 +25,9 @@ namespace zypp
 
     ///////////////////////////////////////////////////////////////////
     //
-    // METHOD NAME : ResolvableImpl::ResolvableImpl
-    // METHOD TYPE : Ctor
+    // CLASS NAME : ResolvableImpl
     //
-    ResolvableImpl::ResolvableImpl()
-    {}
-
     ///////////////////////////////////////////////////////////////////
-    //
-    // METHOD NAME : ResolvableImpl::~ResolvableImpl
-    // METHOD TYPE : Dtor
-    //
-    ResolvableImpl::~ResolvableImpl()
-    {}
 
     /////////////////////////////////////////////////////////////////
   } // namespace detail
index 46bedc1..b28d2bd 100644 (file)
@@ -6,11 +6,8 @@
 |                         /_____||_| |_| |_|                           |
 |                                                                      |
 \---------------------------------------------------------------------*/
-/**
- \file zypp/detail/ResolvableImpl.h
-
- \brief        .
-
+/** \file zypp/detail/ResolvableImpl.h
+ *
 */
 #ifndef ZYPP_DETAIL_RESOLVABLEIMPL_H
 #define ZYPP_DETAIL_RESOLVABLEIMPL_H
@@ -38,11 +35,21 @@ namespace zypp
     {
     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
@@ -56,7 +63,6 @@ namespace zypp
       /**  */
       const ResArch & arch() const
       { return _arch; }
-
     private:
       ResKind    _kind;
       ResName    _name;