--- a/src/XMLDocumentConstructor.h Sat Jun 05 21:12:46 2021 +0200
+++ b/src/XMLDocumentConstructor.h Sun Jun 06 11:43:18 2021 +0200
@@ -58,6 +58,8 @@
std::vector<ssize_t> remainingItems;
#define INDEFINITE -1
+ std::stringstream currentIndefiniteString;
+
cbor_callbacks callbacks = cbor_empty_callbacks;
/**
@@ -97,6 +99,8 @@
mode.pop_back();
} else if (mode.back() == Mode::ROOT) {
current->add_child_text(value);
+ } else if (mode.back() == Mode::BYTE_STRING || mode.back() == Mode::CHAR_STRING) {
+ currentIndefiniteString << value;
} else {
// TODO: process YAML_SCALAR_EVENT
}
@@ -136,10 +140,18 @@
remainingItems.push_back(size);
}
+ void flushCurrentIndefiniteString(Glib::ustring cborType) {
+ mode.pop_back();
+ appendScalarValue(currentIndefiniteString.str(), cborType);
+ currentIndefiniteString = std::stringstream();
+ }
+
void containerEnd() {
remainingItems.pop_back();
if (mode.back() == Mode::MAP_KEY || mode.back() == Mode::MAP_VALUE) current = parentOrSelf(current);
- mode.pop_back(); // TODO: assert map/array
+ else if (mode.back() == Mode::BYTE_STRING) flushCurrentIndefiniteString("byte-string");
+ else if (mode.back() == Mode::CHAR_STRING) flushCurrentIndefiniteString("string");
+ else mode.pop_back(); // TODO: assert map/array
}
public:
@@ -175,8 +187,6 @@
CBOR_CALLBACK_START
instance->mode.push_back(Mode::BYTE_STRING);
instance->remainingItems.push_back(INDEFINITE);
- // TODO: implement
- xmlpp::Element* element = instance->current->add_child("byte-string-start");
CBOR_CALLBACK_END
};
@@ -229,8 +239,6 @@
CBOR_CALLBACK_START
instance->mode.push_back(Mode::CHAR_STRING);
instance->remainingItems.push_back(INDEFINITE);
- // TODO: implement
- xmlpp::Element* element = instance->current->add_child("string-start");
CBOR_CALLBACK_END
};