Fixed printing of dependencies. Added zypp/NeedAType.h for drafting
authorMichael Andres <ma@suse.de>
Wed, 23 Nov 2005 19:23:15 +0000 (19:23 +0000)
committerMichael Andres <ma@suse.de>
Wed, 23 Nov 2005 19:23:15 +0000 (19:23 +0000)
types to implement.

zypp/Capability.cc
zypp/Edition.h
zypp/Makefile.am
zypp/NeedAType.h [new file with mode: 0644]
zypp/Rel.h
zypp/ResObject.cc
zypp/ResObject.h
zypp/base/PtrTypes.h
zypp/detail/ResObjectImplIf.h

index 4746779..bf0e9c4 100644 (file)
@@ -59,7 +59,7 @@ namespace zypp
   */
   std::ostream & operator<<( std::ostream & str, const Capability & obj )
   {
-    return str << obj._pimpl._dptr;
+    return str << obj._pimpl;
   }
 
   /////////////////////////////////////////////////////////////////
index c364062..6235dbb 100644 (file)
@@ -64,7 +64,7 @@ namespace zypp
 
   public:
     /** Compare two Editions using relational operator \a op.
-     * \return Result of expression \t ( \a lhs \a op \a rhs \t ).<BR>
+     * \return Result of expression \c ( \a lhs \a op \a rhs \c ).<BR>
      * If \a op is Rel::ANY, the expression is always \c true.<BR>
      * If \a op is Rel::NONE, the expression is always \c false.
      *
index 2431e83..9cdc547 100644 (file)
@@ -5,7 +5,7 @@ SUBDIRS = base parser capability source detail
 
 ## ##################################################
 
-include_HEADERS = \
+include_HEADERS = NeedAType.h \
        Arch.h          \
        Capability.h    \
        CapFactory.h    \
diff --git a/zypp/NeedAType.h b/zypp/NeedAType.h
new file mode 100644 (file)
index 0000000..3645668
--- /dev/null
@@ -0,0 +1,124 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/NeedAType.h
+ *
+*/
+#ifndef ZYPP_NEEDATYPE_H
+#define ZYPP_NEEDATYPE_H
+
+#include <iosfwd>
+#include <map>
+#include <list>
+#include <string>
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  /** \defgroup NEEDATYPE Wishlist of types
+
+   Whenever you find something that might be worth being a
+   type, and not just an \c unsigned or \c string. Keep it here.
+
+   Start with a resonable \c typedef or \c class draft, so you
+   can start using the type within the implementation. If you're
+   in need for interface methods, add them to the draft. Think about
+   the interface and expected behaviour, but implement \b here just
+   as much as you actually need.
+
+   Goal is to provide a real class for it, or to find out that a
+   typedef is sufficient, ot the type is not needed anyway.
+
+   If you already implemented something which would fit into this
+   group, but don't want to move it here, put doxygens
+   \code \ingroup NEEDATYPE \endcode tag in it's comment. So it will
+   at least appear in the doc.
+
+   \note Don't put stuff here, that's (almost) ready to use. This is
+   not meant to be a convenience include. Goal is to have this file empty.
+  */
+  //@{
+
+
+  /** Class representing an URL.
+   something like liby2utils Url class. But we
+   need clearly documented rules for parsing, and the way the broken down
+   URL parts are stored withtin the class. This addresses especially
+   the escaping and deescaping of special characters. It must be obvious to
+   the user of the class, wheter an interface funtion deals with
+   escaped, deescaped or hidden (in case of password) representation of the
+   value.
+
+   These rule may depend on the kind of URL protocol. The same for the
+   recognized set of URL options we support. User/Passwd can be given
+   in the URL or as option.
+
+   There could be a common URL interface class which forwards all requests
+   to an implementation class which may be specialized dependent on the URL
+   protocol.
+
+   There should be no obvious difference between known and unknown protocols.
+   It should be possible to register an implementation class factory (or
+   prototype) for a certain protocol at runtime.
+  */
+  typedef std::string Url;
+
+  /** Convenient handling of pathnmes.  */
+  typedef std::string Pathname;
+
+  /** Single line of (human readable) text.
+  probabely sufficient as typedef. we may use it to classify the
+  various strings and string lists within resolvable and other classes.
+  More a hint to the UI describing the purpose of the string. */
+  typedef std::string Label;
+
+  /** Single line of (human readable) text. See Label. A description would
+   Text, while a a packages file list would be list<string> */
+  typedef std::list<std::string> Text;
+
+  /** Class representing a Date (time_t). Basically store a time_t and offer
+  conversions into formated strings. */
+  typedef time_t Date;
+
+  /** Class representing a F(ile)Size, or ammount of byte. arithmetic
+   operations needed e.g. for disk usage calculation. conversions into
+   formated strings. Interface supports specifying FSize in (ammount,unit)
+   KB MB GB....
+  */
+  typedef long long FSize;
+
+  /** Vendor. Worth a typedef. Maybe a class unifying the strings. */
+  typedef std::string Vendor;
+
+  /** Handle Strings like "en_US". Offerrs their CountryCode and
+   LanguageCode parts. */
+  typedef std::string Locale;
+
+  /** CountryCode of locale (from libutil incl. translations) */
+  typedef std::string CountryCode;
+
+  /** LanguageCode of locale (from libutil incl. translations) */
+  typedef std::string LanguageCode;
+
+  /** Handle data depending on a locale. Translated strings, maybe
+   other too. */
+  template<class _Val>
+    struct MultiLocale : public std::map<Locale,_Val>
+    {};
+
+  /** stream reading compessed or uncompress files */
+  typedef std::ifstream ifgzstream;
+
+  /** stream writing compessed or uncompress files */
+  typedef std::ofstream ofgzstream;
+
+  //@}
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_NEEDATYPE_H
index b5f1ac3..cd534d0 100644 (file)
@@ -41,7 +41,7 @@ namespace zypp
   struct Rel
   {
     /** \name Relational operators
-     * These are the \en real relational operator contants to
+     * These are the \em real relational operator contants to
      * use. Don't mind that it's not an enum. See also: \ref inSwitch
     */
     //@{
index 8970a45..eea62c9 100644 (file)
@@ -43,10 +43,10 @@ namespace zypp
   //
   ///////////////////////////////////////////////////////////////////
 
-  string ResObject::summary() const
+  Label ResObject::summary() const
   { return pimpl().summary(); }
 
-  text ResObject::description() const
+  Text ResObject::description() const
   { return pimpl().description(); }
 
   /////////////////////////////////////////////////////////////////
index 6c7face..7d81b71 100644 (file)
@@ -36,9 +36,9 @@ namespace zypp
 
   public:
     /** */
-    line summary() const;
+    Label summary() const;
     /** */
-    text description() const;
+    Text description() const;
 
   protected:
     /** Ctor */
index 48b3819..fdcc142 100644 (file)
@@ -13,6 +13,8 @@
 #ifndef ZYPP_BASE_PTRTYPES_H
 #define ZYPP_BASE_PTRTYPES_H
 
+#include <string>
+
 #include <boost/scoped_ptr.hpp>
 #include <boost/shared_ptr.hpp>
 #include <boost/weak_ptr.hpp>
@@ -101,6 +103,21 @@ namespace zypp
 
         _Ptr _dptr;
       };
