Loading...
Searching...
No Matches
type_id.hpp
Go to the documentation of this file.
#ifndef PROTON_TYPE_ID_HPP
#define PROTON_TYPE_ID_HPP
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
#include "./internal/export.hpp"
#include <proton/codec.h>
#include <string>
namespace proton {
enum type_id {
NULL_TYPE = PN_NULL,
BOOLEAN = PN_BOOL,
UBYTE = PN_UBYTE,
BYTE = PN_BYTE,
USHORT = PN_USHORT,
SHORT = PN_SHORT,
UINT = PN_UINT,
INT = PN_INT,
CHAR = PN_CHAR,
ULONG = PN_ULONG,
LONG = PN_LONG,
TIMESTAMP = PN_TIMESTAMP,
FLOAT = PN_FLOAT,
DOUBLE = PN_DOUBLE,
DECIMAL32 = PN_DECIMAL32,
DECIMAL64 = PN_DECIMAL64,
DECIMAL128 = PN_DECIMAL128,
UUID = PN_UUID,
BINARY = PN_BINARY,
STRING = PN_STRING,
SYMBOL = PN_SYMBOL,
DESCRIBED = PN_DESCRIBED,
ARRAY = PN_ARRAY,
LIST = PN_LIST,
MAP = PN_MAP
};
PN_CPP_EXTERN std::string type_name(type_id);
PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, type_id);
PN_CPP_EXTERN void assert_type_equal(type_id want, type_id got);
inline bool type_id_is_signed_int(type_id t) { return t == BYTE || t == SHORT || t == INT || t == LONG; }
inline bool type_id_is_unsigned_int(type_id t) { return t == UBYTE || t == USHORT || t == UINT || t == ULONG; }
inline bool type_id_is_integral(type_id t) { return t == BOOLEAN || t == CHAR || t == TIMESTAMP || type_id_is_unsigned_int(t) || type_id_is_signed_int(t); }
inline bool type_id_is_floating_point(type_id t) { return t == FLOAT || t == DOUBLE; }
inline bool type_id_is_decimal(type_id t) { return t == DECIMAL32 || t == DECIMAL64 || t == DECIMAL128; }
inline bool type_id_is_signed(type_id t) { return type_id_is_signed_int(t) || type_id_is_floating_point(t) || type_id_is_decimal(t); }
inline bool type_id_is_string_like(type_id t) { return t == BINARY || t == STRING || t == SYMBOL; }
inline bool type_id_is_container(type_id t) { return t == LIST || t == MAP || t == ARRAY || t == DESCRIBED; }
inline bool type_id_is_null(type_id t) { return t == NULL_TYPE; }
inline bool type_id_is_scalar(type_id t) {
return type_id_is_integral(t) ||
type_id_is_floating_point(t) ||
type_id_is_decimal(t) ||
type_id_is_string_like(t) ||
type_id_is_null(t) ||
t == TIMESTAMP ||
t == UUID;
}
} // proton
#endif // PROTON_TYPE_ID_HPP
proton::map
A collection of key-value pairs.
Definition map.hpp:69
proton
The main Proton namespace.
Definition annotation_key.hpp:33
proton::type_name
std::string type_name(type_id)
Get the name of the AMQP type.
proton::type_id
type_id
An identifier for AMQP types.
Definition type_id.hpp:37
proton::ARRAY
@ ARRAY
A sequence of values of the same type.
Definition type_id.hpp:60
proton::LIST
@ LIST
A sequence of values of mixed types.
Definition type_id.hpp:61
proton::UBYTE
@ UBYTE
Unsigned 8-bit integer.
Definition type_id.hpp:40
proton::DOUBLE
@ DOUBLE
64-bit binary floating point.
Definition type_id.hpp:51
proton::TIMESTAMP
@ TIMESTAMP
Signed 64-bit milliseconds since the epoch.
Definition type_id.hpp:49
proton::CHAR
@ CHAR
32-bit unicode character.
Definition type_id.hpp:46
proton::UINT
@ UINT
Unsigned 32-bit integer.
Definition type_id.hpp:44
proton::MAP
@ MAP
A sequence of key-value pairs.
Definition type_id.hpp:62
proton::ULONG
@ ULONG
Unsigned 64-bit integer.
Definition type_id.hpp:47
proton::DESCRIBED
@ DESCRIBED
A descriptor and a value.
Definition type_id.hpp:59
proton::NULL_TYPE
@ NULL_TYPE
The null type, contains no data.
Definition type_id.hpp:38
proton::SHORT
@ SHORT
Signed 16-bit integer.
Definition type_id.hpp:43
proton::BOOLEAN
@ BOOLEAN
Boolean true or false.
Definition type_id.hpp:39
proton::DECIMAL32
@ DECIMAL32
32-bit decimal floating point.
Definition type_id.hpp:52
proton::DECIMAL64
@ DECIMAL64
64-bit decimal floating point.
Definition type_id.hpp:53
proton::USHORT
@ USHORT
Unsigned 16-bit integer.
Definition type_id.hpp:42
proton::FLOAT
@ FLOAT
32-bit binary floating point.
Definition type_id.hpp:50
proton::BYTE
@ BYTE
Signed 8-bit integer.
Definition type_id.hpp:41
proton::LONG
@ LONG
Signed 64-bit integer.
Definition type_id.hpp:48
proton::UUID
@ UUID
16-byte UUID.
Definition type_id.hpp:55
proton::DECIMAL128
@ DECIMAL128
128-bit decimal floating point.
Definition type_id.hpp:54
proton::SYMBOL
@ SYMBOL
Variable-length encoded string.
Definition type_id.hpp:58
proton::BINARY
@ BINARY
Variable-length sequence of bytes.
Definition type_id.hpp:56
proton::STRING
@ STRING
Variable-length utf8-encoded string.
Definition type_id.hpp:57
proton::INT
@ INT
Signed 32-bit integer.
Definition type_id.hpp:45
proton::operator<<
std::ostream & operator<<(std::ostream &, const binary &)
Print a binary value.
proton::assert_type_equal
void assert_type_equal(type_id want, type_id got)
Throw a conversion_error if want != got with a message including the names of the types.