mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-04-05 18:09:04 +00:00
Introduce a pluggable web client interface and concrete CURL implementation: adds IWebClient, CURLWebClient, and CurlGlobalState (headers + curl_web_client.cpp). DataDownloader now accepts an IWebClient and delegates downloads. Add WikipediaService for cached Wikipedia summary lookups. Refactor SqliteDatabase to return full City records and update consumers accordingly. Improve JsonLoader to use batched transactions during streaming parses. Enhance LlamaGenerator with sampling options, increased token limits, JSON extraction/validation, and other parsing helpers. Modernize CMake: set policy/version, add project_options, simplify FetchContent usage (spdlog), require Boost components (program_options/json), list pipeline sources explicitly, and tweak post-build/memcheck targets. Update README to match implementation changes and new CLI/config conventions.
31 lines
801 B
C++
31 lines
801 B
C++
#ifndef DATA_DOWNLOADER_H
|
|
#define DATA_DOWNLOADER_H
|
|
|
|
#include <memory>
|
|
#include <stdexcept>
|
|
#include <string>
|
|
|
|
#include "web_client.h"
|
|
|
|
/// @brief Downloads and caches source geography JSON payloads.
|
|
class DataDownloader {
|
|
public:
|
|
/// @brief Initializes global curl state used by this downloader.
|
|
DataDownloader(std::shared_ptr<IWebClient> webClient);
|
|
|
|
/// @brief Cleans up global curl state.
|
|
~DataDownloader();
|
|
|
|
/// @brief Returns a local JSON path, downloading it when cache is missing.
|
|
std::string DownloadCountriesDatabase(
|
|
const std::string &cachePath,
|
|
const std::string &commit = "c5eb7772" // Stable commit: 2026-03-28 export
|
|
);
|
|
|
|
private:
|
|
bool FileExists(const std::string &filePath) const;
|
|
std::shared_ptr<IWebClient> m_webClient;
|
|
};
|
|
|
|
#endif // DATA_DOWNLOADER_H
|