本文整理汇总了C++中JSONNode::getEnd方法的典型用法代码示例。如果您正苦于以下问题:C++ JSONNode::getEnd方法的具体用法?C++ JSONNode::getEnd怎么用?C++ JSONNode::getEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSONNode
的用法示例。
在下文中一共展示了JSONNode::getEnd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseObject
/**
* This parses a javascript objet from the content
*/
void JSONNode::parseObject(){
if(m_debug)
cout<<"[parseObject] "<<m_start<<" "<<m_end<<endl;
int start=m_start;
int end=m_end;
while(m_content[start]!='{')
start++;
while(m_content[end]!='}')
end--;
start++;
end--;
while(start<=end){
// find the opening " for the key
int findNextKey=start;
while(m_content[findNextKey]!='"' && findNextKey<=end){
findNextKey++;
}
// no more keys
if(m_content[findNextKey]!='"'){
if(m_debug)
cout<<"[parseObject] no more keys"<<endl;
break;
}
if(m_debug){
cout<<"[parseObject] findNextKey -> "<<findNextKey<<" "<<m_content[findNextKey]<<endl;
cout<<"[parseObject] find key"<<endl;
}
JSONNode key;
pullString(&key,start);
// find the first non-white-space character
int firstNextSymbol=key.getEnd();
firstNextSymbol++;
// TODO: this code will work with "key"::: "Value" but should not
while(m_content[firstNextSymbol]==' '||m_content[firstNextSymbol]=='\t'||m_content[firstNextSymbol]=='\n'
|| m_content[firstNextSymbol]==':'){
firstNextSymbol++;
}
if(m_debug)
cout<<"[parseObject] find value"<<endl;
JSONNode value;
pullContent(&value,firstNextSymbol);
start=value.getEnd();
start++;
// Skip the ','
// TODO: this code will work with "key",,,, but should not
while(m_content[start]==' '||m_content[start]=='\t'||m_content[start]=='\n'
|| m_content[start]==','){
start++;
}
m_associativeKeyContent.push_back(key);
m_associativeValueContent.push_back(value);
}
}
示例2: parseArray
void JSONNode::parseArray(){
if(m_debug)
cout<<"[parseArray] "<<m_start<<" "<<m_end<<endl;
int start=m_start;
int end=m_end;
while(m_content[start]!='[')
start++;
while(m_content[end]!=']')
end--;
start++;
end--;
while(start<=end){
// find the opening " for the key
int findNextKey=start;
while(!isDigitSymbol(m_content[findNextKey])
&& m_content[findNextKey]!='{' && m_content[findNextKey]!='['
&& m_content[findNextKey]!='"' && findNextKey<=end){
findNextKey++;
}
// no more keys
if(!isDigitSymbol(m_content[findNextKey])
&& m_content[findNextKey]!='{' && m_content[findNextKey]!='['
&& m_content[findNextKey]!='"' ){
if(m_debug)
cout<<"[parseObject] no more values"<<endl;
break;
}
if(m_debug)
cout<<"[parseArray] findNextKey -> "<<findNextKey<<" "<<m_content[findNextKey]<<endl;
// find the first non-white-space character
int firstNextSymbol=start;
while(m_content[firstNextSymbol]==' '||m_content[firstNextSymbol]=='\t'
||m_content[firstNextSymbol]=='\n'){
firstNextSymbol++;
}
if(m_debug)
cout<<"[parseArray] find value"<<endl;
JSONNode value;
pullContent(&value,firstNextSymbol);
start=value.getEnd();
start++;
// Skip the ','
// TODO: this code will work with "key",,,, but should not
while(m_content[start]==' '||m_content[start]=='\t'||m_content[start]=='\n'
|| m_content[start]==','){
start++;
}
m_arrayContent.push_back(value);
}
}