Cupt
common.hpp
Go to the documentation of this file.
1 /**************************************************************************
2 * Copyright (C) 2010-2014 by Eugene V. Lyubimkin *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License *
6 * (version 3 or above) as published by the Free Software Foundation. *
7 * *
8 * This program is distributed in the hope that it will be useful, *
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
11 * GNU General Public License for more details. *
12 * *
13 * You should have received a copy of the GNU GPL *
14 * along with this program; if not, write to the *
15 * Free Software Foundation, Inc., *
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA *
17 **************************************************************************/
18 #ifndef CUPT_COMMON_SEEN
19 #define CUPT_COMMON_SEEN
20 
22 #define CUPT_API __attribute__ ((visibility("default")))
23 #define CUPT_LOCAL __attribute__ ((visibility("hidden")))
24 
28 #include <string>
29 #include <vector>
30 #include <memory>
31 #include <stdexcept>
32 
34 namespace cupt {
35 
36 CUPT_API extern const char* const libraryVersion;
37 
38 using std::vector;
39 using std::string;
40 
42 
45 class CUPT_API Exception: public std::runtime_error
46 {
47  public:
49 
54  Exception(const char* message)
55  : std::runtime_error(message)
56  {}
58 
61  Exception(const string& message)
62  : std::runtime_error(message)
63  {}
64 };
65 
66 using std::pair;
67 
68 using std::shared_ptr;
69 using std::static_pointer_cast;
70 using std::dynamic_pointer_cast;
71 using std::unique_ptr;
72 
74 
78 CUPT_API extern int messageFd;
79 
81 CUPT_API string join(const string& joiner, const vector< string >& parts);
82 CUPT_API string humanReadableSizeString(uint64_t bytes);
83 CUPT_API string globToRegexString(const string&);
85 
87 
91 CUPT_API const char* __(const char* message);
92 
93 } // namespace
94 
95 #include <cupt/format2.hpp>
96 
97 #endif
98 
cupt::Exception::Exception
Exception(const string &message)
constructor
Definition: common.hpp:61
cupt::libraryVersion
const char *const libraryVersion
the version of Cupt library
cupt::Exception::Exception
Exception(const char *message)
constructor
Definition: common.hpp:54
cupt::Exception
general library exception class
Definition: common.hpp:45