- introduced TranslatedText
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Mon, 30 Jan 2006 15:20:40 +0000 (15:20 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Mon, 30 Jan 2006 15:20:40 +0000 (15:20 +0000)
- Selections parser
- changed filelist and authors to string list (not text)
- make Text a string

34 files changed:
zypp/Makefile.am
zypp/NeedAType.h
zypp/Package.cc
zypp/Package.h
zypp/ResObject.cc
zypp/ResObject.h
zypp/Selection.cc
zypp/detail/PackageImplIf.cc
zypp/detail/PackageImplIf.h
zypp/detail/PatchImpl.cc
zypp/detail/PatchImpl.h
zypp/detail/ResObjectImplIf.cc
zypp/detail/ResObjectImplIf.h
zypp/detail/SelectionImplIf.cc
zypp/detail/SelectionImplIf.h
zypp/source/susetags/SelectionSelFileParser.cc
zypp/source/susetags/SuseTagsSelectionImpl.cc
zypp/source/susetags/SuseTagsSelectionImpl.h
zypp/source/yum/YUMGroupImpl.cc
zypp/source/yum/YUMGroupImpl.h
zypp/source/yum/YUMMessageImpl.cc
zypp/source/yum/YUMMessageImpl.h
zypp/source/yum/YUMPackageImpl.cc
zypp/source/yum/YUMPackageImpl.h
zypp/source/yum/YUMPatchImpl.cc
zypp/source/yum/YUMPatchImpl.h
zypp/source/yum/YUMPatternImpl.cc
zypp/source/yum/YUMPatternImpl.h
zypp/source/yum/YUMProductImpl.cc
zypp/source/yum/YUMProductImpl.h
zypp/source/yum/YUMScriptImpl.cc
zypp/source/yum/YUMScriptImpl.h
zypp/target/rpm/RpmPackageImpl.cc
zypp/target/rpm/RpmPackageImpl.h

index cc438a7..2d28c69 100644 (file)
@@ -67,6 +67,7 @@ pkginclude_HEADERS = NeedAType.h \
        PatchRpm.h      \
        DeltaRpm.h      \
        ZYpp.h          \
+       TranslatedText.h \
        ZYppFactory.h
 
 ## ##################################################
@@ -124,6 +125,7 @@ lib@PACKAGE@_la_SOURCES = \
        TmpPath.cc      \
        DiskUsage.cc    \
        ZYpp.cc         \
+       TranslatedText.cc \
        ZYppFactory.cc
 
 lib@PACKAGE@_la_LDFLAGS =      @LIBZYPP_VERSION_INFO@
index 8496355..9171d6a 100644 (file)
@@ -54,7 +54,7 @@ namespace zypp
 
   /** 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;
+  typedef std::string Text;
 
   /** Offer a License text and methods to remember confirmation. */
   typedef std::list<std::string> License;
index d98349e..d5de213 100644 (file)
@@ -112,11 +112,11 @@ namespace zypp
   { return pimpl().archivesize(); }
 
   /** */
-  Text Package::authors() const
+  std::list<std::string> Package::authors() const
   { return pimpl().authors(); }
 
   /** */
-  Text Package::filenames() const
+  std::list<std::string> Package::filenames() const
   { return pimpl().filenames(); }
 
   /** */
index a6a5be6..8dfd776 100644 (file)
@@ -71,9 +71,9 @@ namespace zypp
     /** */
     ByteCount archivesize() const;
     /** */
-    Text authors() const;
+    std::list<std::string> authors() const;
     /** */
-    Text filenames() const;
+    std::list<std::string> filenames() const;
     /** */
     License licenseToConfirm() const;
     /** */
index 5d391f7..15eef42 100644 (file)
@@ -43,10 +43,10 @@ namespace zypp
   //
   ///////////////////////////////////////////////////////////////////
 
-  Label ResObject::summary() const
+  const TranslatedText & ResObject::summary() const
   { return pimpl().summary(); }
 
-  Text ResObject::description() const
+  const TranslatedText & ResObject::description() const
   { return pimpl().description(); }
 
   Text ResObject::insnotify() const
index 67e1e13..9aaab42 100644 (file)
@@ -13,6 +13,7 @@
 #define ZYPP_RESOBJECT_H
 
 #include "zypp/Resolvable.h"
+#include "zypp/TranslatedText.h"
 //#include "zypp/detail/ResObjectImplIf.h"
 #include "zypp/NeedAType.h"
 
@@ -42,10 +43,10 @@ namespace zypp
 
   public:
     /** */
-    Label summary() const;
+    const TranslatedText & summary() const;
 
     /** */
-    Text description() const;
+    const TranslatedText & description() const;
 
     /** */
     Text insnotify() const;
index e5dca9e..f182442 100644 (file)
@@ -12,6 +12,7 @@
 #include <iostream>
 
 #include "zypp/Selection.h"
+#include "zypp/TranslatedText.h"
 
 using namespace std;
 
@@ -45,13 +46,13 @@ namespace zypp
     /** selection summary (FIXME: localized) */
     Label Selection::summary() const
     {
-       return pimpl().summary();    
+       return pimpl().summary().text();    
     }
 
     /** */
     Text Selection::description() const
     {
-       return pimpl().description();    
+       return pimpl().description().text();    
     }
 
     /** selection category */
index 07d0598..05f3aaf 100644 (file)
@@ -62,17 +62,17 @@ namespace zypp
       std::string PackageImplIf::os() const
       { return std::string(); }
 
-      std::list<std::string> PackageImplIf::prein() const
-      { return std::list<std::string>(); }
+      Text PackageImplIf::prein() const
+      { return Text(); }
 
-      std::list<std::string> PackageImplIf::postin() const
-      { return std::list<std::string>(); }
+      Text PackageImplIf::postin() const
+      { return Text(); }
 
-      std::list<std::string> PackageImplIf::preun() const
-      { return std::list<std::string>(); }
+      Text PackageImplIf::preun() const
+      { return Text(); }
 
-      std::list<std::string> PackageImplIf::postun() const
-      { return std::list<std::string>(); }
+      Text PackageImplIf::postun() const
+      { return Text(); }
 
       ByteCount PackageImplIf::sourcesize() const
       { return ByteCount(); }
index 8dd1fa6..731818d 100644 (file)
@@ -101,9 +101,9 @@ namespace zypp
       /** */
       virtual ByteCount archivesize() const PURE_VIRTUAL;
       /** */
-      virtual Text authors() const PURE_VIRTUAL;
+      virtual std::list<std::string> authors() const PURE_VIRTUAL;
       /** */
-      virtual Text filenames() const PURE_VIRTUAL;
+      virtual std::list<std::string> filenames() const PURE_VIRTUAL;
       /** */
       virtual std::list<DeltaRpm> deltaRpms() const PURE_VIRTUAL;
       /** */
index 3fa9439..c2a7cb2 100644 (file)
@@ -47,12 +47,12 @@ namespace zypp
       return _timestamp;
     }
 
