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_NO_RETURN
113
/// \brief Mark that a given function will never return control to the caller, either by exiting or throwing an
114
/// exception.
115
#ifndef JSONV_NO_RETURN
116
# define JSONV_NO_RETURN [[noreturn]]
117
#endif
118
119
/// \def JSONV_ALWAYS_INLINE
120
/// \brief Always inline the function this decorates, no matter what the compiler might think is best.
121
#ifndef JSONV_ALWAYS_INLINE
122
# if defined(__GNUC__)
123
# define JSONV_ALWAYS_INLINE __attribute__((always_inline))
124
# else
125
# define JSONV_ALWAYS_INLINE
126
# endif
127
#endif
128
129
/// \def JSONV_INTEGER_ALTERNATES_LIST
130
/// \brief An item list of types to also consider as an integer.
131
/// This mostly exists to help resolve the C-induced type ambiguity for the literal \c 0. It most prefers to be an
132
/// \c int, but might also become a \c long or a pointer type.
133
#ifndef JSONV_INTEGER_ALTERNATES_LIST
134
# define JSONV_INTEGER_ALTERNATES_LIST(item) \
135
item(int) \
136
item(unsigned int) \
137
item(unsigned long) \
138
item(unsigned long long)
139
#endif
140
141
/// \def JSONV_LIKELY
142
/// Mark that a section of code is likely to be reached.
143
///
144
/// \see JSONV_UNLIKELY
145
#ifndef JSONV_LIKELY
146
# define JSONV_LIKELY [[likely]]
147
#endif
148
149
/// \def JSONV_UNLIKELY
150
/// Mark that a section of code is not likely to be reached.
151
///
152
/// \see JSONV_LIKELY
153
#ifndef JSONV_UNLIKELY
154
# define JSONV_UNLIKELY [[unlikely]]
155
#endif
156
157
/// \}
jsonv
config.hpp
Generated by
1.9.8