X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=flower%2Finclude%2Fstd-string.hh;h=ea65fe042e52b5402c125313deaf5357a3243c84;hb=47db9a3883d726ca53e2133a3b2298f78dd6a32e;hp=6c83bc526fb923e473128e96d318f0fceb0660a4;hpb=b37e3f652677ae0298423db9fa0e552e5fce0c92;p=lilypond.git diff --git a/flower/include/std-string.hh b/flower/include/std-string.hh index 6c83bc526f..ea65fe042e 100644 --- a/flower/include/std-string.hh +++ b/flower/include/std-string.hh @@ -1,71 +1,62 @@ /* - std-string.hh -- declare std::string + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter + Copyright (C) 2006--2015 Jan Nieuwenhuizen - (c) 2006 Jan Nieuwenhuizen + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . */ #ifndef STD_STRING_HH #define STD_STRING_HH -#if !STD_STRING - -/* Also declare string, in the wrong way. */ -#include -#include -#include - -#endif - - - #include "compare.hh" +#include "flower-proto.hh" -#if STD_STRING -#include +#if 0 +/* + leads to dubious crashes - libstdc++ bug? + */ +#ifndef NDEBUG +#define _GLIBCXX_DEBUG 1 +#endif #endif -#if STD_STRING - -namespace std { - - typedef size_t ssize; -#define NPOS std::string::npos - // typedef string std::string; -} - -#else /* ! STD_STRING */ +#include -namespace std { +using namespace std; -#define string String - using namespace std; - class String; - typedef int ssize; -#define NPOS -1 -} +typedef size_t ssize; +#define NPOS string::npos -#include "string.hh" +string to_string (const string&); +string to_string (char c, int n = 1); +string to_string (int i, char const *format = 0); +string to_string (double f, char const *format = 0); +string to_string (long); +string to_string (long unsigned); +string to_string (I64, char const *format = 0); +string to_string (unsigned); +string to_string (bool b); +string to_string (char const *format, ...) +__attribute__ ((format (printf, 1, 2))); -#endif /* STD_STRING */ +string &replace_all (string *str, string const &find, string const &replace); +string &replace_all (string *str, char find, char replace); +char *string_copy (const string &s); -namespace std { +int string_compare (string const &, string const &); - std::string to_string (std::string s); - std::string to_string (char c, int n = 1); - std::string to_string (int i, char const *format = 0); - std::string to_string (double f, char const *format = 0); - std::string to_string (long b); - std::string to_string (bool b); - std::string to_string (char const *format, ...); - - std::string &replace_all (std::string &str, std::string find, std::string replace); - std::string &replace_all (std::string &str, char find, char replace); - char *string_copy (std::string s); - - int string_compare (std::string const &, std::string const &); - INSTANTIATE_COMPARE (std::string const &, string_compare); -} +INSTANTIATE_COMPARE (string const &, string_compare); #endif /* STD_STRING_HH */