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 58 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 63 of file archivist_unittests.cc.

63 { return std::nullopt; }

◆ Read()

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

Implements impeller::Archivable.

Definition at line 75 of file archivist_unittests.cc.

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

References impeller::ArchiveLocation::Read().

◆ Write()

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

Implements impeller::Archivable.

Definition at line 66 of file archivist_unittests.cc.

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

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 92 of file archivist_unittests.cc.


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