bool CfgList::Parse (InputBuffer& buf, bool root) { if (!root) { buf.SkipWhitespace (); if (*buf != '{') { buf.Expecting ("{"); return false; } ++buf; } while (!buf.SkipWhitespace ()) { if (*buf == '}') { ++buf; return true; } childs.push_back (CfgListElem()); if (!childs.back ().Parse (buf)) return false; } if (!root && buf.end()) { buf.ShowLocation (), logger.Trace (NL_Debug, "Unexpected end of node at line\n"); return false; } return true; }
void CfgList::Parse (InputBuffer& buf, bool root) { if (!root) { buf.skipWhitespace (); if (*buf != '{') buf.expecting ("{"); ++buf; } while (!buf.skipWhitespace ()) { if (*buf == '}') { ++buf; return; } childs.push_back (CfgListElem()); childs.back ().Parse (buf); } if (!root && buf.end()) throw new ContentException(buf.location() + "Unexpected end of node at line\n"); }
bool CfgList::Parse (CfgBuffer& buf, bool root) { if (!root) { SkipWhitespace (buf); if (*buf != '{') { Expecting (buf, "{"); return false; } ++buf; } while (!SkipWhitespace (buf)) { if (*buf == '}') { ++buf; return true; } childs.push_back (CfgListElem()); if (!childs.back ().Parse (buf)) return false; } if (!root && buf.end()) { buf.ShowLocation (), logPrintf ("Unexpected end of node at line\n"); return false; } return true; }
void CfgList::AddNumeric (const char *name, double val) { CfgNumeric *n=new CfgNumeric; n->value=val; childs.push_back(CfgListElem()); childs.back().value=n; childs.back().name=name; }
void CfgList::AddLiteral (const char *name, const char *val) { CfgLiteral *l=new CfgLiteral; l->value = val; childs.push_back(CfgListElem()); childs.back().value=l; childs.back().name=name; }
void CfgList::AddValue (const char *name,CfgValue *val) { childs.push_back(CfgListElem()); childs.back().value=val; childs.back().name=name; }