-    std::string PatchImpl::summary() const
+    const TranslatedText & PatchImpl::summary() const
     {
       return _summary;
     }
 
-    std::list<std::string> PatchImpl::description() const
+    const TranslatedText & PatchImpl::description() const
     {
       return _description;
     }
index e4ba1ea..0b085dc 100644 (file)
@@ -43,9 +43,9 @@ namespace zypp
       /** Patch time stamp */
       unsigned int timestamp() const;
       /** Patch summary */
-      std::string summary() const;
+      const TranslatedText & summary() const;
       /** Patch description */
-      std::list<std::string> description() const;
+      const TranslatedText & description() const;
       /** Patch category (recommended, security,...) */
       std::string category() const;
       /** Does the system need to reboot to finish the update process? */
@@ -71,7 +71,7 @@ namespace zypp
       /** Patch summary */
       std::string _summary;
       /** Patch description */
-      std::list<std::string> _description;
+      std::string _description;
       /** Patch category (recommended, security,...) */
       std::string _category;
       /** Does the system need to reboot to finish the update process? */
index 1ad292a..44a5ad4 100644 (file)
@@ -25,11 +25,11 @@ namespace zypp
     // as far as resonable.
     /////////////////////////////////////////////////////////////////
 
-      Label ResObjectImplIf::summary() const
-      { return Label(); }
+      const TranslatedText & ResObjectImplIf::summary() const
+      { return TranslatedText(); }
 
-      Text ResObjectImplIf::description() const
-      { return Text(); }
+      const TranslatedText & ResObjectImplIf::description() const
+      { return TranslatedText(); }
 
       Text ResObjectImplIf::insnotify() const
       { return Text(); }
index 4308878..7095e4f 100644 (file)
@@ -19,6 +19,7 @@
 #include "zypp/Locale.h"
 #include "zypp/ByteCount.h"
 #include "zypp/Date.h"
+#include "zypp/TranslatedText.h"
 
 #include "zypp/NeedAType.h" // volatile include propagating type drafts
 
@@ -63,10 +64,10 @@ namespace zypp
       */
       //@{
       /** Short label. */
-      virtual Label summary() const PURE_VIRTUAL;
+      virtual const TranslatedText & summary() const PURE_VIRTUAL;
 
       /** Long description */
-      virtual Text description() const PURE_VIRTUAL;
+      virtual const TranslatedText & description() const PURE_VIRTUAL;
 
       /** \todo well define! */
       virtual Text insnotify() const PURE_VIRTUAL;
index d644246..63916ae 100644 (file)
@@ -26,11 +26,11 @@ namespace zypp
     // as far as resonable.
     /////////////////////////////////////////////////////////////////
 
-    Label SelectionImplIf::summary() const
-    { return Label(); }
+    const TranslatedText & SelectionImplIf::summary() const
+    { return TranslatedText(); }
 
-    Text SelectionImplIf::description() const
-    { return Text(); }
+    const TranslatedText & SelectionImplIf::description() const
+    { return TranslatedText(); }
 
     Label SelectionImplIf::category() const
     { return Label(); }
index e83c2d7..3b45f65 100644 (file)
@@ -13,6 +13,7 @@
 #define ZYPP_DETAIL_SELECTIONIMPLIF_H
 
 #include "zypp/detail/ResObjectImplIf.h"
+#include "zypp/TranslatedText.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -45,10 +46,10 @@ namespace zypp
     public:
 
         /** */
-        virtual Label summary() const = 0;
+        virtual const TranslatedText & summary() const = 0;
 
         /** */
-        virtual Text description() const = 0;
+        virtual const TranslatedText & description() const = 0;
 
         /** */
        virtual Label category() const = 0;
index ae1dc34..e4a8ea8 100644 (file)
@@ -64,7 +64,7 @@ namespace zypp
       {
         if ( tag.name == "Sum" )
         {
-          selImpl->_summary[tag.modifier] = tag.value;
+          selImpl->_summary.setText(tag.value, LanguageCode(tag.modifier));
         }
         else if ( tag.name == "Ver" )
         {
@@ -111,7 +111,7 @@ namespace zypp
         }
         else if ( tag.name == "Ins" )
         {
-          selImpl->_inspacks[tag.modifier] = tag.values;
+          selImpl->_inspacks[LanguageCode(tag.modifier)] = tag.values;
         }
       }
 
index d846cc2..cb5dd21 100644 (file)
@@ -38,11 +38,11 @@ namespace zypp
     {}
 
 
-    Label SuseTagsSelectionImpl::summary() const
-    { return Label(); }
+    const TranslatedText & SuseTagsSelectionImpl::summary() const
+    { return _summary; }
 
-    Text SuseTagsSelectionImpl::description() const
-    { return Text(); }
+    const TranslatedText & SuseTagsSelectionImpl::description() const
+    { return _summary; }
 
     Label SuseTagsSelectionImpl::category() const
     { return Label(); }
index 73e28cd..9fd1c0b 100644 (file)
@@ -57,14 +57,13 @@ namespace zypp
       virtual PMError provideSelToInstall( Pathname & path_r ) const;
       */
 
-      virtual Label summary() const;
-      virtual Text description() const;
+      virtual const TranslatedText & summary() const;
+      virtual const TranslatedText & description() const;
       virtual Label category() const;
       virtual bool visible() const;
       virtual Label order() const;
 
-      std::map< std::string, std::string> _summary;
-      std::string _description;
+      TranslatedText _summary;
       std::string _parser_version;
       std::string _name;
       std::string _version;
