Subversion Repositories tpanel

Rev

Rev 11 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11 Rev 21
Line 1... Line 1...
1
/*
1
/*
2
 * Copyright (C) 2020 by Andreas Theofilu <andreas@theosys.at>
2
 * Copyright (C) 2020, 2021 by Andreas Theofilu <andreas@theosys.at>
3
 *
3
 *
4
 * This program is free software; you can redistribute it and/or modify
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
6
 * the Free Software Foundation; either version 3 of the License, or
7
 * (at your option) any later version.
7
 * (at your option) any later version.
Line 25... Line 25...
25
 
25
 
26
#define V_MAJOR		1
26
#define V_MAJOR		1
27
#define V_MINOR		0
27
#define V_MINOR		0
28
#define V_PATCH		0
28
#define V_PATCH		0
29
 
29
 
-
 
30
/**
-
 
31
 * @def TPANEL_VERSION
-
 
32
 * Defines the version of this application.
-
 
33
 */
30
#define TPANEL_VERSION		((V_MAJOR * 0x10000) + (V_MINOR * 0x100) + V_PATCH)
34
#define TPANEL_VERSION		((V_MAJOR * 0x10000) + (V_MINOR * 0x100) + V_PATCH)
31
 
35
 
-
 
36
/**
-
 
37
 * @brief The TConfig class manages the configurations.
-
 
38
 *
-
 
39
 * The class contains methods to read a config file, parse it's content and
-
 
40
 * hold the configuration options in the class. All public methods are static.
-
 
41
 */
32
class TConfig
42
class TConfig
33
{
43
{
34
	public:
44
	public:
35
		TConfig(const std::string& path);
45
		TConfig(const std::string& path);
36
 
46
 
Line 48... Line 58...
48
        static int getSystem();
58
        static int getSystem();
49
		static int getPort();
59
		static int getPort();
50
		static int getChannel();
60
		static int getChannel();
51
		static std::string& getPanelType();
61
		static std::string& getPanelType();
52
		static std::string& getFirmVersion();
62
		static std::string& getFirmVersion();
-
 
63
        static bool certCheck();
53
 
64
 
54
	protected:
65
	protected:
55
		static inline std::string &ltrim(std::string &s) {
66
		static inline std::string &ltrim(std::string &s) {
56
			s.erase(s.begin(), std::find_if(s.begin(), s.end(),
67
            s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](int c) {return !std::isspace(c);}));
57
											std::not1(std::ptr_fun<int, int>(std::isspace))));
-
 
58
			return s;
68
			return s;
59
		}
69
		}
60
 
70
 
61
	private:
71
	private:
62
		bool findConfig();
72
		bool findConfig();
Line 64... Line 74...
64
		std::vector<std::string> split(const std::string& str, const std::string& seps, const bool trimEmpty);
74
		std::vector<std::string> split(const std::string& str, const std::string& seps, const bool trimEmpty);
65
		int caseCompare(const std::string& str1, const std::string& str2);
75
		int caseCompare(const std::string& str1, const std::string& str2);
66
 
76
 
67
		std::string mPath;
77
		std::string mPath;
68
		std::string mCFile;
78
		std::string mCFile;
-
 
79
#ifdef __ANDROID__
-
 
80
        std::string mRoot;
-
 
81
#endif
69
};
82
};
70
 
83
 
71
#endif
84
#endif