Flutter Engine
flutter::PointExtensionSerializer Class Reference

#include <test_codec_extensions.h>

Inheritance diagram for flutter::PointExtensionSerializer:
flutter::StandardCodecSerializer

Public Member Functions

 PointExtensionSerializer ()
 
virtual ~PointExtensionSerializer ()
 
EncodableValue ReadValueOfType (uint8_t type, ByteStreamReader *stream) const override
 
void WriteValue (const EncodableValue &value, ByteStreamWriter *stream) const override
 
- Public Member Functions inherited from flutter::StandardCodecSerializer
virtual ~StandardCodecSerializer ()
 
 StandardCodecSerializer (StandardCodecSerializer const &)=delete
 
StandardCodecSerializeroperator= (StandardCodecSerializer const &)=delete
 
EncodableValue ReadValue (ByteStreamReader *stream) const
 

Static Public Member Functions

static const PointExtensionSerializerGetInstance ()
 
- Static Public Member Functions inherited from flutter::StandardCodecSerializer
static const StandardCodecSerializerGetInstance ()
 

Additional Inherited Members

- Protected Member Functions inherited from flutter::StandardCodecSerializer
 StandardCodecSerializer ()
 
size_t ReadSize (ByteStreamReader *stream) const
 
void WriteSize (size_t size, ByteStreamWriter *stream) const
 

Detailed Description

Definition at line 48 of file test_codec_extensions.h.

Constructor & Destructor Documentation

◆ PointExtensionSerializer()

flutter::PointExtensionSerializer::PointExtensionSerializer ( )
default

◆ ~PointExtensionSerializer()

flutter::PointExtensionSerializer::~PointExtensionSerializer ( )
virtualdefault

Member Function Documentation

◆ GetInstance()

const PointExtensionSerializer & flutter::PointExtensionSerializer::GetInstance ( )
static

Definition at line 13 of file test_codec_extensions.cc.

Referenced by flutter::TEST().

13  {
14  static PointExtensionSerializer sInstance;
15  return sInstance;
16 }

◆ ReadValueOfType()

EncodableValue flutter::PointExtensionSerializer::ReadValueOfType ( uint8_t  type,
ByteStreamReader stream 
) const
overridevirtual

Reimplemented from flutter::StandardCodecSerializer.

Definition at line 18 of file test_codec_extensions.cc.

References flutter::ByteStreamReader::ReadInt32(), and flutter::StandardCodecSerializer::ReadValueOfType().

20  {
21  if (type == kPointType) {
22  int32_t x = stream->ReadInt32();
23  int32_t y = stream->ReadInt32();
24  return CustomEncodableValue(Point(x, y));
25  }
26  return StandardCodecSerializer::ReadValueOfType(type, stream);
27 }
virtual EncodableValue ReadValueOfType(uint8_t type, ByteStreamReader *stream) const

◆ WriteValue()

void flutter::PointExtensionSerializer::WriteValue ( const EncodableValue value,
ByteStreamWriter stream 
) const
overridevirtual

Reimplemented from flutter::StandardCodecSerializer.

Definition at line 29 of file test_codec_extensions.cc.

References flutter::SomeDataExtensionSerializer::SomeDataExtensionSerializer(), value, flutter::ByteStreamWriter::WriteByte(), flutter::ByteStreamWriter::WriteInt32(), flutter::StandardCodecSerializer::WriteValue(), flutter::Point::x(), flutter::Point::y(), and flutter::SomeDataExtensionSerializer::~SomeDataExtensionSerializer().

Referenced by flutter::SomeDataExtensionSerializer::WriteValue().

30  {
31  auto custom_value = std::get_if<CustomEncodableValue>(&value);
32  if (!custom_value) {
34  return;
35  }
36  stream->WriteByte(kPointType);
37  const Point& point = std::any_cast<Point>(*custom_value);
38  stream->WriteInt32(point.x());
39  stream->WriteInt32(point.y());
40 }
virtual void WriteValue(const EncodableValue &value, ByteStreamWriter *stream) const
uint8_t value

The documentation for this class was generated from the following files: