move replace_all function to base/string.h
authorghost <andreas.monzner@multimedia-labs.de>
Mon, 16 Feb 2009 23:35:44 +0000 (00:35 +0100)
committerghost <andreas.monzner@multimedia-labs.de>
Mon, 16 Feb 2009 23:35:44 +0000 (00:35 +0100)
lib/base/estring.cpp
lib/base/estring.h
lib/gui/esubtitle.cpp
lib/gui/esubtitle.h

index 5d15ddc..f1d50cc 100644 (file)
@@ -633,3 +633,12 @@ void makeUpper(std::string &s)
 {
        std::transform(s.begin(), s.end(), s.begin(), (int(*)(int)) toupper);
 }
+
+std::string replace_all(const std::string &in, const std::string &entity, const std::string &symbol)
+{
+       std::string out = in;
+       std::string::size_type loc = 0;
+       while (( loc = out.find(entity, loc)) != std::string::npos )
+       out.replace(loc, entity.length(), symbol);
+       return out;
+}
index 68e0970..d61489e 100644 (file)
@@ -18,6 +18,7 @@ int isUTF8(const std::string &string);
 
 std::string removeDVBChars(const std::string &s);
 void makeUpper(std::string &s);
+std::string replace_all(const std::string &in, const std::string &entity, const std::string &symbol);
 
 inline std::string convertDVBUTF8(const std::string &string, int table=0, int tsidonid=0) // with default ISO8859-1/Latin1
 {
index 085a749..ca5c20d 100644 (file)
@@ -114,15 +114,6 @@ void eSubtitleWidget::setPixmap(ePtr<gPixmap> &pixmap, gRegion changed)
        invalidate(changed);
 }
 
-std::string eSubtitleWidget::replace_all(const std::string &in, const std::string &entity, const std::string &symbol)
-{
-       std::string out = in;
-       std::string::size_type loc = 0;
-       while (( loc = out.find(entity, loc)) != std::string::npos )
-       out.replace(loc, entity.length(), symbol);
-       return out;
-}
-
 int eSubtitleWidget::event(int event, void *data, void *data2)
 {
        switch (event)
index 1635e6d..c88df0e 100644 (file)
@@ -58,7 +58,6 @@ private:
        gRegion m_visible_region;
 
        ePtr<gPixmap> m_pixmap;  // pixmap to paint on next evtPaint
-       std::string replace_all(const std::string &in, const std::string &entity, const std::string &symbol);
 };
 
 #endif