@@ -79,10 +78,10 @@ namespace zypp
       std::set<std::string> _requires;
       std::set<std::string> _conflicts;
       std::set<std::string> _supported_locales;
-      std::map< std::string, std::set<std::string> > _insnotify;
-      std::map< std::string, std::set<std::string> > _delnotify;
-      std::map< std::string, std::set<std::string> > _inspacks;
-      std::map< std::string, std::set<std::string> > _delpacks;
+      std::map< LanguageCode, std::set<std::string> > _insnotify;
+      std::map< LanguageCode, std::set<std::string> > _delnotify;
+      std::map< LanguageCode, std::set<std::string> > _inspacks;
+      std::map< LanguageCode, std::set<std::string> > _delpacks;
       
     };
     ///////////////////////////////////////////////////////////////////
index 5b86906..5c98403 100644 (file)
@@ -99,10 +99,10 @@ namespace zypp
       CapSet YUMGroupImpl::defaultReq() const
       { return _default_req; }
 
-      Label YUMGroupImpl::summary() const
+      const TranslatedText & YUMGroupImpl::summary() const
       { return ResObjectImplIf::summary(); }
 
-      Text YUMGroupImpl::description() const
+      const TranslatedText & YUMGroupImpl::description() const
       { return ResObjectImplIf::description(); }
 
       Text YUMGroupImpl::insnotify() const
index 5bc3995..f37a2be 100644 (file)
@@ -48,9 +48,9 @@ namespace zypp
        /** Requested packages */
        virtual CapSet defaultReq() const;
        /** */
-       virtual Label summary() const;
+       virtual const TranslatedText & summary() const;
        /** */
-       virtual Text description() const;
+       virtual const TranslatedText & description() const;
        /** */
        virtual Text insnotify() const;
        /** */
index c29d466..f994520 100644 (file)
@@ -48,10 +48,10 @@ namespace zypp
       std::string YUMMessageImpl::type() const {
        return _type;
       }
-      Label YUMMessageImpl::summary() const
+      const TranslatedText &  YUMMessageImpl::summary() const
       { return ResObjectImplIf::summary(); }
 
-      Text YUMMessageImpl::description() const
+      const TranslatedText &  YUMMessageImpl::description() const
       { return ResObjectImplIf::description(); }
 
       Text YUMMessageImpl::insnotify() const
index 6348b76..4bf9b7f 100644 (file)
@@ -44,9 +44,9 @@ namespace zypp
        /** Get the type of the message (YesNo / OK) */
        virtual std::string type() const;
        /** */
-       virtual Label summary() const;
+       virtual const TranslatedText &  summary() const;
        /** */
-       virtual Text description() const;
+       virtual const TranslatedText & description() const;
        /** */
        virtual Text insnotify() const;
        /** */
