-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstorage.h
More file actions
29 lines (22 loc) · 679 Bytes
/
storage.h
File metadata and controls
29 lines (22 loc) · 679 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once
#include "model.h"
#include <optional>
#include <string>
#include <vector>
class Storage {
public:
explicit Storage(std::string accounts_path, std::string transactions_path, std::string config_path);
// Account persistence
std::vector<Account> load_accounts();
void save_accounts(const std::vector<Account>& accounts);
// Transactions persistence
void append_transaction(const Transaction& tx);
// Config persistence
AppConfig load_config();
void save_config(const AppConfig& cfg);
private:
std::string accounts_path_;
std::string transactions_path_;
std::string config_path_;
void ensure_files_exist();
};