Flutter Impeller
impeller::testing::SampleWithVector Class Reference
Inheritance diagram for impeller::testing::SampleWithVector:
impeller::Archivable

Public Member Functions

 SampleWithVector ()=default
 
PrimaryKey GetPrimaryKey () const override
 
bool Write (ArchiveLocation &item) const override
 
bool Read (ArchiveLocation &item) override
 
- Public Member Functions inherited from impeller::Archivable
virtual ~Archivable ()=default
 

Static Public Attributes

static const ArchiveDef kArchiveDefinition
 

Detailed Description

Definition at line 60 of file archivist_unittests.cc.

Constructor & Destructor Documentation

◆ SampleWithVector()

impeller::testing::SampleWithVector::SampleWithVector ( )
default

Member Function Documentation

◆ GetPrimaryKey()

PrimaryKey impeller::testing::SampleWithVector::GetPrimaryKey ( ) const
inlineoverridevirtual

Implements impeller::Archivable.

Definition at line 65 of file archivist_unittests.cc.

65 { return std::nullopt; }

◆ Read()

bool impeller::testing::SampleWithVector::Read ( ArchiveLocation item)
inlineoverridevirtual

Implements impeller::Archivable.

Definition at line 77 of file archivist_unittests.cc.

77  {
78  std::string str;
79  auto str_result = item.Read("hello", str);
80  std::vector<Sample> samples;
81  auto vec_result = item.Read("samples", samples);
82 
83  if (!str_result || str != "world" || !vec_result || samples.size() != 50) {
84  return false;
85  }
86 
87  size_t current = 1988;
88  for (const auto& sample : samples) {
89  if (sample.GetSomeData() != current++) {
90  return false;
91  }
92  }
93  return true;
94  };

References impeller::ArchiveLocation::Read().

◆ Write()

bool impeller::testing::SampleWithVector::Write ( ArchiveLocation item) const
inlineoverridevirtual

Implements impeller::Archivable.

Definition at line 68 of file archivist_unittests.cc.

68  {
69  std::vector<Sample> samples;
70  for (size_t i = 0; i < 50u; i++) {
71  samples.emplace_back(Sample{1988 + i});
72  }
73  return item.Write("hello", "world") && item.Write("samples", samples);
74  };

References impeller::ArchiveLocation::Write().

Member Data Documentation

◆ kArchiveDefinition

const ArchiveDef impeller::testing::SampleWithVector::kArchiveDefinition
static
Initial value:
= {
.table_name = "SampleWithVector",
.members = {"hello", "samples"},
}

Definition at line 94 of file archivist_unittests.cc.


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