CppWAMP
C++11 client library for the WAMP protocol
variantdefs.hpp
Go to the documentation of this file.
1 /*------------------------------------------------------------------------------
2  Copyright Butterfly Energy Systems 2014-2015, 2022.
3  Distributed under the Boost Software License, Version 1.0.
4  http://www.boost.org/LICENSE_1_0.txt
5 ------------------------------------------------------------------------------*/
6 
7 #ifndef CPPWAMP_VARIANTDEFS_HPP
8 #define CPPWAMP_VARIANTDEFS_HPP
9 
10 //------------------------------------------------------------------------------
13 //------------------------------------------------------------------------------
14 
15 #include <cstdint>
16 #include <string>
17 #include <map>
18 #include <vector>
19 
20 namespace wamp
21 {
22 
23 //------------------------------------------------------------------------------
25 //------------------------------------------------------------------------------
26 enum class TypeId : uint8_t
27 {
28  null,
29  boolean,
30  integer,
31  uint,
32  real,
33  string,
34  blob,
35  array,
36  object
37 };
38 
39 // Forward declaration
40 class Variant;
41 
42 //------------------------------------------------------------------------------
44 //------------------------------------------------------------------------------
46 using Bool = bool;
47 using Int = std::int64_t;
48 using UInt = std::uint64_t;
49 using Real = double;
50 using String = std::string;
51 using Array = std::vector<Variant>;
52 using Object = std::map<String, Variant>;
53 
55 } // namespace wamp
56 
57 #endif // CPPWAMP_VARIANTDEFS_HPP
wamp::TypeId
TypeId
Integer ID used to indicate the current dynamic type of a Variant.
Definition: variantdefs.hpp:26
wamp::UInt
std::uint64_t UInt
Variant bound type for unsigned integers.
Definition: variantdefs.hpp:48
wamp::TypeId::array
@ array
For Variant::Array.
wamp::TypeId::string
@ string
For Variant::String.
wamp::Object
std::map< String, Variant > Object
Variant bound type for maps of variants.
Definition: variantdefs.hpp:52
wamp
Definition: anyhandler.hpp:36
wamp::Array
std::vector< Variant > Array
Variant bound type for arrays of variants.
Definition: variantdefs.hpp:51
wamp::TypeId::uint
@ uint
For Variant::UInt.
wamp::Int
std::int64_t Int
Variant bound type for signed integers.
Definition: variantdefs.hpp:47
wamp::Bool
bool Bool
Variant bound type for boolean values.
Definition: variantdefs.hpp:46
wamp::TypeId::boolean
@ boolean
For Variant::Bool.
wamp::Real
double Real
Variant bound type for floating-point numbers.
Definition: variantdefs.hpp:49
wamp::TypeId::real
@ real
For Variant::Real.
wamp::String
std::string String
Variant bound type for text strings.
Definition: variantdefs.hpp:50
wamp::TypeId::integer
@ integer
For Variant::Int.
wamp::TypeId::blob
@ blob
For Variant::Blob.