Major refactor and API changes

- Updated `.gitignore` file
- Updated `CMakeLists.txt` to build static exectuable
- Changed some `Doxyfile` configurations to build more robust and complete documentation (WIP)
- Changed how `remote` works to better reflect `git`'s API (WIP)
- Changed how error handling works
- Improved `bin/compile.sh` script
- Improved `bin/lines.sh` script (kinda)
- Removed some instances of `fmt` in favor of `std` string functions
- Restructed style for better readibility
This commit is contained in:
David Allen 2023-05-22 17:54:45 -06:00
parent ba23299777
commit 5a73651ad1
29 changed files with 1836 additions and 1140 deletions

View file

@ -2,27 +2,31 @@
#pragma once
#include "constants.hpp"
#include "package.hpp"
#include "error.hpp"
#include "result.hpp"
#include <sqlite3.h>
#include <vector>
#include <string>
namespace gdpm::package_manager{
struct package_info;
}
namespace gdpm::cache{
using namespace package_manager;
int create_package_database(const std::string& cache_path = GDPM_PACKAGE_CACHE_PATH, const std::string& table_name = GDPM_PACKAGE_CACHE_TABLENAME);
int insert_package_info(const std::vector<package_info>& package, const std::string& cache_path = GDPM_PACKAGE_CACHE_PATH, const std::string& table_name = GDPM_PACKAGE_CACHE_TABLENAME);
std::vector<package_info> get_package_info_by_id(const std::vector<size_t>& package_ids, const std::string& cache_path = GDPM_PACKAGE_CACHE_PATH, const std::string& table_name = GDPM_PACKAGE_CACHE_TABLENAME);
std::vector<package_info> get_package_info_by_title(const std::vector<std::string>& package_titles, const std::string& cache_path = GDPM_PACKAGE_CACHE_PATH, const std::string& table_name = GDPM_PACKAGE_CACHE_TABLENAME);
std::vector<package_info> get_installed_packages(const std::string& cache_path = GDPM_PACKAGE_CACHE_PATH, const std::string& table_name = GDPM_PACKAGE_CACHE_TABLENAME);
int update_package_info(const std::vector<package_info>& packages, const std::string& cache_path = GDPM_PACKAGE_CACHE_PATH, const std::string& table_name = GDPM_PACKAGE_CACHE_TABLENAME);
int update_sync_info(const std::vector<std::string>& download_urls, const std::string& cache_path = GDPM_PACKAGE_CACHE_PATH, const std::string& table_name = GDPM_PACKAGE_CACHE_TABLENAME);
int delete_packages(const std::vector<std::string>& package_titles, const std::string& cache_path = GDPM_PACKAGE_CACHE_PATH, const std::string& table_name = GDPM_PACKAGE_CACHE_TABLENAME);
int delete_packages(const std::vector<size_t>& package_ids, const std::string& cache_path = GDPM_PACKAGE_CACHE_PATH, const std::string& table_name = GDPM_PACKAGE_CACHE_TABLENAME);
int drop_package_database(const std::string& cache_path = GDPM_PACKAGE_CACHE_PATH, const std::string& table_name = GDPM_PACKAGE_CACHE_TABLENAME);
namespace gdpm::cache {
struct params {
std::string cache_path = GDPM_PACKAGE_CACHE_PATH;
std::string table_name = GDPM_PACKAGE_CACHE_TABLENAME;
};
std::string to_values(const package_info& package);
std::string to_values(const std::vector<package_info>& packages);
error create_package_database(bool overwrite = false, const params& = params());
error insert_package_info(const package::info_list& packages, const params& = params());
result_t<package::info_list> get_package_info_by_id(const package::id_list& package_ids, const params& = params());
result_t<package::info_list> get_package_info_by_title(const package::title_list& package_titles, const params& params = cache::params());
result_t<package::info_list> get_installed_packages(const params& = params());
error update_package_info(const package::info_list& packages, const params& = params());
error update_sync_info(const std::vector<std::string>& download_urls, const params& = params());
error delete_packages(const package::title_list& package_titles, const params& = params());
error delete_packages(const package::id_list& package_ids, const params& = params());
error drop_package_database(const params& = params());
result_t<std::string> to_values(const package::info& package);
result_t<std::string> to_values(const package::info_list& packages);
}