WebpagePrinterTool 2.0
Print a web page skip the browser's print preview
载入中...
搜索中...
未找到
SqliteDb.h
浏览该文件的文档.
1#pragma once
4#include <QSqlDatabase>
5#include <QSqlQuery>
6#include <deque>
7#include <memory>
8#include <tuple>
9class SqliteDb {
10 public:
11 ~SqliteDb() = default;
12 static SqliteDb& instance();
13
18 void addConfig(PrinterConfig&) const;
23 void updateConfig(const PrinterConfig&) const;
28 void delConfig(int id) const;
35 PrinterConfig getConfigById(int id) const;
41 std::deque<PrinterConfig> getAllConfigs() const;
42
47 void addPage(PrintedPage&) const;
52 void updatePage(const PrintedPage&) const;
53
62 std::tuple<std::deque<PrintedPage>, int> getPagesDesc(int page_index, int page_size) const;
63
64 private:
65 SqliteDb();
66 SqliteDb(const SqliteDb&) = delete;
67 SqliteDb& operator=(const SqliteDb&) = delete;
68 SqliteDb(SqliteDb&&) = delete;
70 QSqlDatabase db;
71 std::unique_ptr<QSqlQuery> query;
72 void createDb();
73
74 void initDb();
75
82
83 bool checkValid();
84};
SqliteDb(const SqliteDb &)=delete
SqliteDb()
定义 SqliteDb.cpp:22
SqliteDb & operator=(const SqliteDb &)=delete
void initDb()
定义 SqliteDb.cpp:50
void delConfig(int id) const
delete a config by id.
定义 SqliteDb.cpp:210
void updateConfig(const PrinterConfig &) const
update Config
定义 SqliteDb.cpp:185
SqliteDb(SqliteDb &&)=delete
std::unique_ptr< QSqlQuery > query
定义 SqliteDb.h:71
bool checkValid()
check tables is valid
定义 SqliteDb.cpp:82
void addConfig(PrinterConfig &) const
add a new config. config.id will be set to the database id
定义 SqliteDb.cpp:138
static SqliteDb & instance()
定义 SqliteDb.cpp:33
~SqliteDb()=default
SqliteDb & operator=(SqliteDb &&)=delete
void updatePage(const PrintedPage &) const
update Page
定义 SqliteDb.cpp:317
void addPage(PrintedPage &) const
add new page page.id will be set to the database id
定义 SqliteDb.cpp:278
void createDb()
定义 SqliteDb.cpp:37
std::deque< PrinterConfig > getAllConfigs() const
get all configs.
定义 SqliteDb.cpp:248
QSqlDatabase db
定义 SqliteDb.h:70
PrinterConfig getConfigById(int id) const
Get the Config By Id object
定义 SqliteDb.cpp:217
std::tuple< std::deque< PrintedPage >, int > getPagesDesc(int page_index, int page_size) const
定义 SqliteDb.cpp:336
定义 PrintedPage.h:5
定义 PrinterConfig.h:5