void RenJS::parseGame() { mFilePath = mGameFile.GetFilePath(); CString strLine; if (!mGameFile.ReadString(strLine)) { throw Exception(READ_FILE_ERROR); } Utils::trim(strLine); int left = strLine.Find("["); int right = strLine.Find("]", left); while (left < right) { CString strMove(strLine.Mid(left + 1, right - left - 1)); parseMove(strMove); left = strLine.Find("[", right); right = strLine.Find("]", left); } }
char *rmlead(char *str) /* Removes leading space from a string */ { char *obuf; if (str) { for (obuf = str; *obuf && isspace(*obuf); ++obuf); if (str != obuf) strMove(str, obuf); } return str; }
/* * Remove leading white spaces from a string */ char * RmLeadingSpaces (char *str) { char *obuf; if (str) { for (obuf = str; *obuf && isspace (*obuf); ++obuf) ; if (str != obuf) strMove (str, obuf); } return str; }