Beispiel #1
0
CfgList* CfgValue::LoadNestedFile (InputBuffer& buf)
{
	std::string s;
	buf.skipKeyword ("@include");

	buf.skipWhitespace ();

	CfgLiteral l;
	l.Parse (buf);
	s = l.value;

	// insert the path of the current file in the string
	int i = strlen (buf.filename)-1;
	while (i > 0) {
		if (buf.filename [i]=='\\' || buf.filename [i] == '/')
			break;
		i--;
	}

	s.insert (s.begin(), buf.filename, buf.filename + i + 1);
	return LoadFile (s.c_str());
}
CfgList* CfgValue::LoadNestedFile (CfgBuffer& buf)
{
	string s;
	if (!SkipKeyword (buf, "file"))
		return 0;

	SkipWhitespace (buf);

	CfgLiteral l;
	if (!l.Parse (buf))
		return 0;
	s = l.value;

	// insert the path of the current file in the string
	int i = strlen (buf.filename)-1;
	while (i > 0) {
		if (buf.filename [i]=='\\' || buf.filename [i] == '/')
			break;
		i--;
	}

	s.insert (s.begin(), buf.filename, buf.filename + i + 1);
	return LoadFile (s.c_str());
}