| 29 | namespace Valdi { |
| 30 | |
| 31 | Value deserializeValue(const Byte* data, size_t size) { |
| 32 | auto str = StringCache::getGlobal().makeString(reinterpret_cast<const char*>(data), size); |
| 33 | |
| 34 | Value out; |
| 35 | |
| 36 | for (const auto& line : str.split('\n')) { |
| 37 | auto index = line.indexOf('='); |
| 38 | if (index) { |
| 39 | auto keyValue = line.split(*index); |
| 40 | out.setMapValue(keyValue.first, Value(keyValue.second)); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | return out; |
| 45 | } |
| 46 | |
| 47 | Ref<ByteBuffer> serializeValue(const Value& value) { |
| 48 | auto out = makeShared<ByteBuffer>(); |