equal
deleted
inserted
replaced
80 if (remainingItems.back() < 1) containerEnd(); |
80 if (remainingItems.back() < 1) containerEnd(); |
81 } |
81 } |
82 } |
82 } |
83 } |
83 } |
84 |
84 |
85 void appendScalarValue(Glib::ustring value, Glib::ustring cborType, bool isNull = false) { |
85 void appendScalarValue(Glib::ustring value, Glib::ustring cborType) { |
86 // TODO: null |
|
87 if (mode.back() == Mode::ARRAY) { |
86 if (mode.back() == Mode::ARRAY) { |
88 xmlpp::Element* element = current->add_child(nameCodec.encode(itemName)); |
87 xmlpp::Element* element = current->add_child(nameCodec.encode(itemName)); |
89 element->add_child_text(value); |
88 element->add_child_text(value); |
90 element->set_attribute("value-type", cborType); |
89 element->set_attribute("value-type", cborType); |
91 } else if (mode.back() == Mode::MAP_KEY) { |
90 } else if (mode.back() == Mode::MAP_KEY) { |
223 callbacks.negint32 = NUMERIC_CALLBACK(uint32_t, "negative-int32"); |
222 callbacks.negint32 = NUMERIC_CALLBACK(uint32_t, "negative-int32"); |
224 callbacks.negint64 = NUMERIC_CALLBACK(uint64_t, "negative-int64"); |
223 callbacks.negint64 = NUMERIC_CALLBACK(uint64_t, "negative-int64"); |
225 |
224 |
226 callbacks.null = [](void* context) { |
225 callbacks.null = [](void* context) { |
227 CBOR_CALLBACK_START |
226 CBOR_CALLBACK_START |
228 instance->appendScalarValue("", "null", true); |
227 instance->appendScalarValue("", "null"); |
229 CBOR_CALLBACK_END |
228 CBOR_CALLBACK_END |
230 }; |
229 }; |
231 |
230 |
232 callbacks.string = [](void* context, cbor_data value, uint64_t size) { |
231 callbacks.string = [](void* context, cbor_data value, uint64_t size) { |
233 CBOR_CALLBACK_START |
232 CBOR_CALLBACK_START |
255 callbacks.uint32 = NUMERIC_CALLBACK(uint32_t, "uint32"); |
254 callbacks.uint32 = NUMERIC_CALLBACK(uint32_t, "uint32"); |
256 callbacks.uint64 = NUMERIC_CALLBACK(uint64_t, "uint64"); |
255 callbacks.uint64 = NUMERIC_CALLBACK(uint64_t, "uint64"); |
257 |
256 |
258 callbacks.undefined = [](void* context) { |
257 callbacks.undefined = [](void* context) { |
259 CBOR_CALLBACK_START |
258 CBOR_CALLBACK_START |
260 instance->appendScalarValue("undefined", "undefined", true); // FIXME: throw exception? |
259 instance->appendScalarValue("", "undefined"); // TODO: throw exception? |
261 CBOR_CALLBACK_END |
260 CBOR_CALLBACK_END |
262 }; |
261 }; |
263 |
262 |
264 } |
263 } |
265 |
264 |