本文整理汇总了C++中CoreDict::isBlessed方法的典型用法代码示例。如果您正苦于以下问题:C++ CoreDict::isBlessed方法的具体用法?C++ CoreDict::isBlessed怎么用?C++ CoreDict::isBlessed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CoreDict
的用法示例。
在下文中一共展示了CoreDict::isBlessed方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Dictionary_mfcomp
FALCON_FUNC Dictionary_mfcomp ( ::Falcon::VMachine *vm )
{
Item* i_func = vm->param(0);
if ( i_func == 0 )
{
throw new ParamError( ErrorParam( e_inv_params, __LINE__ )
.extra( "C, ..." ) );
}
// Save the parameters as the stack may change greatly.
CoreDict* dict = vm->self().asDict();
StackFrame* current = vm->currentFrame();
Item i_check = *i_func;
// if this is a blessed dictionary, we must use the append method.
if ( dict->isBlessed() )
{
// this will throw if dict has not "append"
PoopSeq *seq = new PoopSeq( vm, dict );
vm->pushParam( new GarbagePointer( seq ) );
seq->comprehension_start( vm, dict, i_check );
}
else {
dict->items().comprehension_start( vm, dict, i_check );
}
for( uint32 i = 1; i < current->m_param_count; ++i )
{
vm->pushParam( current->m_params[i] );
}
}
示例2: Dictionary_comp
FALCON_FUNC Dictionary_comp ( ::Falcon::VMachine *vm )
{
if ( vm->param(0) == 0 )
{
throw new ParamError( ErrorParam( e_inv_params, __LINE__ )
.extra( "R|A|C|Sequence, [C]" ) );
}
// Save the parameters as the stack may change greatly.
CoreDict* dict = vm->self().asDict();
Item i_gen = *vm->param(0);
Item i_check = vm->param(1) == 0 ? Item(): *vm->param(1);
// if this is a blessed dictionary, we must use the append method.
if ( dict->isBlessed() )
{
// this will throw if dict has not "append"
PoopSeq *seq = new PoopSeq( vm, dict );
vm->pushParam( new GarbagePointer( seq ) );
seq->comprehension_start( vm, dict, i_check );
}
else {
dict->items().comprehension_start( vm, dict, i_check );
}
vm->pushParam( i_gen );
}
示例3: Dictionary_mcomp
FALCON_FUNC Dictionary_mcomp ( ::Falcon::VMachine *vm )
{
// Save the parameters as the stack may change greatly.
CoreDict* dict = vm->self().asDict();
StackFrame* current = vm->currentFrame();
// if this is a blessed dictionary, we must use the append method.
if ( dict->isBlessed() )
{
// this will throw if dict has not "append"
PoopSeq *seq = new PoopSeq( vm, dict );
vm->pushParam( new GarbagePointer( seq ) );
seq->comprehension_start( vm, dict, Item() );
}
else {
dict->items().comprehension_start( vm, dict, Item() );
}
for( uint32 i = 0; i < current->m_param_count; ++i )
{
vm->pushParam( current->m_params[i] );
}
}
示例4: describe_internal
//.........这里部分代码省略.........
if ( count == (uint32) maxSize )
tgt += " ...";
tgt += "]";
}
break;
case FLC_ITEM_ARRAY:
{
CoreArray *arr = elem->asArray();
tgt += "[";
if ( level == maxLevel )
{
tgt += "...]";
break;
}
for( count = 0; count < arr->length(); count++ ) {
if ( count == 0 ) tgt += " ";
describe_internal( vm, tgt, & ((*arr)[count]), level + 1, maxLevel, maxSize );
if ( count + 1 < arr->length() )
tgt += ", ";
}
tgt +="]";
}
break;
case FLC_ITEM_DICT:
{
CoreDict *dict = elem->asDict();
if( dict->isBlessed() )
tgt += "*";
tgt += "[";
if ( level == maxLevel )
{
tgt += "...=>...]";
break;
}
if ( dict->length() == 0 )
{
tgt += "=>]";
break;
}
Item key, value;
Iterator iter( &dict->items() );
// separate the first loop to be able to add ", "
describe_internal( vm, tgt, &iter.getCurrentKey(), level + 1, maxLevel, maxSize );
tgt += " => ";
describe_internal( vm, tgt, &iter.getCurrent(), level + 1, maxLevel, maxSize );
iter.next();
while( iter.hasCurrent() )
{
tgt += ", ";
describe_internal( vm, tgt, &iter.getCurrentKey(), level + 1, maxLevel, maxSize );
tgt += " => ";
describe_internal( vm, tgt, &iter.getCurrent(), level + 1, maxLevel, maxSize );
iter.next();
}
示例5: serialize
//.........这里部分代码省略.........
file->write( &type, 1 );
MemBuf* mb = asMemBuf();
file->write( &mb, sizeof(mb) );
}
else {
file->write( &type, 1 );
this->asMemBuf()->serialize( file, bLive );
}
}
break;
case FLC_ITEM_ARRAY:
{
byte type = FLC_ITEM_ARRAY;
file->write((byte *) &type, 1 );
CoreArray &array = *this->asArray();
int32 len = endianInt32( array.length() );
file->write( (byte *) &len, sizeof( len ) );
for( uint32 i = 0; i < array.length(); i ++ ) {
array[i].serialize( file, bLive );
if( ! file->good() )
return sc_ferror;
}
}
break;
case FLC_ITEM_DICT:
{
byte type = FLC_ITEM_DICT;
file->write( &type, 1 );
CoreDict *dict = this->asDict();
type = dict->isBlessed() ? 1:0;
file->write( &type, 1 );
int32 len = endianInt32( dict->length() );
file->write( (byte *) &len, sizeof( len ) );
Iterator iter( &dict->items() );
while( iter.hasCurrent() )
{
iter.getCurrentKey().serialize( file, bLive );
if( ! file->good() )
return sc_ferror;
iter.getCurrent().serialize( file, bLive );
if( ! file->good() )
return sc_ferror;
iter.next();
}
}
break;
case FLC_ITEM_FUNC:
serialize_function( file, this->asFunction(), bLive );
break;
case FLC_ITEM_METHOD:
{
byte type = FLC_ITEM_METHOD;
file->write( &type, 1 );
e_sercode sc = asMethodItem().serialize( file, bLive );
if( sc != sc_ok )
return sc;