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