summaryrefslogtreecommitdiffstats
path: root/src/djinterop/enginelibrary/el_database_impl.hpp
blob: 2ba840f440566de1728e6247d98a46bbcf01e588 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
    This file is part of libdjinterop.

    libdjinterop is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    libdjinterop is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with libdjinterop.  If not, see <http://www.gnu.org/licenses/>.
 */

#pragma once

#include <sqlite_modern_cpp.h>

#include <djinterop/enginelibrary/el_storage.hpp>
#include <djinterop/impl/database_impl.hpp>

namespace djinterop
{
namespace enginelibrary
{
class el_database_impl : public database_impl
{
public:
    el_database_impl(std::shared_ptr<el_storage> storage);

    transaction_guard begin_transaction() override;
    stdx::optional<djinterop::crate> crate_by_id(int64_t id) override;
    std::vector<djinterop::crate> crates() override;
    std::vector<djinterop::crate> crates_by_name(
        const std::string& name) override;
    djinterop::crate create_root_crate(std::string name) override;
    track create_track(std::string relative_path) override;
    std::string directory() override;
    bool is_supported() override;
    void verify() override;
    void remove_crate(djinterop::crate cr) override;
    void remove_track(djinterop::track tr) override;
    std::vector<djinterop::crate> root_crates() override;
    stdx::optional<djinterop::crate> root_crate_by_name(
        const std::string& name) override;
    stdx::optional<djinterop::track> track_by_id(int64_t id) override;
    std::vector<djinterop::track> tracks() override;
    std::vector<djinterop::track> tracks_by_relative_path(
        const std::string& relative_path) override;
    std::string uuid() override;
    semantic_version version() override;
    std::string version_name() override;

private:
    std::shared_ptr<el_storage> storage_;
};

}  // namespace enginelibrary
}  // namespace djinterop