index 7a51d52..6aff2d4 100644 (file)
@@ -72,7 +72,7 @@ namespace zypp
        _dir_sizes(parsed.dirSizes),
 #endif
       {
-       _description.push_back(parsed.description);
+       _description.setText(parsed.description);
        for (std::list<FileData>::const_iterator it = filelist.files.begin();
             it != filelist.files.end();
             it++)
@@ -126,7 +126,7 @@ namespace zypp
        _dir_sizes(parsed.dirSizes),
 #endif
       {
-       _description.push_back(parsed.description);
+       _description.setText(parsed.description);
        for (std::list<FileData>::const_iterator it = parsed.files.begin();
             it != parsed.files.end();
             it++)
@@ -194,11 +194,11 @@ namespace zypp
 
 
       /** Package summary */
-      Label YUMPackageImpl::summary() const
+      const TranslatedText &  YUMPackageImpl::summary() const
       { return _summary; }
 
       /** Package description */
-      Text YUMPackageImpl::description() const
+      const TranslatedText &  YUMPackageImpl::description() const
       { return _description; }
 
       Text YUMPackageImpl::insnotify() const
@@ -304,11 +304,11 @@ namespace zypp
       { return 0; }
 
       /** */
-      Text YUMPackageImpl::authors() const
+      std::list<std::string> YUMPackageImpl::authors() const
       { return _authors; }
 
       /** */
-      Text YUMPackageImpl::filenames() const
+      std::list<std::string> YUMPackageImpl::filenames() const
       { return _filenames; }
 
       License YUMPackageImpl::licenseToConfirm() const
index 47edc28..16943d6 100644 (file)
@@ -52,9 +52,9 @@ namespace zypp
        );
 
        /** Package summary */
-       virtual Label summary() const;
+       virtual const TranslatedText &  summary() const;
        /** Package description */
-       virtual Text description() const;
+       virtual const TranslatedText &  description() const;
        virtual Text insnotify() const;
        virtual Text delnotify() const;
        virtual ByteCount size() const;
@@ -99,9 +99,9 @@ namespace zypp
        /** */
        virtual ByteCount archivesize() const;
        /** */
-       virtual Text authors() const;
+       virtual std::list<std::string> authors() const;
        /** */
-       virtual Text filenames() const;
+       virtual std::list<std::string> filenames() const;
         /** */
         virtual License licenseToConfirm() const;
         /** */
@@ -196,8 +196,8 @@ namespace zypp
         virtual bool prefererCandidate() const;
 #endif
       protected:
-       Label _summary;
-       Text _description;
+       TranslatedText _summary;
+       TranslatedText _description;
        Date _buildtime;
        std::string _buildhost;
        std::string _url;
@@ -208,11 +208,11 @@ namespace zypp
        Changelog _changelog;
        std::string _type;
        License _license_to_confirm;
-       Text _authors;
-       std::list<std::string>_keywords;
+       std::list<std::string> _authors;
+       std::list<std::string> _keywords;
        unsigned _mediaid;
        CheckSum _checksum;
-       Text _filenames;
+       std::list<std::string> _filenames;
        Pathname _location;
        std::list<DeltaRpm> _delta_rpms;
        std::list<PatchRpm> _patch_rpms;
index 7c4c790..11ab255 100644 (file)
@@ -129,10 +129,10 @@ namespace zypp
         return _timestamp;
       }
 
-      Label YUMPatchImpl::summary() const
+      const TranslatedText &  YUMPatchImpl::summary() const
       { return _summary; }
 
-      Text YUMPatchImpl::description() const
+      const TranslatedText &  YUMPatchImpl::description() const
       { return _description; }
 
       Text YUMPatchImpl::insnotify() const
index 49ac488..bd4ce33 100644 (file)
@@ -59,9 +59,9 @@ namespace zypp
        AtomList not_installed_atoms() const;
 
        /** Patch summary */
-       virtual Label summary() const;
+       virtual const TranslatedText &  summary() const;
        /** Patch description */
-       virtual Text description() const;
+       virtual const TranslatedText &  description() const;
        virtual Text insnotify() const;
        virtual Text delnotify() const;
        virtual ByteCount size() const;
index 0fa10c6..262f12a 100644 (file)
@@ -95,10 +95,10 @@ namespace zypp
       CapSet YUMPatternImpl::defaultReq() const
       { return _default_req; }
 
-      Label YUMPatternImpl::summary() const
+      const TranslatedText &  YUMPatternImpl::summary() const
       { return ResObjectImplIf::summary(); }
 
-      Text YUMPatternImpl::description() const
+      const TranslatedText &  YUMPatternImpl::description() const
       { return ResObjectImplIf::description(); }
 
       Text YUMPatternImpl::insnotify() const
index 84b24b5..c8b4edf 100644 (file)
@@ -47,9 +47,9 @@ namespace zypp
        /** default requirements */
        virtual CapSet defaultReq() const;
        /** */
-       virtual Label summary() const;
+       virtual const TranslatedText &  summary() const;
        /** */
-       virtual Text description() const;
+       virtual const TranslatedText &  description() const;
        /** */
        virtual Text insnotify() const;
        /** */
index 66603ad..5da46c0 100644 (file)
@@ -62,10 +62,10 @@ namespace zypp
       Label YUMProductImpl::displayName() const
       { return _displayname; }
 
-      Label YUMProductImpl::summary() const
+      const TranslatedText &  YUMProductImpl::summary() const
       { return ResObjectImplIf::summary(); }
 
