insert code for reading double numbers from ini-file

Fork of IniFileLib by rinosh 2

Files at this revision

API Documentation at this revision

Comitter:
rinosh2
Date:
Wed Nov 17 16:24:11 2010 +0000
Parent:
0:995403221573
Child:
2:4ae80a05f6ea
Commit message:
Move strtrim to static method

Changed in this revision

IniFile.cpp Show annotated file Show diff for this revision Revisions of this file
IniFile.h Show annotated file Show diff for this revision Revisions of this file
--- a/IniFile.cpp	Tue Nov 16 16:34:45 2010 +0000
+++ b/IniFile.cpp	Wed Nov 17 16:24:11 2010 +0000
@@ -120,8 +120,7 @@
 	return get(key, (char*)&ret, DTYPE_BOOL);
 }
 
-
-IniFile::Status IniFile::get(IniFile::IniList* inilist){
+IniFile::Status IniFile::get(const IniFile::IniList* inilist){
 	Status ret = S_SUCCESS;
 	for(; inilist->key ; ++inilist){
 		Status sts = get(inilist->key, (char*)inilist->buf, inilist->typelen);
--- a/IniFile.h	Tue Nov 16 16:34:45 2010 +0000
+++ b/IniFile.h	Wed Nov 17 16:24:11 2010 +0000
@@ -48,12 +48,10 @@
 private:
 	FILE* m_fp;
 
-	Status strtrim(char* dst, const char* src, int dst_size);
-	
 	// Invalid method
 protected:
-	IniFile(const IniFile& v) {}
-	const IniFile& operator =(const IniFile& v) {return v;}
+	IniFile(const IniFile& v);
+	const IniFile& operator =(const IniFile& v);
 
 public:
 	IniFile(const char* file = 0);
@@ -66,7 +64,7 @@
 	Status get(const char* key, char* ret, int ret_size);
 	Status get(const char* key, int&  ret);
 	Status get(const char* key, bool& ret);
-	Status get(IniList* inilist);
+	Status get(const IniList* inilist);
 	
 	// For easy acccess
 	static Status getval(const char* inifile, const char* key, char* ret, int ret_size){
@@ -78,9 +76,18 @@
 	static Status getval(const char* inifile, const char* key, bool& ret){
 		return IniFile(inifile).get(key, ret);
 	}
-	static Status getval(const char* inifile, IniList* inilist){
+	static Status getval(const char* inifile, const IniList* inilist){
 		return IniFile(inifile).get(inilist);
 	}
+
+	// for string triming
+	static Status strtrim(char* dst, const char* src, int dst_size); // move to public
 };
 
+// for the table
+#define INIFILE_INT(key,  val)		{key,	IniFile::DTYPE_INT,		&val}
+#define INIFILE_BOOL(key, val)		{key,	IniFile::DTYPE_BOOL,	&val}
+#define INIFILE_STR(key, buf, size)	{key,	size,					buf}
+#define INIFILE_END					0
+
 #endif