本文整理汇总了C++中wxJSONValue::AsMap方法的典型用法代码示例。如果您正苦于以下问题:C++ wxJSONValue::AsMap方法的具体用法?C++ wxJSONValue::AsMap怎么用?C++ wxJSONValue::AsMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxJSONValue
的用法示例。
在下文中一共展示了wxJSONValue::AsMap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
if ( lastChar < 0 ) {
return lastChar;
}
}
// now iterate through all sub-items and call DoWrite() recursively
size = value.Size();
for ( int i = 0; i < size; i++ ) {
bool comma = false;
if ( i < size - 1 ) {
comma = true;
}
wxJSONValue v = value.ItemAt( i );
lastChar = DoWrite( os, v, 0, comma );
if ( lastChar < 0 ) {
return lastChar;
}
}
--m_level;
lastChar = WriteIndent( os );
if ( lastChar < 0 ) {
return lastChar;
}
os.PutC( ']' );
break;
case wxJSONTYPE_OBJECT :
++m_level;
os.PutC( '{' );
// the inline comment for objects and arrays are printed in the open char
if ( commentPos == wxJSONVALUE_COMMENT_INLINE ) {
commentPos = -1; // we have already written the comment
lastChar = WriteComment( os, value, false );
if ( lastChar < 0 ) {
return lastChar;
}
if ( lastChar != '\n' ) {
WriteSeparator( os );
}
}
else {
lastChar = WriteSeparator( os );
}
map = value.AsMap();
size = value.Size();
count = 0;
for ( it = map->begin(); it != map->end(); ++it ) {
// get the key and the value
wxString key = it->first;
const wxJSONValue& v = it->second;
bool comma = false;
if ( count < size - 1 ) {
comma = true;
}
lastChar = DoWrite( os, v, &key, comma );
if ( lastChar < 0 ) {
return lastChar;
}
count++;
}
--m_level;
lastChar = WriteIndent( os );
if ( lastChar < 0 ) {
return lastChar;
}
os.PutC( '}' );
break;
default :
// a not yet defined wxJSONType: we FAIL
wxFAIL_MSG( _T("wxJSONWriter::DoWrite() undefined wxJSONType type"));
break;
}
// writes the comma character before the inline comment
if ( comma ) {
os.PutC( ',' );
}
if ( commentPos == wxJSONVALUE_COMMENT_INLINE ) {
lastChar = WriteComment( os, value, false );
if ( lastChar < 0 ) {
return lastChar;
}
}
else if ( commentPos == wxJSONVALUE_COMMENT_AFTER ) {
WriteSeparator( os );
lastChar = WriteComment( os, value, true );
if ( lastChar < 0 ) {
return lastChar;
}
}
if ( lastChar != '\n' ) {
lastChar = WriteSeparator( os );
}
return lastChar;
}