本文整理汇总了C++中wxJSONValue::GetCommentCount方法的典型用法代码示例。如果您正苦于以下问题:C++ wxJSONValue::GetCommentCount方法的具体用法?C++ wxJSONValue::GetCommentCount怎么用?C++ wxJSONValue::GetCommentCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxJSONValue
的用法示例。
在下文中一共展示了wxJSONValue::GetCommentCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
/*!
This is a recursive function that gets the type of the \c value object and
calls several protected functions depending on the type:
\li \c WriteNullvalue for type NULL
\li \c WriteStringValue() for STRING and CSTRING types
\li \c WriteIntValue for INT types
\li \c WriteUIntValue for UINT types
\li \c WriteBoolValue for BOOL types
\li \c WriteDoubleValue for DOUBLE types
\li \c WriteMemoryBuff for MEMORYBUFF types
If the value is an array or key/value map (types ARRAY and OBJECT), the function
iterates through all JSON value object in the array/map and calls itself for every
item in the container.
*/
int
wxJSONWriter::DoWrite( wxOutputStream& os, const wxJSONValue& value, const wxString* key, bool comma )
{
// note that this function is recursive
// some variables that cannot be allocated in the switch statement
const wxJSONInternalMap* map = 0;
int size;
m_colNo = 1; m_lineNo = 1;
// determine the comment position; it is one of:
//
// wxJSONVALUE_COMMENT_BEFORE
// wxJSONVALUE_COMMENT_AFTER
// wxJSONVALUE_COMMENT_INLINE
//
// or -1 if comments have not to be written
int commentPos = -1;
if ( value.GetCommentCount() > 0 && (m_style & wxJSONWRITER_WRITE_COMMENTS)) {
commentPos = value.GetCommentPos();
if ( ( m_style & wxJSONWRITER_COMMENTS_BEFORE) != 0 ) {
commentPos = wxJSONVALUE_COMMENT_BEFORE;
}
else if ( (m_style & wxJSONWRITER_COMMENTS_AFTER) != 0 ) {
commentPos = wxJSONVALUE_COMMENT_AFTER;
}
}
int lastChar = 0; // check if WriteComment() writes the last LF char
// first write the comment if it is BEFORE
if ( commentPos == wxJSONVALUE_COMMENT_BEFORE ) {
lastChar = WriteComment( os, value, true );
if ( lastChar < 0 ) {
return lastChar;
}
else if ( lastChar != '\n' ) {
WriteSeparator( os );
}
}
lastChar = WriteIndent( os );
if ( lastChar < 0 ) {
return lastChar;
}
// now write the key if it is not NULL
if ( key ) {
lastChar = WriteKey( os, *key );
}
if ( lastChar < 0 ) {
return lastChar;
}
// now write the value
wxJSONInternalMap::const_iterator it; // declare the map object
long int count = 0;
wxJSONType t = value.GetType();
switch ( t ) {
case wxJSONTYPE_INVALID :
WriteInvalid( os );
wxFAIL_MSG( _T("wxJSONWriter::WriteEmpty() cannot be called (not a valid JSON text"));
break;
case wxJSONTYPE_INT :
case wxJSONTYPE_SHORT :
case wxJSONTYPE_LONG :
case wxJSONTYPE_INT64 :
lastChar = WriteIntValue( os, value );
break;
case wxJSONTYPE_UINT :
case wxJSONTYPE_USHORT :
case wxJSONTYPE_ULONG :
case wxJSONTYPE_UINT64 :
lastChar = WriteUIntValue( os, value );
break;
case wxJSONTYPE_NULL :
lastChar = WriteNullValue( os );
break;
case wxJSONTYPE_BOOL :
lastChar = WriteBoolValue( os, value );
break;
//.........这里部分代码省略.........