Debian Codegraph @

cpp/include/proton/codec/common.hpp

raw
1 #ifndef PROTON_CODEC_COMMON_HPP
2 #define PROTON_CODEC_COMMON_HPP
3
4 /*
5 *
6 * Licensed to the Apache Software Foundation (ASF) under one
7 * or more contributor license agreements. See the NOTICE file
8 * distributed with this work for additional information
9 * regarding copyright ownership. The ASF licenses this file
10 * to you under the Apache License, Version 2.0 (the
11 * "License"); you may not use this file except in compliance
12 * with the License. You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing,
17 * software distributed under the License is distributed on an
18 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19 * KIND, either express or implied. See the License for the
20 * specific language governing permissions and limitations
21 * under the License.
22 *
23 */
24
25 #include "../type_id.hpp"
26
27 /// @file
28 /// **Unsettled API** - Shared codec functions.
29
30 namespace proton {
31 namespace codec {
32
33 /// **Unsettled API** - Start encoding a complex type.
34 struct start {
35 /// @cond INTERNAL
36 /// XXX Document
37 start(type_id type_=NULL_TYPE, type_id element_=NULL_TYPE,
38 bool described_=false, size_t size_=0) :
39 type(type_), element(element_), is_described(described_), size(size_) {}
40
41 type_id type; ///< The container type: ARRAY, LIST, MAP or DESCRIBED.
42 type_id element; ///< the element type for array only.
43 bool is_described; ///< true if first value is a descriptor.
44 size_t size; ///< the element count excluding the descriptor (if any)
45 /// @endcond
46
47 /// @cond INTERNAL
48 /// XXX Document
49 static start array(type_id element, bool described=false) { return start(ARRAY, element, described); }
50 static start list() { return start(LIST); }
51 static start map() { return start(MAP); }
52 static start described() { return start(DESCRIBED, NULL_TYPE, true); }
53 /// @endcond
54 };
55
56 /// **Unsettled API** - Finish inserting or extracting a complex type.
57 struct finish {};
58
59 } // codec
60 } // proton
61
62 #endif // PROTON_CODEC_COMMON_HPP