本文整理汇总了C++中CoreObject::getProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ CoreObject::getProperty方法的具体用法?C++ CoreObject::getProperty怎么用?C++ CoreObject::getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CoreObject
的用法示例。
在下文中一共展示了CoreObject::getProperty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: inspect_internal
//.........这里部分代码省略.........
}
break;
case FLC_ITEM_OBJECT:
{
CoreObject *arr = elem->asObjectSafe();
stream->writeString( "Object of class " + arr->generator()->symbol()->name() );
if ( level == maxLevel )
{
stream->writeString( "{...}" );
break;
}
stream->writeString( " {\n" );
const PropertyTable &pt = arr->generator()->properties();
for( count = 0; count < pt.added() ; count++ )
{
for ( i = 0; i < (level+1); i ++ )
{
stream->writeString(" ");
}
const String &propName = *pt.getKey( count );
if ( pt.getEntry(count).isWriteOnly() )
{
stream->writeString( "(" );
stream->writeString( propName + ")\n" );
}
else
{
stream->writeString( propName + " => " );
Item dummy;
arr->getProperty( propName, dummy);
inspect_internal( vm, &dummy, level + 1, maxLevel, maxSize, i_stream, false, true );
}
}
for ( i = 0; i < level; i ++ )
{
stream->writeString(" ");
}
stream->writeString( "}" );
}
break;
case FLC_ITEM_CLASS:
stream->writeString( "Class " + elem->asClass()->symbol()->name() );
break;
case FLC_ITEM_METHOD:
{
temp = "Method ";
temp += "->" + elem->asMethodFunc()->name();
stream->writeString( temp );
Item itemp;
elem->getMethodItem( itemp );
inspect_internal( vm, &itemp, level + 1, maxLevel, maxSize, i_stream, true, true );
for ( i = 0; i < level; i ++ )
{
stream->writeString(" ");
}
stream->writeString( "}" );
}
break;
示例2: describe_internal
//.........这里部分代码省略.........
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();
}
tgt += "]";
}
break;
case FLC_ITEM_OBJECT:
{
CoreObject *arr = elem->asObjectSafe();
tgt += arr->generator()->symbol()->name() + "(){ ";
if ( level == maxLevel )
{
tgt += "...}";
break;
}
const PropertyTable &pt = arr->generator()->properties();
for( count = 0; count < pt.added() ; count++ )
{
const String &propName = *pt.getKey( count );
// write only?
if ( pt.getEntry( count ).isWriteOnly() )
{
tgt.A( "(" ).A( propName ).A(")");
}
else
{
Item dummy;
arr->getProperty( propName, dummy );
// in describe skip methods.
if ( dummy.isFunction() || dummy.isMethod() )
continue;
tgt += propName + " = ";
describe_internal( vm, tgt, &dummy, level + 1, maxLevel, maxSize );
}
if (count+1 < pt.added())
{
tgt += ", ";
}
}
tgt += "}";
}
break;
case FLC_ITEM_CLASS:
tgt += "Class " + elem->asClass()->symbol()->name();
break;
case FLC_ITEM_METHOD:
{
tgt += "(";
Item itemp;
elem->getMethodItem( itemp );
describe_internal( vm, tgt, &itemp, level + 1, maxLevel, maxSize );
tgt += ").";
tgt += elem->asMethodFunc()->name() + "()";
}
break;
case FLC_ITEM_CLSMETHOD:
tgt += "Class ";
tgt += elem->asMethodClassOwner()->generator()->symbol()->name();
tgt += "." + elem->asMethodClass()->symbol()->name() + "()";
break;
case FLC_ITEM_FUNC:
{
const Symbol *funcSym = elem->asFunction()->symbol();
tgt += funcSym->name() + "()";
}
break;
case FLC_ITEM_REFERENCE:
tgt += "->";
describe_internal( vm, tgt, elem->dereference(), level + 1, maxLevel, maxSize );
break;
default:
tgt += "?";
}
}
示例3: CmdlineParser_parse
/*#
@method parse CmdlineParser
@brief Starts command line parsing.
@optparam args A specific string array that will be used as arguments to be parsed.
@return true if the parsing is complete, false on error.
Start the parsing process. If args parameter is not provided, the method gets
the content of the @a args global vector defined in the Core module.
Returns true if the parsing was complete, and false on error (for example,
if some element in the array wasn't a string).
*/
FALCON_FUNC CmdlineParser_parse( ::Falcon::VMachine *vm )
{
CoreObject *self = vm->self().asObject();
Item *i_params = vm->param( 0 );
if ( i_params == 0 )
{
// get the parameters from the VM args object
i_params = vm->findGlobalItem( "args" );
if ( i_params == 0 || ! i_params->isArray() ) {
throw new CodeError( ErrorParam( e_undef_sym ).extra( "args" ).hard() );
}
}
else if ( ! i_params->isArray() )
{
throw new ParamError( ErrorParam( e_inv_params ).extra( "( A )" ) );
}
CoreArray *args = i_params->asArray();
// zero request.
self->setProperty( "_request", Item((int64) 0) );
self->setProperty( "lastParsed", Item((int64) 0) );
// status.
typedef enum {
t_none,
t_waitingValue,
t_allFree
} t_states;
t_states state = t_none ;
String currentOption;
Item i_method;
Item i_passMM;
self->getProperty( "passMinusMinus", i_passMM );
bool passMM = i_passMM.isTrue();
Item _request;
String subParam;
uint32 i;
for ( i = 0; i < args->length(); i++ )
{
Item &i_opt = args->at( i );
if ( !i_opt.isString() )
{
throw new ParamError( ErrorParam( e_param_type ).
extra( vm->moduleString( rtl_cmdp_0 ) ) );
}
String &opt = *i_opt.asString();
// if we were expecting a value, we MUST consider ANYTHING as it was a value.
if ( state == t_waitingValue )
{
self->getProperty( "onValue", i_method );
if ( i_method.methodize( self ) )
{
vm->pushParam( new CoreString(currentOption) );
vm->pushParam( i_opt );
vm->callItemAtomic( i_method, 2 );
state = t_none;
}
else
{
vm->retval( false );
self->setProperty( "lastParsed", i );
return;
}
}
else if( opt.length() == 0 || (opt.getCharAt( 0 ) != '-' || opt.length() == 1) || state == t_allFree )
{
self->getProperty( "onFree", i_method );
if ( i_method.methodize( self ) )
{
vm->pushParam( i_opt );
vm->callItemAtomic( i_method, 1 );
}
else
{
vm->retval( false );
self->setProperty( "lastParsed", i );
return;
}
}
else if ( opt == "--" && ! passMM )
{
state = t_allFree;
//.........这里部分代码省略.........