-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathSerializer.h
35 lines (33 loc) · 1.54 KB
/
Serializer.h
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
30
31
32
33
34
35
#pragma once
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
//================================================================================================//
/**************************************************
** Serializer: Will read/write config variables **
***************************************************/
//================================================================================================//
class Serializer
{
public:
Serializer(){}
~Serializer(){}
void PutComment(string file, string comment);
//================================================================================================//
/************************************************************************************
** Read variable will search the file for variable and load it into the parsed var **
** If the file did not exist, it will be written instead (auto-generation) **
*************************************************************************************/
//================================================================================================//
void ReadVariable(string file, string varname, int& value);
void ReadVariable(string file, string varname, float& value);
void ReadVariable(string file, string varname, string& value);
private:
bool SearchFileGenerate(string file);
vector<string> m_GenFiles;//store filenames that couldnt be loaded, so we can generate them now
};
extern Serializer gSerializer;