Merge default and non-default ctor.

Simplify a little.
This commit is contained in:
Glenn Maynard
2002-08-20 02:12:19 +00:00
parent 4e2993f370
commit a6815a7744
2 changed files with 16 additions and 24 deletions
+15 -20
View File
@@ -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);
}
} }
} }
} }
+1 -4
View File
@@ -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();