done
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Tue, 24 Jan 2006 15:58:13 +0000 (15:58 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Tue, 24 Jan 2006 15:58:13 +0000 (15:58 +0000)
zypp/parser/tagfile/ProductMetadataParser.cc
zypp/parser/tagfile/ProductMetadataParser.h

index 0b1d01d..5166f04 100644 (file)
@@ -85,23 +85,40 @@ namespace zypp
               entry_r.release_notes_url = value;
             else if(key == "ARCH")
               parseLine( key, modifier, value, entry_r.arch);
+            else if(key == "DEFAULTBASE")
+              entry_r.default_base = value;
+            else if(key == "REQUIRES")
+              parseLine( key, value, entry_r.requires);
+            else if(key == "LINGUAS")
+              parseLine( key, value, entry_r.languages);
+            else if(key == "LABEL")
+              parseLine( key, modifier, value, entry_r.label);
+            else if(key == "DESCRDIR")
+              entry_r.description_dir = value;
+            else if(key == "DATADIR")
+              entry_r.data_dir = value;
+            else if(key == "FLAGS")
+              parseLine( key, value, entry_r.flags);
+            else if(key == "LANGUAGE")
+              entry_r.language = value;
+            else if(key == "TIMEZONE")
+              entry_r.timezone = value;
             else
               DBG << "parse error" << std::endl;
           }
           else
           {
-            std::cout << "** No Match found **\n";
+            DBG << "** No Match found:  " << buffer << std::endl;
           }
-          //std::cout << "hola: [" << buffer << "]" << std::endl;
         }
       }
 
       void ProductMetadataParser::parseLine( const string &key, const string &modif, const string &value, map< string, list<string> > &container)
       {
-        if( modif.size() == 0)
-          str::split( value, std::back_inserter(container["default"]), " ");
+        if ( modif.size() == 0)
+          parseLine( key, value, container["default"]); 
         else
-          str::split( value, std::back_inserter(container[modif]), " ");
+          parseLine( key, value, container[modif]);
       }
 
       void ProductMetadataParser::parseLine( const string &key, const string &modif, const string &value, map< string, string > &container)
@@ -112,6 +129,12 @@ namespace zypp
           container[modif] = value;
       }
 
+      void ProductMetadataParser::parseLine( const string &key, const string &value, std::list<std::string> &container)
+      {
+          str::split( value, std::back_inserter(container), " ");
+      }
+
+
       /////////////////////////////////////////////////////////////////
     } // namespace tagfile
     ///////////////////////////////////////////////////////////////////
index 267901f..345c01a 100644 (file)
@@ -54,7 +54,7 @@ namespace zypp
           std::string release_notes_url;
           std::map< std::string, std::list<std::string> > arch;
           std::string default_base;
-          std::string requires;
+          std::list<std::string> requires;
           std::list<std::string> languages;
           std::map< std::string, std::string > label;
           std::string description_dir;
@@ -84,14 +84,18 @@ namespace zypp
         */
         void parse( const Pathname & file_r, ProductEntry &entry_r );
         /* Parse a key.modifier (std::list of std::strings)
+         * That means, translatable tag with multiple values
          * the default modifier will get the modifier of default (LABEL.de, LABEL as LANGUAGE.default)
         */ 
-        void parseLine( const std::string &key, const std::string &modifr, const std::string &value, std::map< std::string, std::list<std::string> > &container);
+        void parseLine( const std::string &key, const std::string &modif, const std::string &value, std::map< std::string, std::list<std::string> > &container);
         /*
-         * same as above, but the value is a single std::string
+         * same as above, but the value is a single std::string, this means, translatable tags, with only 1 value
         */
         void parseLine( const std::string &key,const std::string &modif, const std::string &value, std::map< std::string, std::string > &container);
-        
+        /*
+         * Non translatable tag with multiple values
+         */
+        void parseLine( const std::string &key, const std::string &value, std::list<std::string> &container);
       };
       ///////////////////////////////////////////////////////////////////