factor out genSortName, cleanup comment
authorFelix Domke <tmbinc@elitedvb.net>
Wed, 16 Nov 2005 10:22:37 +0000 (10:22 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Wed, 16 Nov 2005 10:22:37 +0000 (10:22 +0000)
lib/dvb/db.cpp
lib/dvb/idvb.h

index e7617fd..3f42da9 100644 (file)
@@ -113,6 +113,18 @@ eDVBService &eDVBService::operator=(const eDVBService &s)
        return *this;
 }
 
        return *this;
 }
 
+void eDVBService::genSortName()
+{
+       m_service_name_sort = removeDVBChars(m_service_name);
+       makeUpper(m_service_name_sort);
+       while ((!m_service_name_sort.empty()) && m_service_name_sort[0] == ' ')
+               m_service_name_sort.erase(0, 1);
+       
+               /* put unnamed services at the end, not at the beginning. */
+       if (m_service_name_sort.empty())
+               m_service_name_sort = "\xFF";
+}
+
 RESULT eDVBService::getName(const eServiceReference &ref, std::string &name)
 {
        if (!ref.name.empty())
 RESULT eDVBService::getName(const eServiceReference &ref, std::string &name)
 {
        if (!ref.name.empty())
@@ -303,15 +315,8 @@ void eDVBDB::load()
                        line[strlen(line)-1]=0;
 
                s->m_service_name = line;
                        line[strlen(line)-1]=0;
 
                s->m_service_name = line;
-               s->m_service_name_sort = removeDVBChars(line);
-               makeUpper(s->m_service_name_sort);
-               while ((!s->m_service_name_sort.empty()) && s->m_service_name_sort[0] == ' ')
-                       s->m_service_name_sort.erase(0, 1);
-               
-                       /* put unnamed services at the end, not at the beginning. */
-               if (s->m_service_name_sort.empty())
-                       s->m_service_name_sort = "\xFF";
-               
+               s->genSortName();
+                
                fgets(line, 256, f);
                if (strlen(line))
                        line[strlen(line)-1]=0;
                fgets(line, 256, f);
                if (strlen(line))
                        line[strlen(line)-1]=0;
index c6cf20e..ad5da21 100644 (file)
@@ -29,7 +29,16 @@ struct eBouquet
        RESULT moveService(const eServiceReference &, unsigned int);
 };
 
        RESULT moveService(const eServiceReference &, unsigned int);
 };
 
-               // bitte KEINE operator int() definieren, sonst bringt das ganze nix!
+               /* these structures have by intention no operator int() defined.
+                  the reason of these structures is to avoid mixing for example
+                  a onid and a tsid (as there's no general order for them).
+                  
+                  defining an operator int() would implicitely convert values
+                  between them over the constructor with the int argument.
+                  
+                  'explicit' doesn't here - eTransportStreamID(eOriginalNetworkID(n)) 
+                  would still work. */
+
 struct eTransportStreamID
 {
 private:
 struct eTransportStreamID
 {
 private:
@@ -198,6 +207,8 @@ public:
        std::string m_service_name, m_service_name_sort;
        std::string m_provider_name;
        
        std::string m_service_name, m_service_name_sort;
        std::string m_provider_name;
        
+       void genSortName();
+       
        int m_flags;
        std::set<int> m_ca;
        std::map<int,int> m_cache;
        int m_flags;
        std::set<int> m_ca;
        std::map<int,int> m_cache;