+
+    /** \relates ImplPtr Stream output.
+     *
+     * Print the \r _D object the ImplPtr refers, or \c "NULL"
+     * if the pointer is \c NULL.
+    */
+    template<class _D, class _Ptr>
+      inline std::ostream &
+      operator<<( std::ostream & str, const ImplPtr<_D, _Ptr> & obj )
+      {
+        if ( obj.get() )
+          return str << *obj.get();
+        return str << std::string("NULL");
+      }
+
     ///////////////////////////////////////////////////////////////////
     /** Wrapper for \c const correct access via pointer.
      *
@@ -133,6 +150,7 @@ namespace zypp
 
         _P * _dptr;
       };
+
     /////////////////////////////////////////////////////////////////
 
     /*@}*/
index 1dbed50..40f63f4 100644 (file)
 
 #include "zypp/detail/ResObjectFactory.h"
 
+#include "zypp/NeedAType.h" // volatile include propagating type drafts
+
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
 
   class Resolvable;
 
-  typedef std::string            line;
-  typedef std::list<std::string> text;
-
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
@@ -52,11 +51,11 @@ namespace zypp
       Resolvable *const self()
       { return _backRef; }
       /** */
-      virtual line summary() const
-      { return line(); }
+      virtual Label summary() const
+      { return Label(); }
       /** */
-      virtual text description() const
-      { return text(); }
+      virtual Text description() const
+      { return Text(); }
 
     public:
       /** Ctor */