Merge default and non-default ctor.
Simplify a little.
This commit is contained in:
+15
-20
@@ -18,11 +18,6 @@
|
|||||||
// Construction/Destruction
|
// Construction/Destruction
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//default constructor
|
|
||||||
IniFile::IniFile()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//constructor, can specify pathname here instead of using SetPath later
|
//constructor, can specify pathname here instead of using SetPath later
|
||||||
IniFile::IniFile(CString inipath)
|
IniFile::IniFile(CString inipath)
|
||||||
{
|
{
|
||||||
@@ -64,23 +59,23 @@ bool IniFile::ReadFile()
|
|||||||
CString line;
|
CString line;
|
||||||
while (file.ReadString(line))
|
while (file.ReadString(line))
|
||||||
{
|
{
|
||||||
if (line != "")
|
if (line == "")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (line[0] == '[' && line[line.GetLength()-1] == ']') //if a section heading
|
||||||
{
|
{
|
||||||
if (line[0] == '[' && line[line.GetLength()-1] == ']') //if a section heading
|
keyname = line;
|
||||||
|
keyname.TrimLeft('[');
|
||||||
|
keyname.TrimRight(']');
|
||||||
|
}
|
||||||
|
else //if a value
|
||||||
|
{
|
||||||
|
int iEqualIndex = line.Find("=");
|
||||||
|
if( iEqualIndex != -1 )
|
||||||
{
|
{
|
||||||
keyname = line;
|
valuename = line.Left(iEqualIndex);
|
||||||
keyname.TrimLeft('[');
|
value = line.Right(line.GetLength()-valuename.GetLength()-1);
|
||||||
keyname.TrimRight(']');
|
SetValue(keyname,valuename,value);
|
||||||
}
|
|
||||||
else //if a value
|
|
||||||
{
|
|
||||||
int iEqualIndex = line.Find("=");
|
|
||||||
if( iEqualIndex != -1 )
|
|
||||||
{
|
|
||||||
valuename = line.Left(iEqualIndex);
|
|
||||||
value = line.Right(line.GetLength()-valuename.GetLength()-1);
|
|
||||||
SetValue(keyname,valuename,value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,11 +57,8 @@ public:
|
|||||||
|
|
||||||
//public functions
|
//public functions
|
||||||
public:
|
public:
|
||||||
//default constructor
|
|
||||||
IniFile();
|
|
||||||
|
|
||||||
//constructor, can specify pathname here instead of using SetPath later
|
//constructor, can specify pathname here instead of using SetPath later
|
||||||
IniFile(CString inipath);
|
IniFile(CString inipath = "");
|
||||||
|
|
||||||
//default destructor
|
//default destructor
|
||||||
virtual ~IniFile();
|
virtual ~IniFile();
|
||||||
|
|||||||
Reference in New Issue
Block a user