Added the new recipe parser, parsing the crafting.txt file. Included are a few recipes. The old parser still works, but will be replaced soon.
git-svn-id: http://mc-server.googlecode.com/svn/trunk@549 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
@@ -88,10 +88,7 @@ AStringVector StringSplit(const AString & str, const AString & delim)
|
||||
size_t Prev = 0;
|
||||
while ((cutAt = str.find_first_of(delim, Prev)) != str.npos)
|
||||
{
|
||||
if (cutAt > 0)
|
||||
{
|
||||
results.push_back(str.substr(Prev, cutAt - Prev));
|
||||
}
|
||||
results.push_back(str.substr(Prev, cutAt - Prev));
|
||||
Prev = cutAt + delim.length();
|
||||
}
|
||||
if (Prev < str.length())
|
||||
@@ -104,6 +101,40 @@ AStringVector StringSplit(const AString & str, const AString & delim)
|
||||
|
||||
|
||||
|
||||
AString TrimString(const AString & str)
|
||||
{
|
||||
size_t len = str.length();
|
||||
size_t start = 0;
|
||||
while (start < len)
|
||||
{
|
||||
if (str[start] > 32)
|
||||
{
|
||||
break;
|
||||
}
|
||||
++start;
|
||||
}
|
||||
if (start == len)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
size_t end = len;
|
||||
while (end >= start)
|
||||
{
|
||||
if (str[end] > 32)
|
||||
{
|
||||
break;
|
||||
}
|
||||
--end;
|
||||
}
|
||||
|
||||
return str.substr(start, end - start + 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
AString & StrToUpper(AString & s)
|
||||
{
|
||||
AString::iterator i = s.begin();
|
||||
|
||||
Reference in New Issue
Block a user