#include <standard_codec_serializer.h>
Definition at line 18 of file standard_codec_serializer.h.
◆ ~StandardCodecSerializer()
flutter::StandardCodecSerializer::~StandardCodecSerializer |
( |
| ) |
|
|
virtualdefault |
◆ StandardCodecSerializer() [1/2]
◆ StandardCodecSerializer() [2/2]
flutter::StandardCodecSerializer::StandardCodecSerializer |
( |
| ) |
|
|
protecteddefault |
◆ GetInstance()
◆ operator=()
◆ ReadSize()
size_t flutter::StandardCodecSerializer::ReadSize |
( |
ByteStreamReader * |
stream | ) |
const |
|
protected |
◆ ReadValue()
◆ ReadValueOfType()
Definition at line 168 of file standard_codec.cc.
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);
208 return EncodableValue(list_value);
210 case EncodedType::kMap: {
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();
References i, length, flutter::ByteStreamReader::ReadAlignment(), flutter::ByteStreamReader::ReadBytes(), flutter::ByteStreamReader::ReadDouble(), flutter::ByteStreamReader::ReadInt32(), flutter::ByteStreamReader::ReadInt64(), ReadSize(), ReadValue(), type, and value.
Referenced by ReadValue().
◆ WriteSize()
void flutter::StandardCodecSerializer::WriteSize |
( |
size_t |
size, |
|
|
ByteStreamWriter * |
stream |
|
) |
| const |
|
protected |
◆ WriteValue()
Definition at line 98 of file standard_codec.cc.
100 stream->WriteByte(
static_cast<uint8_t
>(EncodedTypeForValue(
value)));
102 switch (
value.index()) {
108 stream->WriteInt32(std::get<int32_t>(
value));
111 stream->WriteInt64(std::get<int64_t>(
value));
114 stream->WriteAlignment(8);
115 stream->WriteDouble(std::get<double>(
value));
118 const auto& string_value = std::get<std::string>(
value);
119 size_t size = string_value.size();
123 reinterpret_cast<const uint8_t*
>(string_value.data()), size);
128 WriteVector(std::get<std::vector<uint8_t>>(
value), stream);
131 WriteVector(std::get<std::vector<int32_t>>(
value), stream);
134 WriteVector(std::get<std::vector<int64_t>>(
value), stream);
137 WriteVector(std::get<std::vector<double>>(
value), stream);
140 const auto& list = std::get<EncodableList>(
value);
142 for (
const auto& item : list) {
148 const auto& map = std::get<EncodableMap>(
value);
150 for (
const auto& pair : map) {
158 <<
"Unhandled custom type in StandardCodecSerializer::WriteValue. "
159 <<
"Custom types require codec extensions." << std::endl;
162 WriteVector(std::get<std::vector<float>>(
value), stream);
References value, flutter::ByteStreamWriter::WriteAlignment(), flutter::ByteStreamWriter::WriteByte(), flutter::ByteStreamWriter::WriteBytes(), flutter::ByteStreamWriter::WriteDouble(), flutter::ByteStreamWriter::WriteInt32(), flutter::ByteStreamWriter::WriteInt64(), and WriteSize().
Referenced by flutter::StandardMethodCodec::EncodeErrorEnvelopeInternal(), flutter::StandardMessageCodec::EncodeMessageInternal(), flutter::StandardMethodCodec::EncodeMethodCallInternal(), and flutter::StandardMethodCodec::EncodeSuccessEnvelopeInternal().
The documentation for this class was generated from the following files: