Flutter Impeller
archivable.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #pragma once
6 
7 #include <cstdint>
8 #include <optional>
9 #include <string>
10 #include <vector>
11 
12 namespace impeller {
13 
14 struct ArchiveDef {
15  const std::string table_name;
16  const std::vector<std::string> members;
17 };
18 
19 class ArchiveLocation;
20 
21 using PrimaryKey = std::optional<int64_t>;
22 
23 //------------------------------------------------------------------------------
24 /// @brief Instances of `Archivable`s can be read from and written to a
25 /// persistent archive.
26 ///
27 class Archivable {
28  public:
29  virtual ~Archivable() = default;
30 
31  virtual PrimaryKey GetPrimaryKey() const = 0;
32 
33  virtual bool Write(ArchiveLocation& item) const = 0;
34 
35  virtual bool Read(ArchiveLocation& item) = 0;
36 };
37 
38 } // namespace impeller
impeller::Archivable
Instances of Archivables can be read from and written to a persistent archive.
Definition: archivable.h:27
impeller::ArchiveDef::table_name
const std::string table_name
Definition: archivable.h:15
impeller::Archivable::~Archivable
virtual ~Archivable()=default
impeller::ArchiveDef
Definition: archivable.h:14
impeller::PrimaryKey
std::optional< int64_t > PrimaryKey
Definition: archivable.h:21
impeller::Archivable::Write
virtual bool Write(ArchiveLocation &item) const =0
impeller::Archivable::Read
virtual bool Read(ArchiveLocation &item)=0
impeller::ArchiveLocation
Definition: archive_location.h:21
impeller::Archivable::GetPrimaryKey
virtual PrimaryKey GetPrimaryKey() const =0
impeller::ArchiveDef::members
const std::vector< std::string > members
Definition: archivable.h:16
impeller
Definition: aiks_context.cc:10