本文整理汇总了C++中CGPValue::Parse方法的典型用法代码示例。如果您正苦于以下问题:C++ CGPValue::Parse方法的具体用法?C++ CGPValue::Parse怎么用?C++ CGPValue::Parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGPValue
的用法示例。
在下文中一共展示了CGPValue::Parse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Parse
bool CGPGroup::Parse(char **dataPtr, CTextPool **textPool)
{
char *token;
char lastToken[MAX_TOKEN_SIZE];
CGPGroup *newSubGroup;
CGPValue *newPair;
while(1)
{
token = GetToken(dataPtr, true);
if (!token[0])
{ // end of data - error!
if (mParent)
{
return false;
}
else
{
break;
}
}
else if (strcmpi(token, "}") == 0)
{ // ending brace for this group
break;
}
strcpy(lastToken, token);
// read ahead to see what we are doing
token = GetToken(dataPtr, true, true);
if (strcmpi(token, "{") == 0)
{ // new sub group
newSubGroup = AddGroup(lastToken, textPool);
newSubGroup->SetWriteable(mWriteable);
if (!newSubGroup->Parse(dataPtr, textPool))
{
return false;
}
}
else if (strcmpi(token, "[") == 0)
{ // new pair list
newPair = AddPair(lastToken, 0, textPool);
if (!newPair->Parse(dataPtr, textPool))
{
return false;
}
}
else
{ // new pair
AddPair(lastToken, token, textPool);
}
}
return true;
}
示例2: Parse
void CGPGroup::Parse(char **dataPtr, CTextPool **textPool)
{
char *token;
char lastToken[MAX_TOKEN_SIZE];
CGPGroup *newSubGroup;
CGPValue *newPair;
char *name, *value;
while(1)
{
token = GetToken(dataPtr, true);
if (!token[0])
{ // end of data - error!
break;
}
else if (Q_strcmpi(token, "}") == 0)
{ // ending brace for this group
break;
}
strcpy(lastToken, token);
// read ahead to see what we are doing
token = GetToken(dataPtr, true, true);
if (Q_strcmpi(token, "{") == 0)
{ // new sub group
name = (*textPool)->AllocText(lastToken, true, textPool);
newSubGroup = AddGroup(name);
newSubGroup->SetWriteable(mWriteable);
newSubGroup->Parse(dataPtr, textPool);
}
else if (Q_strcmpi(token, "[") == 0)
{ // new pair list
name = (*textPool)->AllocText(lastToken, true, textPool);
newPair = AddPair(name, 0);
newPair->Parse(dataPtr, textPool);
}
else
{ // new pair
name = (*textPool)->AllocText(lastToken, true, textPool);
value = (*textPool)->AllocText(token, true, textPool);
AddPair(name, value);
}
}
}