| Flutter Impeller |

archive_class_registration.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_ARCHIVE_CLASS_REGISTRATION_H_
6 #define FLUTTER_IMPELLER_ARCHIVIST_ARCHIVE_CLASS_REGISTRATION_H_
7
8 #include <map>
9 #include <optional>
10
11 #include "flutter/fml/macros.h"
12 #include "impeller/archivist/archive.h"
13 #include "impeller/archivist/archive_statement.h"
14
15 namespace impeller {
16
17 class ArchiveClassRegistration {
18 public:
19 static constexpr size_t kPrimaryKeyIndex = 0u;
20
21 bool IsValid() const;
22
23 std::optional<size_t> FindColumnIndex(const std::string& member) const;
24
25 const std::string& GetClassName() const;
26
27 size_t GetMemberCount() const;
28
29 ArchiveStatement CreateInsertStatement() const;
30
31 ArchiveStatement CreateQueryStatement(bool single) const;
32
33 private:
34 using MemberColumnMap = std::map<std::string, size_t>;
35
36 friend class ArchiveDatabase;
37
38 ArchiveClassRegistration(ArchiveDatabase& database, ArchiveDef definition);
39
40 bool CreateTable();
41
42 ArchiveDatabase& database_;
43 const ArchiveDef definition_;
44 MemberColumnMap column_map_;
45 bool is_valid_ = false;
46
47 ArchiveClassRegistration(const ArchiveClassRegistration&) = delete;
48
49 ArchiveClassRegistration& operator=(const ArchiveClassRegistration&) = delete;
50 };
51
52 } // namespace impeller
53
54 #endif // FLUTTER_IMPELLER_ARCHIVIST_ARCHIVE_CLASS_REGISTRATION_H_
impeller::ArchiveClassRegistration::IsValid
bool IsValid() const
Definition: archive_class_registration.cc:35
impeller::ArchiveDef
Definition: archivable.h:15
impeller::ArchiveClassRegistration::GetClassName
const std::string & GetClassName() const
Definition: archive_class_registration.cc:27
impeller::ArchiveClassRegistration::CreateInsertStatement
ArchiveStatement CreateInsertStatement() const
Definition: archive_class_registration.cc:109
impeller::ArchiveClassRegistration::kPrimaryKeyIndex
static constexpr size_t kPrimaryKeyIndex
Definition: archive_class_registration.h:19
impeller::ArchiveDatabase
A handle to the underlying database connection for an archive.
Definition: archive_database.h:23
impeller::ArchiveClassRegistration
Definition: archive_class_registration.h:17
archive_statement.h
impeller::ArchiveClassRegistration::CreateQueryStatement
ArchiveStatement CreateQueryStatement(bool single) const
Definition: archive_class_registration.cc:86
impeller::ArchiveStatement
Represents a read/write query to an archive database. Statements are expensive to create and must be ...
Definition: archive_statement.h:20
impeller::ArchiveClassRegistration::GetMemberCount
size_t GetMemberCount() const
Definition: archive_class_registration.cc:31
impeller::ArchiveClassRegistration::FindColumnIndex
std::optional< size_t > FindColumnIndex(const std::string &member) const
Definition: archive_class_registration.cc:39
archive.h
impeller
Definition: aiks_context.cc:10