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

Function insert_stream_operators

cpp/examples/encode_decode.cpp:137–162  ·  view source on GitHub ↗

Insert using stream operators (see print_next for example of extracting with stream ops.)

Source from the content-addressed store, hash-verified

135
136// Insert using stream operators (see print_next for example of extracting with stream ops.)
137static void insert_stream_operators() {
138 std::cout << std::endl << "== Insert with stream operators." << std::endl;
139 proton::value v;
140
141 // Create an array of INT with values [1, 2, 3]
142 proton::codec::encoder e(v);
143 e << proton::codec::start::array(proton::INT)
144 << int32_t(1) << int32_t(2) << int32_t(3)
145 << proton::codec::finish();
146 print(v);
147
148 // Create a mixed-type list of the values [42, 0, "x"].
149 proton::codec::encoder e2(v);
150 e2 << proton::codec::start::list()
151 << int32_t(42) << false << proton::symbol("x")
152 << proton::codec::finish();
153 print(v);
154
155 // Create a map { "k1":42, "k2": false }
156 proton::codec::encoder e3(v);
157 e3 << proton::codec::start::map()
158 << "k1" << int32_t(42)
159 << proton::symbol("k2") << false
160 << proton::codec::finish();
161 print(v);
162}
163
164int main(int, char**) {
165 try {

Callers 1

mainFunction · 0.85

Calls 5

finishClass · 0.85
printFunction · 0.85
listFunction · 0.85
symbolClass · 0.50
mapClass · 0.50

Tested by

no test coverage detected