]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/std-string.cc
* flower/include/std-string.hh: Oops, bugfix for --disable-std-string.
[lilypond.git] / flower / std-string.cc
index d457d50655cbe613f7725ec165d4a7e21be2cb7c..e9cd0d9e5cac08eea88ef7a6f8b0200d57ea746a 100644 (file)
@@ -6,11 +6,13 @@
   (c) 2006  Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
-#if STD_STRING
 #include "std-string.hh"
 
+#if STD_STRING
+
 namespace std {
-  Std_string to_std_string (char c, int n)
+  Std_string
+  to_std_string (char c, int n)
   {
     /* FIXME, remove this function and use std::string interface for
        String?  This interface is a bit clumsy, almost alway you want
@@ -19,4 +21,22 @@ namespace std {
   }
 }
 
+#define FIND_FAILED string::npos
+#define SIZE_T size_t
+#else /* !STD_STRING */
+
+#define FIND_FAILED -1
+#define SIZE_T int
+
 #endif /* STD_STRING */
+
+Std_string &
+replace_all (Std_string &str, Std_string find, Std_string replace)
+{
+  int len = find.length ();
+  for (SIZE_T i = str.find (find); i != FIND_FAILED; i = str.find (find,
+                                                                  i + len))
+    str = str.replace (i, len, replace);
+  return str;
+}
+