Changeset View
Changeset View
Standalone View
Standalone View
src/tinyformat.h
Show First 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | |||||
namespace tinyformat {} | namespace tinyformat {} | ||||
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ | ||||
// Config section. Customize to your liking! | // Config section. Customize to your liking! | ||||
// Namespace alias to encourage brevity | // Namespace alias to encourage brevity | ||||
namespace tfm = tinyformat; | namespace tfm = tinyformat; | ||||
// Error handling; calls assert() by default. | // Error handling; calls assert() by default. | ||||
#define TINYFORMAT_ERROR(reasonString) throw std::runtime_error(reasonString) | #define TINYFORMAT_ERROR(reasonString) \ | ||||
throw tinyformat::format_error(reasonString) | |||||
// Define for C++11 variadic templates which make the code shorter & more | // Define for C++11 variadic templates which make the code shorter & more | ||||
// general. If you don't define this, C++11 support is autodetected below. | // general. If you don't define this, C++11 support is autodetected below. | ||||
#define TINYFORMAT_USE_VARIADIC_TEMPLATES | #define TINYFORMAT_USE_VARIADIC_TEMPLATES | ||||
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ | ||||
// Implementation details. | // Implementation details. | ||||
#include <algorithm> | #include <algorithm> | ||||
Show All 24 Lines | |||||
// visibilities for static libs vs executables (see issue #25) | // visibilities for static libs vs executables (see issue #25) | ||||
#define TINYFORMAT_HIDDEN __attribute__((visibility("hidden"))) | #define TINYFORMAT_HIDDEN __attribute__((visibility("hidden"))) | ||||
#else | #else | ||||
#define TINYFORMAT_HIDDEN | #define TINYFORMAT_HIDDEN | ||||
#endif | #endif | ||||
namespace tinyformat { | namespace tinyformat { | ||||
class format_error : public std::runtime_error { | |||||
public: | |||||
format_error(const std::string &what) : std::runtime_error(what) {} | |||||
}; | |||||
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ | ||||
namespace detail { | namespace detail { | ||||
// Test whether type T1 is convertible to type T2 | // Test whether type T1 is convertible to type T2 | ||||
template <typename T1, typename T2> struct is_convertible { | template <typename T1, typename T2> struct is_convertible { | ||||
private: | private: | ||||
// two types of different size | // two types of different size | ||||
struct fail { | struct fail { | ||||
▲ Show 20 Lines • Show All 910 Lines • Show Last 20 Lines |