MCPcopy Create free account
hub / github.com/apache/qpid-proton / compare_next

Function compare_next

cpp/src/value.cpp:109–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109int compare_next(decoder& a, decoder& b) {
110 // Sort by type_id first.
111 type_id ta = a.next_type(), tb = b.next_type();
112 int cmp = compare(ta, tb);
113 if (cmp) return cmp;
114
115 switch (ta) {
116 case NULL_TYPE: return 0;
117 case ARRAY:
118 case LIST:
119 case MAP:
120 case DESCRIBED:
121 return compare_container(a, b);
122 case BOOLEAN: return compare_simple<bool>(a, b);
123 case UBYTE: return compare_simple<uint8_t>(a, b);
124 case BYTE: return compare_simple<int8_t>(a, b);
125 case USHORT: return compare_simple<uint16_t>(a, b);
126 case SHORT: return compare_simple<int16_t>(a, b);
127 case UINT: return compare_simple<uint32_t>(a, b);
128 case INT: return compare_simple<int32_t>(a, b);
129 case ULONG: return compare_simple<uint64_t>(a, b);
130 case LONG: return compare_simple<int64_t>(a, b);
131 case CHAR: return compare_simple<wchar_t>(a, b);
132 case TIMESTAMP: return compare_simple<timestamp>(a, b);
133 case FLOAT: return compare_simple<float>(a, b);
134 case DOUBLE: return compare_simple<double>(a, b);
135 case DECIMAL32: return compare_simple<decimal32>(a, b);
136 case DECIMAL64: return compare_simple<decimal64>(a, b);
137 case DECIMAL128: return compare_simple<decimal128>(a, b);
138 case UUID: return compare_simple<uuid>(a, b);
139 case BINARY: return compare_simple<binary>(a, b);
140 case STRING: return compare_simple<std::string>(a, b);
141 case SYMBOL: return compare_simple<symbol>(a, b);
142 }
143// Avoid unreached diagnostic from clang
144#if defined(__clang__)
145#pragma GCC diagnostic push
146#pragma GCC diagnostic ignored "-Wunreachable-code"
147#endif
148 // Invalid but equal type_id, treat as equal.
149 return 0;
150#if defined(__clang__)
151#pragma GCC diagnostic pop
152#endif
153}
154
155int compare(const value& x, const value& y) {
156 decoder a(x), b(y);

Callers 2

compare_containerFunction · 0.85
compareFunction · 0.85

Calls 3

compareFunction · 0.85
compare_containerFunction · 0.85
next_typeMethod · 0.80

Tested by

no test coverage detected