本文整理汇总了C++中json::ObjectEncoder类的典型用法代码示例。如果您正苦于以下问题:C++ ObjectEncoder类的具体用法?C++ ObjectEncoder怎么用?C++ ObjectEncoder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ObjectEncoder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: encodeJSON
void DictImpl::encodeJSON( void const *data, JSON::Encoder &encoder ) const
{
RC::ConstHandle<StringImpl> keyImplAsStringImpl;
if ( isString( m_keyImpl->getType() ) )
keyImplAsStringImpl = RC::ConstHandle<StringImpl>::StaticCast( m_keyImpl );
JSON::ObjectEncoder objectEncoder = encoder.makeObject();
bits_t const *bits = *reinterpret_cast<bits_t const * const *>( data );
if ( bits )
{
node_t *node = bits->firstNode;
while ( node )
{
void const *keyData = immutableKeyData( node );
void const *valueData = immutableValueData( node );
if ( keyImplAsStringImpl )
{
JSON::Encoder memberEncoder = objectEncoder.makeMember( keyImplAsStringImpl->getValueData( keyData ), keyImplAsStringImpl->getValueLength( keyData ) );
m_valueImpl->encodeJSON( valueData, memberEncoder );
}
else
{
Util::SimpleString encodedKey;
{
JSON::Encoder encodedKeyEncoder( &encodedKey );
m_keyImpl->encodeJSON( keyData, encodedKeyEncoder );
}
JSON::Encoder memberEncoder = objectEncoder.makeMember( encodedKey );
m_valueImpl->encodeJSON( valueData, memberEncoder );
}
node = node->bitsNextNode;
}
}
}
示例2: appendJSONMembers
void MethodOp::appendJSONMembers( JSON::ObjectEncoder const &jsonObjectEncoder, bool includeLocation ) const
{
Expr::appendJSONMembers( jsonObjectEncoder, includeLocation );
m_expr->appendJSON( jsonObjectEncoder.makeMember( "expr" ), includeLocation );
jsonObjectEncoder.makeMember( "methodName" ).makeString( m_name );
m_args->appendJSON( jsonObjectEncoder.makeMember( "args" ), includeLocation );
}
示例3: appendJSONMembers
void CreateArrayGenerator::appendJSONMembers( JSON::ObjectEncoder const &jsonObjectEncoder, bool includeLocation ) const
{
Expr::appendJSONMembers( jsonObjectEncoder, includeLocation );
m_count->appendJSON( jsonObjectEncoder.makeMember( "count" ), includeLocation );
jsonObjectEncoder.makeMember( "operatorName" ).makeString( m_operatorName );
m_shared->appendJSON( jsonObjectEncoder.makeMember( "shared" ), includeLocation );
}
示例4: appendJSONMembers
void ContainerLoop::appendJSONMembers( JSON::ObjectEncoder const &jsonObjectEncoder, bool includeLocation ) const
{
Statement::appendJSONMembers( jsonObjectEncoder, includeLocation );
m_dictExpr->appendJSON( jsonObjectEncoder.makeMember( "dictExpr" ), includeLocation );
jsonObjectEncoder.makeMember( "keyName" ).makeString( m_keyName );
if ( m_valueName.length() > 0 )
jsonObjectEncoder.makeMember( "valueName" ).makeString( m_valueName );
m_body->appendJSON( jsonObjectEncoder.makeMember( "body" ), includeLocation );
}
示例5: toJSON
void ProducerWrapper::toJSON( JSON::Encoder &jsonEncoder ) const
{
JSON::ObjectEncoder jsonObjectEncoder = jsonEncoder.makeObject();
{
JSON::Encoder typeNameEncoder = jsonObjectEncoder.makeMember( "kind" );
typeNameEncoder.makeString( getKind() );
}
toJSONImpl( jsonObjectEncoder );
}
示例6: jsonDesc
void Inst::jsonDesc( JSON::Encoder &resultEncoder ) const
{
JSON::ObjectEncoder resultObjectEncoder = resultEncoder.makeObject();
{
JSON::Encoder memberEncoder = resultObjectEncoder.makeMember( "code", 4 );
memberEncoder.makeString( m_code );
}
{
JSON::Encoder memberEncoder = resultObjectEncoder.makeMember( "jsConstants", 11 );
memberEncoder.makeString( m_jsConstants );
}
}
示例7: toJSONImpl
void ArrayCacheWrapper::toJSONImpl( JSON::ObjectEncoder &objectEncoder ) const
{
{
JSON::Encoder inputEncoder = objectEncoder.makeMember( "input" );
m_inputArrayProducer->toJSON( inputEncoder );
}
}
示例8: JSONProduceAsyncUserdata
JSONProduceAsyncUserdata( RC::Handle<ValueProducerWrapper> const &valueProducerWrapper_, int32_t serial )
: valueProducerWrapper( valueProducerWrapper_ )
, notifyJSONArg( new Util::SimpleString )
, notifyJSONArgEncoder( notifyJSONArg )
, notifyJSONArgObjectEncoder( notifyJSONArgEncoder.makeObject() )
{
notifyJSONArgObjectEncoder.makeMember( "serial" ).makeInteger( serial );
}
示例9: toJSONImpl
void ArrayTransformWrapper::toJSONImpl( JSON::ObjectEncoder &objectEncoder ) const
{
{
JSON::Encoder jg = objectEncoder.makeMember( "input" );
m_inputArrayProducer->toJSON( jg );
}
{
JSON::Encoder jg = objectEncoder.makeMember( "operator" );
m_operator->toJSON( jg );
}
if ( m_sharedValueProducer )
{
JSON::Encoder jg = objectEncoder.makeMember( "shared" );
m_sharedValueProducer->toJSON( jg );
}
}
示例10: onProgress
void ResourceLoadNode::onProgress( char const *mimeType, size_t done, size_t total, void *userData )
{
if( (size_t)userData != m_streamGeneration )
return;
size_t prevSize = m_fabricResourceStreamData.getDataSize();
if ( total < prevSize )
m_fabricResourceStreamData.resizeData( total );
if( done < total )
{
std::vector<std::string> src;
src.push_back( "DG" );
src.push_back( getName() );
Util::SimpleString json;
{
JSON::Encoder jsonEncoder( &json );
JSON::ObjectEncoder jsonObjectEncoder = jsonEncoder.makeObject();
{
JSON::Encoder memberEncoder = jsonObjectEncoder.makeMember( "received", 8 );
memberEncoder.makeInteger( done );
}
{
JSON::Encoder memberEncoder = jsonObjectEncoder.makeMember( "total", 5 );
memberEncoder.makeInteger( total );
}
}
getContext()->jsonNotify( src, "resourceLoadProgress", 20, &json );
}
else
{
m_fabricResourceStreamData.setMIMEType( mimeType );
m_inProgress = false;//[JeromeCG 20111221] Important: set m_inProgress to false since setResourceData's notifications can trigger an evaluation
setResourceData( NULL, true );
}
}
示例11: appendJSONMembers
void ConstString::appendJSONMembers( JSON::ObjectEncoder const &jsonObjectEncoder, bool includeLocation ) const
{
Expr::appendJSONMembers( jsonObjectEncoder, includeLocation );
jsonObjectEncoder.makeMember( "value" ).makeString( m_value );
}
示例12: appendJSONMembers
void ReturnStatement::appendJSONMembers( JSON::ObjectEncoder const &jsonObjectEncoder, bool includeLocation ) const
{
Statement::appendJSONMembers( jsonObjectEncoder, includeLocation );
if ( m_expr )
m_expr->appendJSON( jsonObjectEncoder.makeMember( "expr" ), includeLocation );
}
示例13: toJSONImpl
void ConstValueWrapper::toJSONImpl( JSON::ObjectEncoder &objectEncoder ) const
{
JSON::Encoder jg = objectEncoder.makeMember( "data" );
m_unwrapped->getValueDesc()->encodeJSON( m_unwrapped->getImmutableData(), jg );
}
示例14: appendJSONMembers
void MemberDecl::appendJSONMembers( JSON::ObjectEncoder const &jsonObjectEncoder, bool includeLocation ) const
{
Node::appendJSONMembers( jsonObjectEncoder, includeLocation );
jsonObjectEncoder.makeMember( "name" ).makeString( m_name );
jsonObjectEncoder.makeMember( "type" ).makeString( m_type );
}
示例15: appendJSONMembers
void AssignOpImpl::appendJSONMembers( JSON::ObjectEncoder const &jsonObjectEncoder, bool includeLocation ) const
{
FunctionBase::appendJSONMembers( jsonObjectEncoder, includeLocation );
jsonObjectEncoder.makeMember( "op" ).makeString( CG::assignOpUserName( m_assignOpType ) );
m_rhs->appendJSON( jsonObjectEncoder.makeMember( "rhs" ), includeLocation );
}