-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSave.h
More file actions
24 lines (19 loc) · 926 Bytes
/
Save.h
File metadata and controls
24 lines (19 loc) · 926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#pragma once
#include <string>
#include <vector>
#include <list>
#include "Item.h"
class Save {
public:
// Save and load to cfg functions
static void SaveToCfg(const std::vector<Item>& items, const std::vector<std::string>& categories, const std::string& filePath);
static void LoadFromCfg(std::vector<Item>& items, std::vector<std::string>& categories, const std::string& filePath);
static void SaveItems(const std::vector<Item>& items, const std::string& filePath, char separator = ',');
static void LoadItems(std::vector<Item>& items, const std::string& filePath);
static void SaveSettings(const std::list<std::string>& settings);
static std::list<std::string> LoadSettings();
static bool FileDoesNotExist(const std::string& filePath);
private:
static std::string EscapeForCSV(const std::string& field);
static std::vector<std::string> ParseCSVLine(const std::string& line);
};