Debian Codegraph @

src/common/xstring.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2000,2001 Onlyer ([email protected])
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18 #ifndef INCLUDED_XSTRING_H
19 #define INCLUDED_XSTRING_H
20
21
22 #include <string>
23 #include <sstream>
24 #include <vector>
25
26 namespace pvpgn
27 {
28
29 extern char * strtolower(char * str);
30 extern char * hexstrdup(unsigned char const * src);
31 extern unsigned int hexstrtoraw(unsigned char const * src, char * data, unsigned int datalen);
32 extern unsigned char xtoi(unsigned char ch);
33 extern char * * strtoargv(char const * str, unsigned int * count);
34 extern char * arraytostr(char * * array, char const * delim, int count);
35 extern char * str_strip_affix(char * str, char const * affix);
36 extern char *str_replace(char *orig, char *rep, char *with);
37 extern std::string str_replace_nl(char const * text);
38 extern bool find_substr(char * input, const char * find);
39
40 #define safe_toupper(X) (std::islower((unsigned char)X)?std::toupper((unsigned char)X):(X))
41 #define safe_tolower(X) (std::isupper((unsigned char)X)?std::tolower((unsigned char)X):(X))
42
43 /*
44 Fix for std::string for some unix compilers
45 http://stackoverflow.com/a/20861692/701779
46 */
47 template < typename T > std::string std_to_string(const T& n)
48 {
49 std::ostringstream stm;
50 stm << n;
51 return stm.str();
52 }
53 }
54
55 #endif