JASL  [1.2.0]-2018-09-11
jasl_common.hpp
Go to the documentation of this file.
1 // JASL: For more information see https://github.com/matepek/jasl
2 //
3 // Copyright (c) 2018 Mate Pek
4 //
5 // This code is licensed under the MIT License (MIT).
6 
9 #pragma once
10 
11 #include "jasl/jasl_internal/jasl_feature_test_macro.hpp"
12 
13 #define JASL_INNER_STR(x) #x
14 #define JASL_STR(x) JASL_INNER_STR(x)
15 
16 /*
17  * Same as the first item of the CHANGELOG.md file
18  */
19 #define JASL_VERSION_MAJOR 1
20 #define JASL_VERSION_MINOR 2
21 #define JASL_VERSION_PATCH 0
22 #define JASL_VERSION_LABEL ""
23 #define JASL_VERSION_DATE "2018-09-11"
24 
25 static_assert(JASL_VERSION_MAJOR < 100, "JASL_VERSION error");
26 static_assert(JASL_VERSION_MINOR < 100, "JASL_VERSION error");
27 static_assert(JASL_VERSION_PATCH < 1000, "JASL_VERSION error");
28 
29 #define JASL_VERSION_STR \
30  JASL_STR(JASL_VERSION_MAJOR) \
31  "." JASL_STR(JASL_VERSION_MINOR) "." JASL_STR(JASL_VERSION_PATCH) \
32  JASL_VERSION_LABEL " (" JASL_VERSION_DATE ")"
33 
34 #ifdef JASL_TERMINATE_ON_EXCEPTION_ON
35 # include <exception>
36 # define JASL_THROW(exception) ::std::terminate()
37 #else
38 # define JASL_THROW(exception) throw(exception)
39 #endif
40 
41 #if defined(JASL_ASSERT_ON) && JASL_cpp_constexpr >= 201304L
42 # include <cstdlib>
43 # include <iostream>
44 # define JASL_ASSERT(expr, message) \
45  do { \
46  if (!(expr)) { \
47  ::std::cerr << __FILE__ << '(' << __LINE__ << "): " << message; \
48  ::std::terminate(); \
49  } \
50  } while (false)
51 #else
52 # define JASL_ASSERT(...)
53 #endif
54 
55 #if defined(JASL_TESTIFY_STD_STRING_VIEW_EXISTS)
56 # if !defined(JASL_cpp_lib_string_view)
57 # define JASL_cpp_lib_string_view 201606L
58 # include <string_view>
59 # endif
60 #endif
61 
62 /*
63  * This part is only for documentation puposes.
64  */
65 #ifdef JASL_INNER_DOXYGEN_DOCUMENTATION
66 # error "Should not be defined!"
67 
81 # define JASL_USE_JASL_STRING_VIEW_AS_BASE
82 
97 # define JASL_USE_STD_STRING_VIEW_AS_BASE
98 
103 # define JASL_SUPPORT_STD_TO_JASL
104 
109 # define JASL_SUPPORT_JASL_TO_STD
110 
121 # define JASL_TERMINATE_ON_EXCEPTION_ON
122 
127 # define JASL_ASSERT_ON
128 
138 # define JASL_TESTIFY_STD_STRING_VIEW_EXISTS
139 
144 # define JASL_DISABLE_JASL_STRING_VIEW_HASH
145 
151 # define JASL_FORCE_USE_MURMURHASH_HASH
152 
153 #endif // JASL_DOXYGEN_DOCUMENTATION