171 switch (
static_cast<EncodedType
>(
type)) {
172 case EncodedType::kNull:
173 return EncodableValue();
174 case EncodedType::kTrue:
175 return EncodableValue(
true);
176 case EncodedType::kFalse:
177 return EncodableValue(
false);
178 case EncodedType::kInt32:
179 return EncodableValue(stream->ReadInt32());
180 case EncodedType::kInt64:
181 return EncodableValue(stream->ReadInt64());
182 case EncodedType::kFloat64:
183 stream->ReadAlignment(8);
184 return EncodableValue(stream->ReadDouble());
185 case EncodedType::kLargeInt:
186 case EncodedType::kString: {
188 std::string string_value;
189 string_value.resize(size);
190 stream->ReadBytes(
reinterpret_cast<uint8_t*
>(&string_value[0]), size);
191 return EncodableValue(string_value);
193 case EncodedType::kUInt8List:
194 return ReadVector<uint8_t>(stream);
195 case EncodedType::kInt32List:
196 return ReadVector<int32_t>(stream);
197 case EncodedType::kInt64List:
198 return ReadVector<int64_t>(stream);
199 case EncodedType::kFloat64List:
200 return ReadVector<double>(stream);
201 case EncodedType::kList: {
204 list_value.reserve(length);
205 for (
size_t i = 0; i < length; ++i) {
208 return EncodableValue(list_value);
210 case EncodedType::kMap: {
213 for (
size_t i = 0; i < length; ++i) {
215 EncodableValue value =
ReadValue(stream);
216 map_value.emplace(std::move(
key), std::move(value));
218 return EncodableValue(map_value);
220 case EncodedType::kFloat32List: {
221 return ReadVector<float>(stream);
224 std::cerr <<
"Unknown type in StandardCodecSerializer::ReadValueOfType: "
225 <<
static_cast<int>(
type) << std::endl;
226 return EncodableValue();