juk3n/fluffypublic Fork
⑂ 4f1f5a9
Commits
⬇ Clone ▾
git clone https://git.rickub.com/juk3n/fluffy.git
git clone ssh://git@rickub.com/juk3n/fluffy.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

sqlite from installed library

juk3n committed 2024-06-07T18:12:18+02:00 Browse files
4f1f5a9 parent: edf35e1
modified CMakeLists.txt +2 -2
@@ -23,12 +23,12 @@ find_package(SQLite3 REQUIRED)
2323
2424 include_directories(${CMAKE_SOURCE_DIR}/include)
2525
26-add_executable(fluffy src/main.cpp src/sqlite3.c)
26+add_executable(fluffy src/main.cpp)
2727
2828 target_link_libraries(fluffy
2929 PRIVATE ftxui::screen
3030 PRIVATE ftxui::dom
31- PRIVATE ftxui::component # Not needed for this example.
31+ PRIVATE ftxui::component
3232 PRIVATE SQLite::SQLite3
3333 )
3434
@@ -23,12 +23,12 @@ find_package(SQLite3 REQUIRED)
23 23
24 include_directories(${CMAKE_SOURCE_DIR}/include)24 include_directories(${CMAKE_SOURCE_DIR}/include)
25 25
26-add_executable(fluffy src/main.cpp src/sqlite3.c)26+add_executable(fluffy src/main.cpp)
27 27
28 target_link_libraries(fluffy28 target_link_libraries(fluffy
29 PRIVATE ftxui::screen29 PRIVATE ftxui::screen
30 PRIVATE ftxui::dom30 PRIVATE ftxui::dom
31- PRIVATE ftxui::component # Not needed for this example.31+ PRIVATE ftxui::component
32 PRIVATE SQLite::SQLite332 PRIVATE SQLite::SQLite3
33 )33 )
34 34
modified src/main.cpp +10 -13
@@ -6,7 +6,7 @@
66 #include <string>
77 #include <cstdlib>
88 #include <filesystem>
9-#include <../include/sqlite3.h>
9+#include <sqlite3.h>
1010 #include <map>
1111
1212
@@ -89,10 +89,8 @@ int main() {
8989 const unsigned char* gamePath = sqlite3_column_text(stmt, 2);
9090
9191 std::cout << gameName << ": " << gamePath << std::endl;
92- std::string name{};
93- std::string path{};
94- name.append(reinterpret_cast<const char*>(gameName));
95- path.append(reinterpret_cast<const char*>(gamePath));
92+ std::string name{reinterpret_cast<const char*>(gameName)};
93+ std::string path{reinterpret_cast<const char*>(gamePath)};
9694 games[name] = path;
9795 }
9896 sqlite3_finalize(stmt);
@@ -107,16 +105,15 @@ int main() {
107105
108106 auto summary = [&] {
109107 auto content = vbox(localGames);
110- return window(text(L" Fluffy v0.1 "), content);
108+ return window(text(L" Games "), content);
111109 };
112110
113- auto document = //
114- vbox({
115- summary(),
116- });
117-
118- // Limit the size of the document to 80 char.
119- document = document | size(WIDTH, LESS_THAN, 80);
111+ auto document = vbox({
112+ text(L" Fluffy v0.1 "),
113+ vbox({summary()}),
114+ });
115+
116+ document = document | size(WIDTH, LESS_THAN, 120);
120117
121118 auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
122119 Render(screen, document);
@@ -6,7 +6,7 @@
6 #include <string>6 #include <string>
7 #include <cstdlib>7 #include <cstdlib>
8 #include <filesystem>8 #include <filesystem>
9-#include <../include/sqlite3.h>9+#include <sqlite3.h>
10 #include <map>10 #include <map>
11 11
12 12
@@ -89,10 +89,8 @@ int main() {
89 const unsigned char* gamePath = sqlite3_column_text(stmt, 2);89 const unsigned char* gamePath = sqlite3_column_text(stmt, 2);
90 90
91 std::cout << gameName << ": " << gamePath << std::endl;91 std::cout << gameName << ": " << gamePath << std::endl;
92- std::string name{};92+ std::string name{reinterpret_cast<const char*>(gameName)};
93- std::string path{};93+ std::string path{reinterpret_cast<const char*>(gamePath)};
94- name.append(reinterpret_cast<const char*>(gameName));
95- path.append(reinterpret_cast<const char*>(gamePath));
96 games[name] = path;94 games[name] = path;
97 }95 }
98 sqlite3_finalize(stmt);96 sqlite3_finalize(stmt);
@@ -107,16 +105,15 @@ int main() {
107 105
108 auto summary = [&] {106 auto summary = [&] {
109 auto content = vbox(localGames);107 auto content = vbox(localGames);
110- return window(text(L" Fluffy v0.1 "), content);108+ return window(text(L" Games "), content);
111 };109 };
112 110
113- auto document = //111+ auto document = vbox({
114- vbox({112+ text(L" Fluffy v0.1 "),
115- summary(),113+ vbox({summary()}),
116- });114+ });
117-115+
118- // Limit the size of the document to 80 char.116+ document = document | size(WIDTH, LESS_THAN, 120);
119- document = document | size(WIDTH, LESS_THAN, 80);
120 117
121 auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));118 auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
122 Render(screen, document);119 Render(screen, document);