forked from objectcomputing/mFAST
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfast_ostream_inserter.h
More file actions
61 lines (53 loc) · 1.85 KB
/
Copy pathfast_ostream_inserter.h
File metadata and controls
61 lines (53 loc) · 1.85 KB
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
#pragma once
#include "../../string_ref.h"
#include "../../decimal_ref.h"
#include "../../ext_ref.h"
#include "../encoder/fast_ostream.h"
namespace mfast {
namespace coder {
template <typename T>
inline fast_ostream &operator<<(fast_ostream &strm, const T &ext_ref) {
typename T::cref_type cref = ext_ref.get();
strm.encode(cref.value(), cref.absent(), ext_ref.nullable());
return strm;
}
template <typename Operator, typename Properties>
inline fast_ostream &
operator<<(fast_ostream &strm,
const ext_cref<ascii_string_cref, Operator, Properties> &ext_ref) {
ascii_string_cref cref = ext_ref.get();
strm.encode(cref.c_str(), static_cast<uint32_t>(cref.size()),
cref.instruction(), ext_ref.nullable());
return strm;
}
template <typename Operator, typename Properties>
inline fast_ostream &
operator<<(fast_ostream &strm,
const ext_cref<unicode_string_cref, Operator, Properties> &ext_ref) {
unicode_string_cref cref = ext_ref.get();
strm.encode(cref.c_str(), static_cast<uint32_t>(cref.size()),
cref.instruction(), ext_ref.nullable());
return strm;
}
template <typename Operator, typename Properties>
inline fast_ostream &
operator<<(fast_ostream &strm,
const ext_cref<byte_vector_cref, Operator, Properties> &ext_ref) {
byte_vector_cref cref = ext_ref.get();
strm.encode(cref.begin(), static_cast<uint32_t>(cref.size()),
cref.instruction(), ext_ref.nullable());
return strm;
}
template <typename Operator, typename Properties>
inline fast_ostream &
operator<<(fast_ostream &strm,
const ext_cref<decimal_cref, Operator, Properties> &ext_ref) {
decimal_cref cref = ext_ref.get();
strm.encode(cref.exponent(), cref.absent(), ext_ref.nullable());
if (cref.present()) {
strm.encode(cref.mantissa(), false, false_type());
}
return strm;
}
} /* coder */
} /* mfast */