12 #define COMMENT_CHAR '#' 27 bool open(
const std::string& filename) {
29 m_IF.open(filename.c_str());
39 m_IS.rdbuf(is.rdbuf());
63 while(
m_Key.empty() &&
86 std::ostringstream msg;
89 case ERR_OK: msg <<
"none";
break;
90 case ERR_FILE: msg <<
"error opening file";
break;
93 case ERR_EOF: msg <<
"end of file";
break;
100 operator bool ()
const {
return good(); }
102 operator std::istream& () {
return m_IS; }
106 static std::string
getPath(
const std::string& sfilename) {
107 dword slashpos = sfilename.rfind(
'/');
108 if(slashpos == sfilename.npos) slashpos = sfilename.rfind(
'\\');
109 if(slashpos != sfilename.npos)
return sfilename.substr(0,slashpos+1);
110 else return std::string(
"./");
123 std::string::reverse_iterator ch =
m_Line.rbegin();
124 while(ch!=
m_Line.rend() && *ch<=32) ch++;
126 std::istringstream lines(
m_Line);
127 std::string token, value;
const std::string & getFilename() const
const std::string & getLine() const
char getCommentChar() const
static std::string getPath(const std::string &sfilename)
const std::string & getValue() const
ParseFile(std::istream &is)
const std::string & getPath() const
const std::string & getKey() const
void appendErrMsg(const std::string &msg)
void setParseError(const std::string &msg="")
std::string getErrorMsg() const
std::list< std::string > m_PushedLines
ParseFile(const std::string &filename)
void pushLine(const std::string &line)
void attach(std::istream &is)
bool open(const std::string &filename)
void setCommentChar(char cchar)
const int getLineNumber() const