DABC (Data Acquisition Backbone Core)  2.9.9
string.h
Go to the documentation of this file.
1 // $Id: string.h 3862 2018-05-11 10:06:18Z linev $
2 
3 /************************************************************
4  * The Data Acquisition Backbone Core (DABC) *
5  ************************************************************
6  * Copyright (C) 2009 - *
7  * GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
8  * Planckstr. 1, 64291 Darmstadt, Germany *
9  * Contact: http://dabc.gsi.de *
10  ************************************************************
11  * This software can be used under the GPL license *
12  * agreements as stated in LICENSE.txt file *
13  * which is part of the distribution. *
14  ************************************************************/
15 
16 #ifndef DABC_string
17 #define DABC_string
18 
19 #include <string>
20 
21 namespace dabc {
22 
23  extern std::string format(const char *fmt, ...);
24  extern void formats(std::string& sbuf, const char *fmt, ...);
25 
32  extern std::string size_to_str(unsigned long sz, int prec = 1, int select = 0);
33 
40  extern std::string number_to_str(unsigned long num, int prec = 1, int select = 0);
41 
46  extern bool str_to_int(const char* val, int* res);
47 
52  extern bool str_to_lint(const char* val, long* res);
53 
59  extern bool str_to_uint(const char* val, unsigned* res);
60 
66  extern bool str_to_luint(const char* val, long unsigned* res);
67 
72  extern bool str_to_double(const char* val, double* res);
73 
78  extern bool str_to_bool(const char* val, bool* res);
79 
85  extern std::string replace_all(const std::string &str, const std::string &match, const std::string &replace);
86 
87 
88  class NumericLocale {
89  protected:
90  std::string fPrev;
91  public:
92  NumericLocale();
94  };
95 
96 };
97 
98 #endif
std::string fPrev
Definition: string.h:90
Event manipulation API.
Definition: api.h:23
std::string replace_all(const std::string &str, const std::string &match, const std::string &replace)
Replace all matches in the string.
Definition: string.cxx:237
bool str_to_uint(const char *val, unsigned *res)
Convert string to unsigned integer value One could use hexadecimal (in form 0xabc100) or decimal form...
Definition: string.cxx:184
void formats(std::string &sbuf, const char *fmt,...)
Definition: string.cxx:26
bool str_to_double(const char *val, double *res)
Convert string to double value.
Definition: string.cxx:216
std::string format(const char *fmt,...)
Definition: string.cxx:49
std::string size_to_str(unsigned long sz, int prec=1, int select=0)
Convert size to string of form like 4.2 GB or 3.7 MB.
Definition: string.cxx:75
std::string number_to_str(unsigned long num, int prec=1, int select=0)
Convert number to string of form like 4.2G or 3.7M.
Definition: string.cxx:107
bool str_to_lint(const char *val, long *res)
Convert string to long integer value.
Definition: string.cxx:162
bool str_to_luint(const char *val, long unsigned *res)
Convert string to long unsigned integer value One could use hexadecimal (in form 0xabc100) or decimal...
Definition: string.cxx:200
bool str_to_bool(const char *val, bool *res)
Convert string to bool value.
Definition: string.cxx:229
bool str_to_int(const char *val, int *res)
Convert string to integer value.
Definition: string.cxx:142