nx_server_plugin_sdk  1.0
Server Plugin SDK
json.h
Go to the documentation of this file.
1 // Copyright 2018-present Network Optix, Inc. Licensed under MPL 2.0: www.mozilla.org/MPL/2.0/
2 
3 #pragma once
4 
13 // Includes from json11.hpp are duplicated here to put them in the global namespace.
14 #include <string>
15 #include <vector>
16 #include <map>
17 #include <memory>
18 #include <initializer_list>
19 
20 #if !defined(NX_KIT_API)
21  #define NX_KIT_API
22 #endif
23 
24 //-------------------------------------------------------------------------------------------------
25 // Make the Json11 classes exported from nx_kit dynamic lib.
26 
27 namespace nx {
28 namespace kit {
29 namespace detail { //< Prohibits to refer to Json11 classes as nx::kit::json11::*.
30 namespace json11 { //< Such namespace is used in the original Json11 source.
31 
32 class NX_KIT_API Json;
33 class NX_KIT_API JsonValue; //< Considered private in Json11, but is exported for debugging.
34 
35 } // namespace json11
36 } // namespace detail
37 } // namespace kit
38 } // namespace nx
39 
40 //-------------------------------------------------------------------------------------------------
41 // Explicitly instantiate and export a type used in class Json - suppresses an MSVC warning.
42 
43 #if defined(_MSC_VER)
44  namespace std {
45 
46  template class NX_KIT_API std::shared_ptr<nx::kit::detail::json11::JsonValue>;
47 
48  } // namespace std
49 #endif
50 
51 //-------------------------------------------------------------------------------------------------
52 // Include the original Json11 header and make its classes available in namespace nx::kit.
53 
54 namespace nx {
55 namespace kit {
56 
57 namespace detail {
58 
59 #include "../../json11/json11.hpp" //< Original Json11 header.
60 
61 } // namespace detail
62 
63 using namespace detail::json11; //< Allow to refer to the Json11 class as nx::kit::Json.
64 
65 } // namespace kit
66 } // namespace nx
67 
68 //-------------------------------------------------------------------------------------------------
69 // Additional features.
70 
71 namespace nx {
72 namespace kit {
73 
74 NX_KIT_API std::string jsonTypeToString(Json::Type type);
75 
76 } // namespace kit
77 } // namespace nx
Definition: to_string.h:49
Definition: json11.cpp:32
Definition: apple_utils.h:6