OnixS C++ ICE Binary Order Entry Handler 1.1.1
API Documentation
Loading...
Searching...
No Matches
Tools.h
Go to the documentation of this file.
1/*
2 * Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3 *
4 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
5 * and international copyright treaties.
6 *
7 * Access to and use of the software is governed by the terms of the applicable OnixS Software
8 * Services Agreement (the Agreement) and Customer end user license agreements granting
9 * a non-assignable, non-transferable and non-exclusive license to use the software
10 * for it's own data processing purposes under the terms defined in the Agreement.
11 *
12 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13 * of this source code or associated reference material to any other location for further reproduction
14 * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15 *
16 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17 * the terms of the Agreement is a violation of copyright law.
18 */
19#pragma once
20
21#include <OnixS/ICE/BOE/ABI.h>
23
24#include <string>
25
27namespace Utils {
28
29#if defined(__clang__)
30# define ONIXS_ICEBOE_COMPILER_INFO ("clang " __clang_version__ ", std=" ONIXS_ICEBOE_TO_STR(__cplusplus))
31#elif defined(_MSC_VER)
32# if defined(_MSVC_LANG)
33# define ONIXS_ICEBOE_COMPILER_STD ONIXS_ICEBOE_TO_STR(_MSVC_LANG)
34# else
35# define ONIXS_ICEBOE_COMPILER_STD ONIXS_ICEBOE_TO_STR(__cplusplus)
36# endif
37# define ONIXS_ICEBOE_COMPILER_INFO ("msvc _MSC_VER=" ONIXS_ICEBOE_TO_STR(_MSC_VER) ", std=" ONIXS_ICEBOE_COMPILER_STD)
38#elif defined(__GNUC__)
39# define ONIXS_ICEBOE_COMPILER_INFO ("gcc " __VERSION__ ", std=" ONIXS_ICEBOE_TO_STR(__cplusplus))
40#else
41# define ONIXS_ICEBOE_COMPILER_INFO ("Unknown")
42#endif
43
44#if defined(ONIXS_ICEBOE_DEBUG_BUILD)
45// Library build: CMake explicitly tells us what "debug" means for this binary.
46# define ONIXS_ICEBOE_DEBUG (ONIXS_ICEBOE_DEBUG_BUILD)
47#elif defined(NDEBUG)
48// Consumer build fallback: NDEBUG means release-like.
49# define ONIXS_ICEBOE_DEBUG 0
50#else
51# define ONIXS_ICEBOE_DEBUG 1
52#endif
53
56{
57public:
59 const char* compilerInfo() const noexcept
60 {
61 return compilerInfo_;
62 }
63
65 bool debug() const noexcept
66 {
67 return debug_;
68 }
69
71 ONIXS_ICEBOE_EXPORTED std::string toString() const;
72
76
77 BuildInfo(const char* const compilerInfo, bool debug) noexcept
78 : compilerInfo_(compilerInfo)
79 , debug_(debug)
80 {}
81
82private:
83 const char* const compilerInfo_;
84 const bool debug_;
85};
86
89static inline BuildInfo consumerBuildInfo() noexcept
90{
91 return BuildInfo(ONIXS_ICEBOE_COMPILER_INFO, (ONIXS_ICEBOE_DEBUG != 0));
92}
93
94}
#define ONIXS_ICEBOE_NAMESPACE_BEGIN
Definition ABI.h:94
#define ONIXS_ICEBOE_NAMESPACE_END
Definition ABI.h:98
#define ONIXS_ICEBOE_EXPORTED
Definition Compiler.h:155
bool debug() const noexcept
Definition Tools.h:65
BuildInfo(const char *const compilerInfo, bool debug) noexcept
Definition Tools.h:77
static BuildInfo library() noexcept
Returns build info for the library binary itself.
const char * compilerInfo() const noexcept
Definition Tools.h:59
#define ONIXS_ICEBOE_COMPILER_INFO
Definition Tools.h:41
#define ONIXS_ICEBOE_DEBUG
Definition Tools.h:51