JSON Voorhees
Killer JSON for C++
Loading...
Searching...
No Matches
config.hpp
Go to the documentation of this file.
1
/// \file jsonv/config.hpp
2
///
3
/// Copyright (c) 2014-2020 by Travis Gockel. All rights reserved.
4
///
5
/// This program is free software: you can redistribute it and/or modify it under the terms of the Apache License
6
/// as published by the Apache Software Foundation, either version 2 of the License, or (at your option) any later
7
/// version.
8
///
9
/// \author Travis Gockel (travis@gockelhut.com)
10
#pragma once
11
12
/// \ingroup Configuration
13
/// \{
14
15
/// \def JSONV_USER_CONFIG
16
/// A user-defined configuration file to be included before all other JSON Voorhees content.
17
#ifdef JSONV_USER_CONFIG
18
# include JSONV_USER_CONFIG
19
#endif
20
21
#define JSONV_VERSION_MAJOR 2
22
#define JSONV_VERSION_MINOR 0
23
#define JSONV_VERSION_PATCH 0
24
25
/// \def JSONV_VERSION
26
#define JSONV_VERSION (JSONV_VERSION_MAJOR * 1000000 + JSONV_VERSION_MINOR * 1000 + JSONV_VERSION_PATCH)
27
28
/// \def JSONV_DEBUG
29
/// \brief Was JSON Voorhees compiled in debug mode?
30
/// This value must be the same between when the SO was built and when you are compiling. In general, this is not useful
31
/// outside of library maintainers.
32
///
33
/// \warning
34
/// Keep in mind this value is \e always defined. Use `#if JSONV_DEBUG`, \e not `#ifdef JSONV_DEBUG`.
35
#ifndef JSONV_DEBUG
36
# define JSONV_DEBUG 0
37
#endif
38
39
/// \def JSONV_SO
40
/// \brief Are you using shared objects (DLLs in Windows)?
41
#ifndef JSONV_SO
42
# define JSONV_SO 1
43
#endif
44
45
/// \def JSONV_COMPILING
46
/// \brief Is JSON Voorhees currently compiling?
47
/// You do not want to set this by hand. It is set by the build system when the library is compiled.
48
#ifndef JSONV_COMPILING
49
# ifdef jsonv_EXPORTS
50
# define JSONV_COMPILING 1
51
# else
52
# define JSONV_COMPILING 0
53
# endif
54
#endif
55
56
/// \def JSONV_EXPORT
57
/// If using shared objects, this class or function should be exported.
58
///
59
/// \def JSONV_IMPORT
60
/// If using shared objects, this class or function should be imported.
61
///
62
/// \def JSONV_HIDDEN
63
/// This symbol is only visible within the same shared object in which the translation unit will end up. Symbols which
64
/// are "hidden" will \e not be put into the global offset table, which means code can be more optimal when it involves
65
/// hidden symbols at the cost that nothing outside of the SO can access it.
66
#if JSONV_SO
67
# if defined(__GNUC__)
68
# define JSONV_EXPORT __attribute__((visibility("default")))
69
# define JSONV_IMPORT
70
# define JSONV_HIDDEN __attribute__((visibility("hidden")))
71
# elif defined(_MSC_VER)
72
# if defined(_LIB)
73
# define JSONV_EXPORT
74
# define JSONV_IMPORT
75
# define JSONV_HIDDEN
76
# else
77
# define JSONV_EXPORT __declspec(dllexport)
78
# define JSONV_IMPORT __declspec(dllimport)
79
# define JSONV_HIDDEN
80
# endif
81
# else
82
# error "Unknown shared object semantics for this compiler."
83
# endif
84
#else
85
# define JSONV_EXPORT
86
# define JSONV_IMPORT
87
# define JSONV_HIDDEN
88
#endif
89
90
/// \def JSONV_PUBLIC
91
/// \brief This function or class is part of the public API for JSON Voorhees.
92
/// If you are including JsonVoorhees for another library, this will have import semantics (\c JSONV_IMPORT); if you are
93
/// building JsonVoorhees, this will have export semantics (\c JSONV_EXPORT).
94
///
95
/// \def JSONV_LOCAL
96
/// \brief This function or class is internal-use only.
97
/// \see JSONV_HIDDEN
98
#if JSONV_COMPILING
99
# define JSONV_PUBLIC JSONV_EXPORT
100
# define JSONV_LOCAL JSONV_HIDDEN
101
#else
102
# define JSONV_PUBLIC JSONV_IMPORT
103
# define JSONV_LOCAL JSONV_HIDDEN
104
#endif
105
106
/// \def JSONV_UNUSED
107
/// \brief Note that you know the variable is unused, but make the compiler stop complaining about it.
108
#ifndef JSONV_UNUSED
109
# define JSONV_UNUSED [[maybe_unused]]
110
#endif
111
112
/// \def JSONV_NODISCARD
113
/// \brief Warn if the caller discards the result of this function.
114
/// This decorates the side-effect-free parts of the API, where dropping the result means the call did nothing at all.
115
///
116
/// The guard checks \c JSONV_DOXYGEN as well as the usual \c ifndef because \c config/Doxyfile predefines this macro
117
/// as empty to keep it out of the rendered signatures. That also hides this \c define from Doxygen, which then warns
118
/// about documentation for a macro it never saw; re-entering the block for Doxygen alone keeps the two consistent. No
119
/// compiler defines \c JSONV_DOXYGEN, so everywhere else this is exactly the \c ifndef its siblings use.
120
#if defined(JSONV_DOXYGEN) || !defined(JSONV_NODISCARD)
121
# define JSONV_NODISCARD [[nodiscard]]
122
#endif
123
124
/// \def JSONV_NO_RETURN
125
/// \brief Mark that a given function will never return control to the caller, either by exiting or throwing an
126
/// exception.
127
#ifndef JSONV_NO_RETURN
128
# define JSONV_NO_RETURN [[noreturn]]
129
#endif
130
131
/// \def JSONV_ALWAYS_INLINE
132
/// \brief Always inline the function this decorates, no matter what the compiler might think is best.
133
#ifndef JSONV_ALWAYS_INLINE
134
# if defined(__GNUC__)
135
# define JSONV_ALWAYS_INLINE __attribute__((always_inline))
136
# else
137
# define JSONV_ALWAYS_INLINE
138
# endif
139
#endif
140
141
/// \def JSONV_INTEGER_ALTERNATES_LIST
142
/// \brief An item list of types to also consider as an integer.
143
/// This mostly exists to help resolve the C-induced type ambiguity for the literal \c 0. It most prefers to be an
144
/// \c int, but might also become a \c long or a pointer type.
145
#ifndef JSONV_INTEGER_ALTERNATES_LIST
146
# define JSONV_INTEGER_ALTERNATES_LIST(item) \
147
item(int) \
148
item(unsigned int) \
149
item(unsigned long) \
150
item(unsigned long long)
151
#endif
152
153
/// \def JSONV_LIKELY
154
/// Mark that a section of code is likely to be reached.
155
///
156
/// \see JSONV_UNLIKELY
157
#ifndef JSONV_LIKELY
158
# define JSONV_LIKELY [[likely]]
159
#endif
160
161
/// \def JSONV_UNLIKELY
162
/// Mark that a section of code is not likely to be reached.
163
///
164
/// \see JSONV_LIKELY
165
#ifndef JSONV_UNLIKELY
166
# define JSONV_UNLIKELY [[unlikely]]
167
#endif
168
169
/// \}
jsonv
config.hpp
Generated by
1.9.8