libcluon  0.0.148
cluon.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017-2018 Christian Berger
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
8 
9 #ifndef CLUON_CLUON_HPP
10 #define CLUON_CLUON_HPP
11 
12 // clang-format off
13 #ifdef WIN32
14  #ifdef _WIN64
15  #define ssize_t __int64
16  #else
17  #define ssize_t long
18  #endif
19 
20  // Disable warning "'<': signed/unsigned mismatch".
21  #pragma warning(disable : 4018)
22  // Disable warning "Unary minus operator applied to unsigned type, result still unsigned".
23  #pragma warning(disable : 4146)
24  // Disable warning "Possible loss of precision".
25  #pragma warning(disable : 4244)
26  // Disable warning "Conversion from 'size_t' to 'type', possible loss of data".
27  #pragma warning(disable : 4267)
28  // Disable warning "'static_cast': truncation of constant value".
29  #pragma warning(disable : 4309)
30  // Disable warning "'operator ""s': literal suffix identifiers that do not start with an underscore are reserved".
31  #pragma warning(disable : 4455)
32  // Disable deprecated API warnings.
33  #pragma warning(disable : 4996)
34 
35  // Link against ws2_32.lib for networking.
36  #pragma comment(lib, "ws2_32.lib")
37  // Link against iphlpapi.lib for address resolving.
38  #pragma comment(lib, "iphlpapi.lib")
39 
40  // Avoid include definitions from Winsock v1.
41  #define WIN32_LEAN_AND_MEAN
42 
43  // Export symbols.
44  #ifdef LIBCLUON_SHARED
45  #ifdef LIBCLUON_EXPORTS
46  #define LIBCLUON_API __declspec(dllexport)
47  #else
48  #define LIBCLUON_API __declspec(dllimport)
49  #endif
50  #else
51  // If linking statically:
52  #define LIBCLUON_API
53  #endif
54 #else
55  // Undefine define for non-Win32 systems:
56  #define LIBCLUON_API
57 #endif
58 // clang-format on
59 
60 #include "cluon/PortableEndian.hpp"
61 
62 #include <map>
63 #include <string>
64 
65 namespace cluon {
66 
71  public:
72  inline std::size_t operator()(const uint32_t v) const noexcept {
73  return static_cast<std::size_t>(v);
74  }
75 };
76 
80 std::map<std::string, std::string> getCommandlineArguments(int32_t argc, char **argv) noexcept;
81 
82 } // namespace cluon
83 
84 #endif
Definition: cluon.hpp:65
std::size_t operator()(const uint32_t v) const noexcept
Definition: cluon.hpp:72
Definition: cluon.hpp:70
std::map< std::string, std::string > getCommandlineArguments(int32_t argc, char **argv) noexcept
Definition: cluon.cpp:15