#include <stdlib.h>
#include <math.h>
-static const char *IdSrc = "$Header$";
-static const char *IdHdr = "ID_CONFIGFILE";
+static const char *IdSrc = "$Id$";
+static const char *IdHdr = ID_CONFIGFILE;
+
+extern short debug_lvl;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
FGConfigFile::FGConfigFile(string cfgFileName)
{
- cfgfile.open(cfgFileName.c_str());
+ cfgfile.open(cfgFileName.c_str(), ios::in | ios::binary );
CommentsOn = false;
CurrentIndex = 0;
Opened = true;
if (cfgfile.is_open()) GetNextConfigLine();
else Opened = false;
+
+ if (debug_lvl & 2) cout << "Instantiated: FGConfigFile" << endl;
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-FGConfigFile::~FGConfigFile(void)
+FGConfigFile::~FGConfigFile()
{
cfgfile.close();
+ if (debug_lvl & 2) cout << "Destroyed: FGConfigFile" << endl;
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGConfigFile::GetNextConfigLine(void)
{
do {
CurrentLine = GetLine();
- if (CurrentLine.find("<COMMENT>") != CurrentLine.npos) CommentsOn = true;
- if (CurrentLine.find("</COMMENT>") != CurrentLine.npos) {
+ if ((CurrentLine.find("<COMMENT>") != CurrentLine.npos) ||
+ (CurrentLine.find("<!--") != CurrentLine.npos)) CommentsOn = true;
+ if ((CurrentLine.find("</COMMENT>") != CurrentLine.npos) ||
+ (CurrentLine.find("-->") != CurrentLine.npos)) {
CommentsOn = false;
GetNextConfigLine();
}
return CurrentLine;
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGConfigFile::GetValue(string val)
{
return string("");
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGConfigFile::GetValue(void)
{
return GetValue("");
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGConfigFile::IsCommentLine(void)
{
return false;
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGConfigFile::GetLine(void)
{
string scratch = "";
- unsigned int test;
+ int test;
while ((test = cfgfile.get()) != EOF) {
if (test >= 0x20) {
return scratch;
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
FGConfigFile& FGConfigFile::operator>>(double& val)
{
unsigned int pos, end;
return *this;
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
FGConfigFile& FGConfigFile::operator>>(float& val)
{
unsigned int pos, end;
return *this;
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
FGConfigFile& FGConfigFile::operator>>(int& val)
{
unsigned int pos, end;
return *this;
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
FGConfigFile& FGConfigFile::operator>>(eParam& val)
{
unsigned int pos, end;
return *this;
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
FGConfigFile& FGConfigFile::operator>>(string& str)
{
unsigned int pos, end;
return *this;
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGConfigFile::ResetLineIndexToZero(void)
{
CurrentIndex = 0;
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+void FGConfigFile::Debug(void)
+{
+ //TODO: Add your source code here
+}
+