]> git.saurik.com Git - apt.git/commitdiff
Most interfaces (Maemo) need a high-level name :/.
authorJay Freeman (saurik) <saurik@saurik.com>
Wed, 30 Nov 2016 06:55:57 +0000 (22:55 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Wed, 30 Nov 2016 06:55:57 +0000 (22:55 -0800)
apt-pkg/cacheiterators.h
apt-pkg/deb/deblistparser.cc
apt-pkg/deb/debrecords.cc
apt-pkg/deb/debrecords.h
apt-pkg/pkgcache.h
apt-pkg/pkgrecords.h

index 45d23151c441af69ff2560d736c25ddfdabb00d7..3308f43dda3e3bf83094e312d82a90b74e1f5ca9 100644 (file)
@@ -214,6 +214,7 @@ class pkgCache::VerIterator : public Iterator<Version, VerIterator> {
        // Accessors
        inline const char *VerStr() const {return S->VerStr == 0?0:Owner->StrP + S->VerStr;}
        inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;}
+       inline const char *Display() const {return S->Display == 0?0:Owner->StrP + S->Display;}
        /** \brief source package name this version comes from
           Always contains the name, even if it is the same as the binary name */
        inline const char *SourcePkgName() const {return Owner->StrP + S->SourcePkgName;}
index 878170d0074eeabecb098efa34a94b4f047908b7..ec5787fb4d10710404b19007fe6d6fca24aeafe8 100644 (file)
@@ -148,6 +148,15 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver)
    const char *Start;
    const char *Stop;
 
+   if (Section.Find("Name",Start,Stop) == true)
+   {
+      Ver->Display = WriteString(Start, Stop - Start);
+   }
+   else if (Section.Find("Maemo-Display-Name",Start,Stop) == true)
+   {
+      Ver->Display = WriteString(Start, Stop - Start);
+   }
+
    // Parse the section
    if (Section.Find(pkgTagSection::Key::Section,Start,Stop) == true)
    {
index a132f34a6d95182879830e7c5b0712c64b890a32..6d642c7b87d645b71fe449e76904fe2999ec9cf5 100644 (file)
@@ -74,6 +74,15 @@ string debRecordParserBase::Name()
    return Result;
 }
                                                                        /*}}}*/
+// RecordParserBase::Display - Return the package homepage             /*{{{*/
+string debRecordParserBase::Display()
+{
+   string display(Section.FindS("Name"));
+   if (display.empty())
+      display = Section.FindS("Maemo-Display-Name");
+   return display;
+}
+                                                                       /*}}}*/
 // RecordParserBase::Homepage - Return the package homepage            /*{{{*/
 string debRecordParserBase::Homepage()
 {
index 7fc82a88d878f06004a92efd0a9c961bf2185a93..8f443c9a33238c5098ec06a4405b80f8fb3d845e 100644 (file)
@@ -44,6 +44,7 @@ class APT_HIDDEN debRecordParserBase : public pkgRecords::Parser
    virtual std::string ShortDesc(std::string const &lang) APT_OVERRIDE;
    virtual std::string LongDesc(std::string const &lang) APT_OVERRIDE;
    virtual std::string Name() APT_OVERRIDE;
+   virtual std::string Display() APT_OVERRIDE;
    virtual std::string Homepage() APT_OVERRIDE;
 
    // An arbitrary custom field
index b1be14bdd3465e344de9a90cd5a002298b94e590..83bf8961def2b2d4afc835dff27e47f5d705575a 100644 (file)
@@ -627,6 +627,8 @@ struct pkgCache::Version
    map_stringitem_t VerStr;
    /** \brief section this version is filled in */
    map_stringitem_t Section;
+   /** \brief high-level name used to display package */
+   map_stringitem_t Display;
    /** \brief source package name this version comes from
       Always contains the name, even if it is the same as the binary name */
    map_stringitem_t SourcePkgName;
index 8da3265c67cfa7d9900a74c3ae27aff26c7f6014..a151fa12335f6827b18f9b3b1897f33afebd0285 100644 (file)
@@ -92,6 +92,7 @@ class pkgRecords::Parser                                              /*{{{*/
    std::string LongDesc() {return LongDesc("");};
 
    virtual std::string Name() {return std::string();};
+   virtual std::string Display() {return std::string();}
    virtual std::string Homepage() {return std::string();}
 
    // An arbitrary custom field