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")))
25
28#include <string>
29#include <vector>
30#include <memory>
31#include <stdexcept>
32
34namespace cupt {
35
36CUPT_API extern const char* const libraryVersion;
37
38using std::vector;
39using std::string;
40
42
45class 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
66using std::pair;
67
68using std::shared_ptr;
69using std::static_pointer_cast;
70using std::dynamic_pointer_cast;
71using std::unique_ptr;
72
74
78CUPT_API extern int messageFd;
79
81CUPT_API string join(const string& joiner, const vector< string >& parts);
82CUPT_API string humanReadableSizeString(uint64_t bytes);
83CUPT_API string globToRegexString(const string&);
85
87
91CUPT_API const char* __(const char* message);
92
93} // namespace
94
95#include <cupt/format2.hpp>
96
97#endif
98
general library exception class
Definition: common.hpp:46
Exception(const char *message)
constructor
Definition: common.hpp:54
Exception(const string &message)
constructor
Definition: common.hpp:61
const char *const libraryVersion
the version of Cupt library
const char * __(const char *message)
localizes message