]> git.donarmstrong.com Git - lilypond.git/blob - flower/std-string.cc
* flower/include/std-string.hh: Oops, bugfix for --disable-std-string.
[lilypond.git] / flower / std-string.cc
1 /*
2   std-tring.cc -- implement external interface for Std_String
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2006  Jan Nieuwenhuizen <janneke@gnu.org>
7 */
8
9 #include "std-string.hh"
10
11 #if STD_STRING
12
13 namespace std {
14   Std_string
15   to_std_string (char c, int n)
16   {
17     /* FIXME, remove this function and use std::string interface for
18        String?  This interface is a bit clumsy, almost alway you want
19        n=1.  */
20     return Std_string (n, c);
21   }
22 }
23
24 #define FIND_FAILED string::npos
25 #define SIZE_T size_t
26 #else /* !STD_STRING */
27
28 #define FIND_FAILED -1
29 #define SIZE_T int
30
31 #endif /* STD_STRING */
32
33 Std_string &
34 replace_all (Std_string &str, Std_string find, Std_string replace)
35 {
36   int len = find.length ();
37   for (SIZE_T i = str.find (find); i != FIND_FAILED; i = str.find (find,
38                                                                    i + len))
39     str = str.replace (i, len, replace);
40   return str;
41 }
42