presage  0.9.2~beta
utility.h
Go to the documentation of this file.
1 
2 /******************************************************
3  * Presage, an extensible predictive text entry system
4  * ---------------------------------------------------
5  *
6  * Copyright (C) 2008 Matteo Vescovi <matteo.vescovi@yahoo.co.uk>
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License along
19  with this program; if not, write to the Free Software Foundation, Inc.,
20  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  *
22  **********(*)*/
23 
24 
25 #ifndef PRESAGE_UTILITY
26 #define PRESAGE_UTILITY
27 
28 #ifdef HAVE_CONFIG_H
29 # include "config.h"
30 #endif
31 
32 #include <string> // overload strtolower function
33 
34 class Utility {
35 
36 public:
37  static char* strtolower( char* );
38  static std::string& strtolower( std::string& );
39  static std::string strtolower( const std::string& );
40 
41  static std::string strtoupper( const std::string& );
42 
43  static bool isTrueFalse( const char* );
44  static bool isTrueFalse( const std::string& );
45 
46  static bool isTrue( const char* );
47  static bool isTrue( const std::string& );
48 
49  static bool isFalse( const char* );
50  static bool isFalse( const std::string& );
51 
52  static bool isYesNo( const char* );
53  static bool isYesNo( const std::string& );
54 
55  static bool isYes( const char* );
56  static bool isYes( const std::string& );
57 
58  static bool isNo( const char* );
59  static bool isNo( const std::string& );
60 
61  static double toDouble(const std::string);
62  static int toInt (const std::string);
63 
64  static std::string dirname (const std::string&);
65  static std::string filename (const std::string&);
66 
67  static bool is_directory_usable (const std::string& dir);
68  static void create_directory (const std::string& dir);
69 
70 };
71 
72 #endif // PRESAGE_UTILITY
static int toInt(const std::string)
Definition: utility.cpp:266
static std::string strtoupper(const std::string &)
Definition: utility.cpp:82
static bool isYesNo(const char *)
Definition: utility.cpp:176
static void create_directory(const std::string &dir)
Definition: utility.cpp:330
static double toDouble(const std::string)
Definition: utility.cpp:258
static char * strtolower(char *)
Definition: utility.cpp:42
static bool isFalse(const char *)
Definition: utility.cpp:128
static bool isNo(const char *)
Definition: utility.cpp:208
static bool isYes(const char *)
Definition: utility.cpp:185
static bool isTrueFalse(const char *)
Definition: utility.cpp:97
static bool isTrue(const char *)
Definition: utility.cpp:107
static std::string dirname(const std::string &)
Definition: utility.cpp:275
static std::string filename(const std::string &)
Definition: utility.cpp:291
static bool is_directory_usable(const std::string &dir)
Definition: utility.cpp:307