MCPcopy Create free account
hub / github.com/apache/brpc / array_add_item

Function array_add_item

src/mcpack2pb/serializer.cpp:207–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207inline bool array_add_item(OutputStream* stream,
208 Serializer::GroupInfo & group_info,
209 FieldType item_type,
210 uint32_t n) {
211 if (group_info.pending_null_count) {
212 add_pending_nulls(stream, group_info);
213 }
214 if (group_info.item_type == item_type ||
215 (group_info.item_type == FIELD_OBJECT && item_type == FIELD_ARRAY)) {
216 group_info.item_count += n;
217 return true;
218 }
219 if (group_info.type == FIELD_ARRAY) {
220 CHECK(false) << "Different item_type=" << type2str(item_type)
221 << " from " << group_info;
222 return false;
223 }
224 if (group_info.output_offset == 0) {
225 // Enable anynomous object at first level.
226 group_info.item_count += n;
227 return true;
228 } else {
229 CHECK(false) << "Cannot add field without name to " << group_info;
230 return false;
231 }
232}
233
234//=========================
235//adding primitive types

Callers 6

add_primitiveFunction · 0.85
add_primitivesFunction · 0.85
add_binary_internalFunction · 0.85
add_empty_array_internalFunction · 0.85
begin_object_internalMethod · 0.85
begin_array_internalMethod · 0.85

Calls 2

add_pending_nullsFunction · 0.85
type2strFunction · 0.70

Tested by

no test coverage detected