summaryrefslogtreecommitdiffstats
path: root/data.hpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2016-03-14 20:54:37 +0100
committerDees Troy <dees_troy@teamw.in>2016-03-31 16:43:53 +0200
commitfe91611cb1c484429f2fdc958732337a5fc38fa8 (patch)
treee91133c9a9dff6f1dbba46c5110cd203dc0ddc55 /data.hpp
parentlanguages: fix and improve german translation (diff)
downloadandroid_bootable_recovery-fe91611cb1c484429f2fdc958732337a5fc38fa8.tar
android_bootable_recovery-fe91611cb1c484429f2fdc958732337a5fc38fa8.tar.gz
android_bootable_recovery-fe91611cb1c484429f2fdc958732337a5fc38fa8.tar.bz2
android_bootable_recovery-fe91611cb1c484429f2fdc958732337a5fc38fa8.tar.lz
android_bootable_recovery-fe91611cb1c484429f2fdc958732337a5fc38fa8.tar.xz
android_bootable_recovery-fe91611cb1c484429f2fdc958732337a5fc38fa8.tar.zst
android_bootable_recovery-fe91611cb1c484429f2fdc958732337a5fc38fa8.zip
Diffstat (limited to 'data.hpp')
-rw-r--r--data.hpp39
1 files changed, 19 insertions, 20 deletions
diff --git a/data.hpp b/data.hpp
index 2ec217471..790efc993 100644
--- a/data.hpp
+++ b/data.hpp
@@ -20,9 +20,8 @@
#define _DATAMANAGER_HPP_HEADER
#include <string>
-#include <utility>
-#include <map>
#include <pthread.h>
+#include "infomanager.hpp"
using namespace std;
@@ -30,30 +29,30 @@ class DataManager
{
public:
static int ResetDefaults();
- static int LoadValues(const string filename);
+ static int LoadValues(const string& filename);
static int Flush();
// Core get routines
- static int GetValue(const string varName, string& value);
- static int GetValue(const string varName, int& value);
- static int GetValue(const string varName, float& value);
- static unsigned long long GetValue(const string varName, unsigned long long& value);
+ static int GetValue(const string& varName, string& value);
+ static int GetValue(const string& varName, int& value);
+ static int GetValue(const string& varName, float& value);
+ static unsigned long long GetValue(const string& varName, unsigned long long& value);
// Helper functions
- static string GetStrValue(const string varName);
- static int GetIntValue(const string varName);
+ static string GetStrValue(const string& varName);
+ static int GetIntValue(const string& varName);
// Core set routines
- static int SetValue(const string varName, string value, int persist = 0);
- static int SetValue(const string varName, int value, int persist = 0);
- static int SetValue(const string varName, float value, int persist = 0);
- static int SetValue(const string varName, unsigned long long value, int persist = 0);
- static int SetProgress(float Fraction);
- static int ShowProgress(float Portion, float Seconds);
+ static int SetValue(const string& varName, const string& value, const int persist = 0);
+ static int SetValue(const string& varName, const int value, const int persist = 0);
+ static int SetValue(const string& varName, const float value, const int persist = 0);
+ static int SetValue(const string& varName, const unsigned long long& value, const int persist = 0);
+ static int SetProgress(const float Fraction);
+ static int ShowProgress(const float Portion, const float Seconds);
static void DumpValues();
static void update_tz_environment_variables();
- static void Vibrate(const string varName);
+ static void Vibrate(const string& varName);
static void SetBackupFolder();
static void SetDefaultValues();
static void Output_Version(void); // Outputs the version to a file in the TWRP folder
@@ -63,18 +62,18 @@ public:
static string GetSettingsStoragePath(void);
protected:
- typedef pair<string, int> TStrIntPair;
- typedef pair<string, TStrIntPair> TNameValuePair;
- static map<string, TStrIntPair> mValues;
static string mBackingFile;
static int mInitialized;
+ static InfoManager mPersist;
+ static InfoManager mData;
+ static InfoManager mConst;
static map<string, string> mConstValues;
protected:
static int SaveValues();
- static int GetMagicValue(string varName, string& value);
+ static int GetMagicValue(const string& varName, string& value);
private:
static void sanitize_device_id(char* device_id);