| 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 #ifndef FLUTTER_IMPELLER_ARCHIVIST_ARCHIVABLE_H_
6 #define FLUTTER_IMPELLER_ARCHIVIST_ARCHIVABLE_H_
7
8 #include <cstdint>
9 #include <optional>
10 #include <string>
11 #include <vector>
12
13 namespace impeller {
14
15 struct ArchiveDef {
16 const std::string table_name;
17 const std::vector<std::string> members;
18 };
19
20 class ArchiveLocation;
21
22 using PrimaryKey = std::optional<int64_t>;
23
24 //------------------------------------------------------------------------------
25 /// @brief Instances of `Archivable`s can be read from and written to a
26 /// persistent archive.
27 ///
28 class Archivable {
29 public:
30 virtual ~Archivable() = default;
31
32 virtual PrimaryKey GetPrimaryKey() const = 0;
33
34 virtual bool Write(ArchiveLocation& item) const = 0;
35
36 virtual bool Read(ArchiveLocation& item) = 0;
37 };
38
39 } // namespace impeller
40
41 #endif // FLUTTER_IMPELLER_ARCHIVIST_ARCHIVABLE_H_
impeller::Archivable
Instances of Archivables can be read from and written to a persistent archive.
Definition: archivable.h:28
impeller::ArchiveDef::table_name
const std::string table_name
Definition: archivable.h:16
impeller::Archivable::~Archivable
virtual ~Archivable()=default
impeller::ArchiveDef
Definition: archivable.h:15
impeller::PrimaryKey
std::optional< int64_t > PrimaryKey
Definition: archivable.h:22
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:17
impeller
Definition: aiks_context.cc:10