mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-13 06:01:21 +00:00
init sqlite database library
This commit is contained in:
parent
cf64949986
commit
814b25a946
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@
|
||||
*.cache
|
||||
*.log
|
||||
*.status
|
||||
*.sqlite3
|
||||
configure
|
||||
configure~
|
||||
Makefile
|
7
Makefile
7
Makefile
@ -1,7 +1,7 @@
|
||||
# Define compiler and flags
|
||||
CXX = g++
|
||||
CXXFLAGS = `pkg-config --cflags gtkmm-4.0 glibmm-2.68`
|
||||
LDFLAGS = `pkg-config --libs 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 sqlite3`
|
||||
|
||||
# Define target executable and source files
|
||||
TARGET = bin/Yoda
|
||||
@ -10,7 +10,8 @@ SRCS = src/main.cpp\
|
||||
src/app/browser/header.cpp\
|
||||
src/app/browser/header/menu.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)
|
||||
|
||||
|
@ -10,7 +10,10 @@ GTK 4 / C++ implementation branch
|
||||
|
||||
### 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`
|
||||
* `cd Yoda`
|
||||
* `git checkout master`
|
||||
@ -38,7 +41,9 @@ GTK 4 / C++ implementation branch
|
||||
|
||||
### Environment
|
||||
|
||||
* `pkg-config --cflags --libs gtkmm-4.0 glibmm-2.68`
|
||||
``` bash
|
||||
pkg-config --cflags --libs gtkmm-4.0 glibmm-2.68 sqlite3
|
||||
```
|
||||
|
||||
### Contribution
|
||||
|
||||
|
@ -8,5 +8,6 @@ src/app/browser/header/tab.cpp
|
||||
src/app/browser/header/tab.hpp
|
||||
src/app/browser/page.cpp
|
||||
src/app/browser/page.hpp
|
||||
src/lib/database.hpp
|
||||
src/main.cpp
|
||||
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 "app/browser.hpp"
|
||||
#include "lib/database.hpp"
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char * argv[]
|
||||
) {
|
||||
// Init profile
|
||||
auto database = lib::Database(
|
||||
"database.sqlite3"
|
||||
);
|
||||
|
||||
// Init app
|
||||
auto app = Gtk::Application::create(
|
||||
"io.github.yggverse.Yoda"
|
||||
|
Loading…
x
Reference in New Issue
Block a user