-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathValueType.cpp
88 lines (81 loc) · 2.51 KB
/
ValueType.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Business Source License 1.1 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// https://github.com/arangodb/arangodb/blob/devel/LICENSE
///
/// 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.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Max Neunhoeffer
/// @author Jan Steemann
////////////////////////////////////////////////////////////////////////////////
#include <ostream>
#include "velocypack/ValueType.h"
using namespace arangodb::velocypack;
char const* arangodb::velocypack::valueTypeName(ValueType type) {
switch (type) {
case ValueType::None:
return "none";
case ValueType::Illegal:
return "illegal";
case ValueType::Null:
return "null";
case ValueType::Bool:
return "bool";
case ValueType::Array:
return "array";
case ValueType::Object:
return "object";
case ValueType::Double:
return "double";
case ValueType::UTCDate:
return "utc-date";
case ValueType::External:
return "external";
case ValueType::MinKey:
return "min-key";
case ValueType::MaxKey:
return "max-key";
case ValueType::Int:
return "int";
case ValueType::UInt:
return "uint";
case ValueType::SmallInt:
return "smallint";
case ValueType::String:
return "string";
case ValueType::Binary:
return "binary";
case ValueType::BCD:
return "bcd";
case ValueType::Tagged:
return "tagged";
case ValueType::Custom:
return "custom";
}
return "unknown";
}
ValueType arangodb::velocypack::valueTypeGroup(ValueType type) {
// numbers are all the same, upcast them to double
if (type == ValueType::Double || type == ValueType::Int ||
type == ValueType::UInt || type == ValueType::SmallInt) {
return ValueType::Double;
}
return type;
}
std::ostream& operator<<(std::ostream& stream, ValueType type) {
stream << valueTypeName(type);
return stream;
}