mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-01 21:53:42 +08:00
eefc084302
version: sunnypilot v2025.003.000 (dev) date: 2025-12-18T05:48:43 master commit: 16c052af0835f049a67b80251d8cc1114fc08bb4
21 lines
556 B
C++
21 lines
556 B
C++
#pragma once
|
|
|
|
#include <atomic>
|
|
#include <string>
|
|
|
|
class FileReader {
|
|
public:
|
|
FileReader(bool cache_to_local, size_t chunk_size = 0, int retries = 3)
|
|
: cache_to_local_(cache_to_local), chunk_size_(chunk_size), max_retries_(retries) {}
|
|
virtual ~FileReader() {}
|
|
std::string read(const std::string &file, std::atomic<bool> *abort = nullptr);
|
|
|
|
private:
|
|
std::string download(const std::string &url, std::atomic<bool> *abort);
|
|
size_t chunk_size_;
|
|
int max_retries_;
|
|
bool cache_to_local_;
|
|
};
|
|
|
|
std::string cacheFilePath(const std::string &url);
|