Ethan Yonker | 1b7a31b | 2014-07-03 15:09:22 -0500 | [diff] [blame] | 1 | /* |
| 2 | Copyright 2012 bigbiff/Dees_Troy TeamWin |
| 3 | This file is part of TWRP/TeamWin Recovery Project. |
| 4 | |
| 5 | TWRP is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by |
| 7 | the Free Software Foundation, either version 3 of the License, or |
| 8 | (at your option) any later version. |
| 9 | |
| 10 | TWRP is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with TWRP. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | #ifndef _INFOMANAGER_HPP_HEADER |
| 20 | #define _INFOMANAGER_HPP_HEADER |
| 21 | |
| 22 | #include <string> |
| 23 | #include <utility> |
| 24 | #include <map> |
| 25 | |
| 26 | using namespace std; |
| 27 | |
| 28 | class InfoManager |
| 29 | { |
| 30 | public: |
| 31 | InfoManager(const string filename); |
| 32 | virtual ~InfoManager(); |
| 33 | int LoadValues(); |
| 34 | int SaveValues(); |
| 35 | |
| 36 | // Core get routines |
| 37 | int GetValue(const string varName, string& value); |
| 38 | int GetValue(const string varName, int& value); |
| 39 | int GetValue(const string varName, float& value); |
| 40 | unsigned long long GetValue(const string varName, unsigned long long& value); |
| 41 | |
| 42 | string GetStrValue(const string varName); |
| 43 | int GetIntValue(const string varName); |
| 44 | |
| 45 | // Core set routines |
| 46 | int SetValue(const string varName, string value); |
| 47 | int SetValue(const string varName, int value); |
| 48 | int SetValue(const string varName, float value); |
| 49 | int SetValue(const string varName, unsigned long long value); |
| 50 | |
| 51 | private: |
| 52 | string File; |
| 53 | map<string, string> mValues; |
| 54 | |
| 55 | }; |
| 56 | |
| 57 | #endif // _DATAMANAGER_HPP_HEADER |
| 58 | |