nx_server_plugin_sdk 1.0 Server Plugin SDK

to_string.h
1 // Copyright 2018-present Network Optix, Inc. Licensed under MPL 2.0: www.mozilla.org/MPL/2.0/
2
3 #pragma once
4
5 #include <ostream>
6 #include <string>
7
8 #include <nx/sdk/i_device_info.h>
9 #include <nx/sdk/i_string.h>
10 #include <nx/sdk/i_string_map.h>
11 #include <nx/sdk/result.h>
12
13 namespace nx::sdk {
14
15 std::string toString(const IString* string);
16
26 std::string toString(const IStringMap* map, int overallIndent = 0);
27
37 std::string toJsonString(const IStringMap* map, int overallIndent = 0);
38
40 std::string toJsonString(const IDeviceInfo* deviceInfo, int overallIndent = 0);
41
42 std::string toString(ErrorCode errorCode);
43
44 } // namespace nx::sdk
45
46 //-------------------------------------------------------------------------------------------------
47 // Functions that need to be in namespace std for compatibility with STL features.
48
49 namespace std {
50
51 inline std::ostream& operator<<(std::ostream& os, nx::sdk::ErrorCode errorCode)
52 {
53 return os << nx::sdk::toString(errorCode);
54 }
55
56 } // namespace std
std
Definition: to_string.h:49
nx::sdk
Definition: device_agent.h:12