-      Text YUMProductImpl::description() const
+      const TranslatedText &  YUMProductImpl::description() const
       { return _description; }
 
       Text YUMProductImpl::insnotify() const
index 50cd295..74fc893 100644 (file)
@@ -43,8 +43,8 @@ namespace zypp
        std::string category() const;
        Label vendor() const;
        Label displayName() const;
-       Label summary() const;
-       Text description() const;
+       const TranslatedText &  summary() const;
+       const TranslatedText &  description() const;
        Text insnotify() const;
        Text delnotify() const;
        ByteCount size() const;
index d5e6e8b..1704001 100644 (file)
@@ -54,10 +54,10 @@ namespace zypp
       bool YUMScriptImpl::undo_available() const {
        return _undo_script != "";
       }
-      Label YUMScriptImpl::summary() const
+      const TranslatedText &  YUMScriptImpl::summary() const
       { return ResObjectImplIf::summary(); }
 
-      Text YUMScriptImpl::description() const
+      const TranslatedText &  YUMScriptImpl::description() const
       { return ResObjectImplIf::description(); }
 
       Text YUMScriptImpl::insnotify() const
index 5ceef10..436d76f 100644 (file)
@@ -45,8 +45,8 @@ namespace zypp
        /** Check whether script to undo the change is available */
        virtual bool undo_available() const;
 
-       virtual Label summary() const;
-       virtual Text description() const;
+       virtual const TranslatedText &  summary() const;
+       virtual const TranslatedText &  description() const;
        virtual Text insnotify() const;
        virtual Text delnotify() const;
        virtual bool providesSources() const;
index 4cd8772..0fa9f67 100644 (file)
@@ -60,17 +60,17 @@ namespace zypp
        _dir_sizes(parsed.dirSizes),
 #endif
       {
-       _description.push_back(data->tag_description());
+       _description.setText(data->tag_description());
        data->tag_du(_disk_usage);
       }
 
 
       /** Package summary */
-      Label RPMPackageImpl::summary() const
+      const TranslatedText &  RPMPackageImpl::summary() const
       { return _summary; }
 
       /** Package description */
-      Text RPMPackageImpl::description() const
+      const TranslatedText &  RPMPackageImpl::description() const
       { return _description; }
 
       Text RPMPackageImpl::insnotify() const
@@ -172,11 +172,11 @@ namespace zypp
       { return 0; }
 
       /** */
-      Text RPMPackageImpl::authors() const
+      std::list<std::string> RPMPackageImpl::authors() const
       { return _authors; }
 
       /** */
-      Text RPMPackageImpl::filenames() const
+      std::list<std::string> RPMPackageImpl::filenames() const
       { return _filenames; }
 
       License RPMPackageImpl::licenseToConfirm() const
index 3fd5d57..334ce8c 100644 (file)
@@ -41,9 +41,9 @@ namespace zypp
        );
 
        /** Package summary */
-       virtual Label summary() const;
+       virtual const TranslatedText &  summary() const;
        /** Package description */
-       virtual Text description() const;
+       virtual const TranslatedText &  description() const;
        virtual Text insnotify() const;
        virtual Text delnotify() const;
        virtual ByteCount size() const;
@@ -86,9 +86,9 @@ namespace zypp
        /** */
        virtual ByteCount archivesize() const;
        /** */
-       virtual Text authors() const;
+       virtual std::list<std::string> authors() const;
        /** */
-       virtual Text filenames() const;
+       virtual std::list<std::string> filenames() const;
         /** */
         virtual License licenseToConfirm() const;
         /** */
@@ -99,8 +99,8 @@ namespace zypp
         virtual DiskUsage diskUsage() const;
 
       protected:
-       Label _summary;
-       Text _description;
+       TranslatedText _summary;
+       TranslatedText _description;
        Date _buildtime;
        std::string _buildhost;
        std::string _url;
@@ -111,9 +111,9 @@ namespace zypp
        Changelog _changelog;
        std::string _type;
        License _license_to_confirm;
-       Text _authors;
+       std::list<std::string> _authors;
        std::list<std::string>_keywords;
-       Text _filenames;
+       std::list<std::string> _filenames;
        DiskUsage _disk_usage;
        };
       ///////////////////////////////////////////////////////////////////