这篇教程C++ writeWithIndent函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中writeWithIndent函数的典型用法代码示例。如果您正苦于以下问题:C++ writeWithIndent函数的具体用法?C++ writeWithIndent怎么用?C++ writeWithIndent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了writeWithIndent函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: switchvoid StyledStreamWriter::writeValue( const Value &value ){ switch ( value.type() ) { case nullValue: pushValue( "null" ); break; case intValue: pushValue( valueToString( value.asLargestInt() ) ); break; case uintValue: pushValue( valueToString( value.asLargestUInt() ) ); break; case realValue: pushValue( valueToString( value.asDouble() ) ); break; case stringValue: //pushValue( valueToQuotedString( value.asCString() ) ); pushValue(value.asCString()); break; case booleanValue: pushValue( valueToString( value.asBool() ) ); break; case arrayValue: writeArrayValue( value); break; case objectValue: { Value::Members members( value.getMemberNames() ); if ( members.empty() ) pushValue( "{}" ); else { writeWithIndent( "{" ); indent(); Value::Members::iterator it = members.begin(); for (;;) { const std::string &name = *it; const Value &childValue = value[name]; writeCommentBeforeValue( childValue ); writeWithIndent( valueToQuotedString( name.c_str() ) ); *document_ << " : "; writeValue( childValue ); if ( ++it == members.end() ) { writeCommentAfterValueOnSameLine( childValue ); break; } *document_ << ","; writeCommentAfterValueOnSameLine( childValue ); } unindent(); writeWithIndent( "}" ); } } break; }}
开发者ID:intwzt,项目名称:HHU_Agent,代码行数:60,
示例2: pushValuevoidStyledStreamWriter::writeArrayValue ( const Value& value ){ unsigned size = value.size (); if ( size == 0 ) pushValue ( "[]" ); else { bool isArrayMultiLine = isMultineArray ( value ); if ( isArrayMultiLine ) { writeWithIndent ( "[" ); indent (); bool hasChildValue = !childValues_.empty (); unsigned index = 0; while ( true ) { const Value& childValue = value[index]; if ( hasChildValue ) writeWithIndent ( childValues_[index] ); else { writeIndent (); writeValue ( childValue ); } if ( ++index == size ) break; *document_ << ","; } unindent (); writeWithIndent ( "]" ); } else // output on a single line { assert ( childValues_.size () == size ); *document_ << "[ "; for ( unsigned index = 0; index < size; ++index ) { if ( index > 0 ) *document_ << ", "; *document_ << childValues_[index]; } *document_ << " ]"; } }}
开发者ID:CFQuantum,项目名称:CFQuantumd,代码行数:56,
示例3: pushValuevoid StyledWriter::writeArrayValue( const Value &value ){ unsigned size = value.size(); if ( size == 0 ) pushValue( "[]" ); else { bool isArrayMultiLine = isMultineArray( value ); if ( isArrayMultiLine ) { writeWithIndent( "[" ); indent(); bool hasChildValue = !childValues_.empty(); unsigned index =0; for (;;) { const Value &childValue = value[index]; writeCommentBeforeValue( childValue ); if ( hasChildValue ) writeWithIndent( childValues_[index] ); else { writeIndent(); writeValue( childValue ); } if ( ++index == size ) { writeCommentAfterValueOnSameLine( childValue ); break; } document_ += ","; writeCommentAfterValueOnSameLine( childValue ); } unindent(); writeWithIndent( "]" ); } else // output on a single line { assert( childValues_.size() == size ); document_ += "[ "; for ( unsigned index =0; index < size; ++index ) { if ( index > 0 ) document_ += ", "; document_ += childValues_[index]; } document_ += " ]"; } }}
开发者ID:vateran,项目名称:todengine,代码行数:51,
示例4: pushValuevoid BuiltStyledStreamWriter::writeArrayValue(Value const& value) { unsigned size = value.size(); if (size == 0) pushValue("[]"); else { bool isMultiLine = (cs_ == CommentStyle::All) || isMultineArray(value); if (isMultiLine) { writeWithIndent("["); indent(); bool hasChildValue = !childValues_.empty(); unsigned index = 0; for (;;) { Value const& childValue = value[index]; writeCommentBeforeValue(childValue); if (hasChildValue) writeWithIndent(childValues_[index]); else { if (!indented_) writeIndent(); indented_ = true; writeValue(childValue); indented_ = false; } if (++index == size) { writeCommentAfterValueOnSameLine(childValue); break; } sout_ << ","; writeCommentAfterValueOnSameLine(childValue); } unindent(); writeWithIndent("]"); } else // output on a single line { assert(childValues_.size() == size); sout_ << "["; if (!indentation_.empty()) sout_ << " "; for (unsigned index = 0; index < size; ++index) { if (index > 0) sout_ << ", "; sout_ << childValues_[index]; } if (!indentation_.empty()) sout_ << " "; sout_ << "]"; } }}
开发者ID:robsonswiss,项目名称:OSVR-user-settings,代码行数:46,
示例5: switchvoidStyledWriter::writeValue ( const Value& value ){ switch ( value.type () ) { case nullValue: pushValue ( "null" ); break; case intValue: pushValue ( valueToString ( value.asInt () ) ); break; case uintValue: pushValue ( valueToString ( value.asUInt () ) ); break; case realValue: pushValue ( valueToString ( value.asDouble () ) ); break; case stringValue: pushValue ( valueToQuotedString ( value.asCString () ) ); break; case booleanValue: pushValue ( valueToString ( value.asBool () ) ); break; case arrayValue: writeArrayValue ( value); break; case objectValue: { Value::Members members ( value.getMemberNames () ); if ( members.empty () ) pushValue ( "{}" ); else { writeWithIndent ( "{" ); indent (); Value::Members::iterator it = members.begin (); while ( true ) { std::string const& name = *it; const Value& childValue = value[name]; writeWithIndent ( valueToQuotedString ( name.c_str () ) ); document_ += " : "; writeValue ( childValue ); if ( ++it == members.end () ) break; document_ += ","; } unindent (); writeWithIndent ( "}" ); } } break; }}
开发者ID:CFQuantum,项目名称:CFQuantumd,代码行数:66,
注:本文中的writeWithIndent函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ writeWord函数代码示例 C++ writeValue函数代码示例 |