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.
27 lines
746 B
C++
27 lines
746 B
C++
#pragma once
|
|
|
|
#include "web_client.h"
|
|
#include <memory>
|
|
|
|
// RAII for curl_global_init/cleanup.
|
|
// An instance of this class should be created in main() before any curl
|
|
// operations and exist for the lifetime of the application.
|
|
class CurlGlobalState {
|
|
public:
|
|
CurlGlobalState();
|
|
~CurlGlobalState();
|
|
CurlGlobalState(const CurlGlobalState &) = delete;
|
|
CurlGlobalState &operator=(const CurlGlobalState &) = delete;
|
|
};
|
|
|
|
class CURLWebClient : public IWebClient {
|
|
public:
|
|
CURLWebClient();
|
|
~CURLWebClient() override;
|
|
|
|
void DownloadToFile(const std::string &url,
|
|
const std::string &filePath) override;
|
|
std::string Get(const std::string &url) override;
|
|
std::string UrlEncode(const std::string &value) override;
|
|
};
|