[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/graphics/digikam/utilities/manualrename/parsers
From:       Andi Clemens <andi.clemens () gmx ! net>
Date:       2009-09-02 9:38:45
Message-ID: 1251884325.936678.22329.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1018848 by aclemens:

Remove old code: firstLetterUppercase() method doesn't belong in the
base parser class, move it to FilenameParser.

Also make the method static, if we ever need it in some other parser
code.

 M  +21 -0     filenameparser.cpp  
 M  +10 -1     filenameparser.h  
 M  +0 -21     parser.cpp  
 M  +0 -11     parser.h  


--- trunk/extragear/graphics/digikam/utilities/manualrename/parsers/filenameparser.cpp #1018847:1018848
@@ -83,5 +83,26 @@
     parseString.replace(QString('%'), markResult(baseFileName.toLower()));
 }
 
+QString FilenameParser::firstLetterUppercase(const QString& str)
+{
+    if (str.isEmpty())
+        return str;
+
+    QString tmp = str.toLower();
+
+    if( tmp[0].isLetter() )
+        tmp[0] = tmp[0].toUpper();
+
+    for( int i = 0; i < tmp.length(); ++i )
+    {
+        if( tmp[i+1].isLetter() && !tmp[i].isLetter() &&
+                tmp[i] != '\'' && tmp[i] != '?' && tmp[i] != '`' )
+        {
+            tmp[i+1] = tmp[i+1].toUpper();
+        }
+    }
+    return tmp;
+}
+
 } // namespace ManualRename
 } // namespace Digikam
--- trunk/extragear/graphics/digikam/utilities/manualrename/parsers/filenameparser.h #1018847:1018848
@@ -48,7 +48,16 @@
 
     void parse(QString& parseString, const ParseInformation& info);
 
-
+    /**
+     * This helper method converts the string into a "first letter uppercase" version, for example
+     * "my_new_filename001.jpg"
+     * will become
+     * "My_New_Filename001.jpg"
+     *
+     * @param str the string to be converted into an "first letter uppercase" version
+     * @return the converted string
+     */
+    static QString firstLetterUppercase(const QString& str);
 };
 
 } // namespace ManualRename
--- trunk/extragear/graphics/digikam/utilities/manualrename/parsers/parser.cpp #1018847:1018848
@@ -188,27 +188,6 @@
     return true;
 }
 
-QString Parser::firstLetterUppercase(const QString& str)
-{
-    if (str.isEmpty())
-        return str;
-
-    QString tmp = str.toLower();
-
-    if( tmp[0].isLetter() )
-        tmp[0] = tmp[0].toUpper();
-
-    for( int i = 0; i < tmp.length(); ++i )
-    {
-        if( tmp[i+1].isLetter() && !tmp[i].isLetter() &&
-                tmp[i] != '\'' && tmp[i] != '?' && tmp[i] != '`' )
-        {
-            tmp[i+1] = tmp[i+1].toUpper();
-        }
-    }
-    return tmp;
-}
-
 QString Parser::markResult(const QString& result)
 {
     if (result.isEmpty())
--- trunk/extragear/graphics/digikam/utilities/manualrename/parsers/parser.h #1018847:1018848
@@ -176,17 +176,6 @@
      */
     QString markResult(const QString& result);
 
-    /**
-     * This helper method converts the string into a "first letter uppercase" version, for example
-     * "my_new_filename001.jpg"
-     * will become
-     * "My_New_Filename001.jpg"
-     *
-     * @param str the string to be converted into an "first letter uppercase" version
-     * @return the converted string
-     */
-    QString firstLetterUppercase(const QString& str);
-
 protected Q_SLOTS:
 
     virtual void slotTokenTriggered(const QString&);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic