mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 17:45:28 +00:00
init sqlite database library
This commit is contained in:
parent
cf64949986
commit
814b25a946
7 changed files with 57 additions and 5 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
*.cache
|
*.cache
|
||||||
*.log
|
*.log
|
||||||
*.status
|
*.status
|
||||||
|
*.sqlite3
|
||||||
configure
|
configure
|
||||||
configure~
|
configure~
|
||||||
Makefile
|
Makefile
|
||||||
7
Makefile
7
Makefile
|
|
@ -1,7 +1,7 @@
|
||||||
# Define compiler and flags
|
# Define compiler and flags
|
||||||
CXX = g++
|
CXX = g++
|
||||||
CXXFLAGS = `pkg-config --cflags gtkmm-4.0 glibmm-2.68`
|
CXXFLAGS = `pkg-config --cflags gtkmm-4.0 glibmm-2.68 sqlite3`
|
||||||
LDFLAGS = `pkg-config --libs gtkmm-4.0 glibmm-2.68`
|
LDFLAGS = `pkg-config --libs gtkmm-4.0 glibmm-2.68 sqlite3`
|
||||||
|
|
||||||
# Define target executable and source files
|
# Define target executable and source files
|
||||||
TARGET = bin/Yoda
|
TARGET = bin/Yoda
|
||||||
|
|
@ -10,7 +10,8 @@ SRCS = src/main.cpp\
|
||||||
src/app/browser/header.cpp\
|
src/app/browser/header.cpp\
|
||||||
src/app/browser/header/menu.cpp\
|
src/app/browser/header/menu.cpp\
|
||||||
src/app/browser/header/tab.cpp\
|
src/app/browser/header/tab.cpp\
|
||||||
src/app/browser/page.cpp
|
src/app/browser/page.cpp\
|
||||||
|
src/lib/database.cpp
|
||||||
|
|
||||||
OBJS = $(SRCS:.cpp=.o)
|
OBJS = $(SRCS:.cpp=.o)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,10 @@ GTK 4 / C++ implementation branch
|
||||||
|
|
||||||
### Linux
|
### Linux
|
||||||
|
|
||||||
* `sudo apt install git libgtkmm-4.0-dev libglibmm-2.68-dev`
|
``` bash
|
||||||
|
sudo apt install git libgtkmm-4.0-dev libglibmm-2.68-dev libsqlite3-dev
|
||||||
|
```
|
||||||
|
|
||||||
* `git clone https://github.com/YGGverse/Yoda.git`
|
* `git clone https://github.com/YGGverse/Yoda.git`
|
||||||
* `cd Yoda`
|
* `cd Yoda`
|
||||||
* `git checkout master`
|
* `git checkout master`
|
||||||
|
|
@ -38,7 +41,9 @@ GTK 4 / C++ implementation branch
|
||||||
|
|
||||||
### Environment
|
### Environment
|
||||||
|
|
||||||
* `pkg-config --cflags --libs gtkmm-4.0 glibmm-2.68`
|
``` bash
|
||||||
|
pkg-config --cflags --libs gtkmm-4.0 glibmm-2.68 sqlite3
|
||||||
|
```
|
||||||
|
|
||||||
### Contribution
|
### Contribution
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,5 +8,6 @@ src/app/browser/header/tab.cpp
|
||||||
src/app/browser/header/tab.hpp
|
src/app/browser/header/tab.hpp
|
||||||
src/app/browser/page.cpp
|
src/app/browser/page.cpp
|
||||||
src/app/browser/page.hpp
|
src/app/browser/page.hpp
|
||||||
|
src/lib/database.hpp
|
||||||
src/main.cpp
|
src/main.cpp
|
||||||
src/main.hpp
|
src/main.hpp
|
||||||
12
src/lib/database.cpp
Normal file
12
src/lib/database.cpp
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
#include "database.hpp"
|
||||||
|
|
||||||
|
using namespace lib;
|
||||||
|
|
||||||
|
Database::Database(
|
||||||
|
const char * filename
|
||||||
|
) {
|
||||||
|
status = sqlite3_open(
|
||||||
|
filename,
|
||||||
|
&connection
|
||||||
|
);
|
||||||
|
}
|
||||||
26
src/lib/database.hpp
Normal file
26
src/lib/database.hpp
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
#ifndef LIB_DATABASE_H
|
||||||
|
#define LIB_DATABASE_H
|
||||||
|
|
||||||
|
#include <sqlite3.h>
|
||||||
|
|
||||||
|
namespace lib
|
||||||
|
{
|
||||||
|
class Database
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
int status;
|
||||||
|
|
||||||
|
char * error;
|
||||||
|
|
||||||
|
sqlite3 * connection;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Database(
|
||||||
|
const char * filename
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // LIB_DATABASE_H
|
||||||
|
|
@ -1,10 +1,16 @@
|
||||||
#include "main.hpp"
|
#include "main.hpp"
|
||||||
#include "app/browser.hpp"
|
#include "app/browser.hpp"
|
||||||
|
#include "lib/database.hpp"
|
||||||
|
|
||||||
int main(
|
int main(
|
||||||
int argc,
|
int argc,
|
||||||
char * argv[]
|
char * argv[]
|
||||||
) {
|
) {
|
||||||
|
// Init profile
|
||||||
|
auto database = lib::Database(
|
||||||
|
"database.sqlite3"
|
||||||
|
);
|
||||||
|
|
||||||
// Init app
|
// Init app
|
||||||
auto app = Gtk::Application::create(
|
auto app = Gtk::Application::create(
|
||||||
"io.github.yggverse.Yoda"
|
"io.github.yggverse.Yoda"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue