-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpara_variables.h
More file actions
41 lines (30 loc) · 830 Bytes
/
para_variables.h
File metadata and controls
41 lines (30 loc) · 830 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
30
31
32
33
34
35
36
37
38
39
40
41
/*
* Copyright (c) 2021, Adam Boardman
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <map>
#include <fstream>
typedef enum {
ParaVarErrorNone,
ParaVarErrorReadBlock,
ParaVarErrorBadSig,
ParaVarErrorBadCheckSum
} ParaVarErrors;
static const int ParaEnvBlockRWStart = 0x20000;
static const int ParaEnvBlockSize = 0x4000;
static char ParaEnvNullChar = '\0';
static const int ParaEnvBlockSigSize = 8;
static const int ParaEnvBlockSig2Pos = ParaEnvBlockSize - ParaEnvBlockSigSize - 4;
static const int ParaEnvBlockSig1Pos = 0;
class ParaVariables {
public:
ParaVariables();
ParaVarErrors ReadFromStream(std::ifstream &stream);
std::string &operator[](const std::string &key);
void Clear();
void WriteToStream(std::ofstream &stream);
private:
std::map<std::string, std::string> variables;
};