cb21075d |
1 | // Utils.H -*- C++ -*- |
2 | // Copyright (c) 1997, 1998 Etienne BERNARD |
a6339323 |
3 | // Copyright (c) 2002,2005 Clinton Ebadi |
cb21075d |
4 | |
5 | // This program is free software; you can redistribute it and/or modify |
6 | // it under the terms of the GNU General Public License as published by |
7 | // the Free Software Foundation; either version 2 of the License, or |
8 | // any later version. |
9 | |
10 | // This program is distributed in the hope that it will be useful, |
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | // GNU General Public License for more details. |
14 | |
15 | // You should have received a copy of the GNU General Public License |
16 | // along with this program; if not, write to the Free Software |
17 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. |
18 | |
19 | #ifndef UTILS_H |
20 | #define UTILS_H |
21 | |
22 | #ifndef HAVE_CONFIG_H |
23 | #include "config.h" |
24 | #endif |
25 | |
26 | #include <ctime> |
a6339323 |
27 | #include <string> |
28 | |
cb21075d |
29 | #include "Bot.H" |
30 | |
31 | #ifdef USESCRIPTS |
32 | #include <libguile.h> |
33 | #endif |
34 | |
35 | class Utils { |
36 | public: |
a6339323 |
37 | static std::string get_nick (std::string); |
38 | static std::string get_userhost (std::string); |
39 | static std::string get_key(); |
40 | |
41 | static int get_level (Bot *, std::string); |
42 | static int get_level (Bot *, std::string, std::string); |
43 | |
44 | static std::string make_wildcard (std::string); |
45 | |
46 | // predicates |
47 | static bool channel_p (std::string); |
48 | static bool wildcard_p (std::string); |
49 | static bool valid_channel_name_p (std::string); |
50 | static bool valid_nickname_p (std::string); |
51 | static bool IP_p (std::string); |
cb21075d |
52 | |
a6339323 |
53 | static std::string level2str (int); |
54 | static std::string prot2str (int); |
55 | static std::string bool2str (bool); |
56 | static std::string long2str (long); |
cb21075d |
57 | |
a6339323 |
58 | static std::time_t str2time(std::string); |
cb21075d |
59 | |
a6339323 |
60 | // string case conversion |
61 | static std::string to_lower (std::string); |
62 | static std::string to_upper (std::string); |
cb21075d |
63 | |
a6339323 |
64 | static std::string trim_str (std::string); |
cb21075d |
65 | |
66 | #ifdef USESCRIPTS |
a6339323 |
67 | static std::string scm2str (SCM); |
68 | static SCM str2scm (std::string); |
cb21075d |
69 | #endif |
70 | }; |
71 | |
72 | #endif |