本文整理汇总了C++中ListElement::data方法的典型用法代码示例。如果您正苦于以下问题:C++ ListElement::data方法的具体用法?C++ ListElement::data怎么用?C++ ListElement::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListElement
的用法示例。
在下文中一共展示了ListElement::data方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: applyConstants
void AppFalcon::applyConstants ( Compiler &compiler )
{
ListElement *dliter = m_options.defines.begin();
while ( dliter != 0 )
{
String &directive = * ( ( String * ) dliter->data() );
// find "="
uint32 pos = directive.find ( "=" );
if ( pos == String::npos )
{
throw String( "constant not in <directive>=<value> syntax: \"" + directive + "\"" );
}
//split the directive
String dirname ( directive, 0, pos );
String dirvalue ( directive, pos + 1 );
dirname.trim();
dirvalue.trim();
// is the value a number?
int64 number;
if ( dirvalue.parseInt ( number ) )
compiler.addIntConstant( dirname, number );
else {
compiler.addStringConstant( dirname, dirvalue );
}
dliter = dliter->next();
}
}
示例2: clear
void List::clear()
{
ListElement *elem = m_head;
if( m_deletor != 0 )
{
while( elem != 0 )
{
ListElement *toBeDeleted = elem;
elem = elem->next();
m_deletor( (void *) toBeDeleted->data() );
memFree( toBeDeleted );
}
}
else {
while( elem != 0 )
{
ListElement *toBeDeleted = elem;
elem = elem->next();
memFree( toBeDeleted );
}
}
m_head = m_tail = 0;
m_size = 0;
}
示例3: applyDirectives
void AppFalcon::applyDirectives ( Compiler &compiler )
{
ListElement *dliter = m_options.directives.begin();
while ( dliter != 0 )
{
String &directive = * ( ( String * ) dliter->data() );
// find "="
uint32 pos = directive.find ( "=" );
if ( pos == String::npos )
{
throw String( "directive not in <directive>=<value> syntax: \"" + directive + "\"" );
}
//split the directive
String dirname ( directive, 0, pos );
String dirvalue ( directive, pos + 1 );
dirname.trim();
dirvalue.trim();
// is the value a number?
int64 number;
bool result;
if ( dirvalue.parseInt ( number ) )
result = compiler.setDirective ( dirname, number );
else
result = compiler.setDirective ( dirname, dirvalue );
if ( ! result )
{
throw String( "invalid directive or value: \"" + directive + "\"" );
}
dliter = dliter->next();
}
}
示例4: gen_array
void GenTree::gen_array( const ArrayDecl *ad )
{
ListElement *iter = ad->begin();
while( iter != 0 )
{
const Value *val = (const Value *) iter->data();
gen_value( val );
iter = iter->next();
if( iter != 0 )
m_out->writeString( ", " );
}
}
示例5: unsubscribe
void VMSemaphore::unsubscribe( VMContext *ctx )
{
ListElement *elem = m_waiting.begin();
while( elem != 0 )
{
VMContext *cty = (VMContext *) elem->data();
if ( ctx == cty )
{
m_waiting.erase( elem );
return;
}
elem = elem->next();
}
}
示例6: PasswordAclSubject
//
// Create a PasswordAclSubject
//
PasswordAclSubject *PasswordAclSubject::Maker::make(const TypedList &list) const
{
Allocator &alloc = Allocator::standard(Allocator::sensitive);
switch (list.length()) {
case 1:
return new PasswordAclSubject(alloc, true);
case 2:
{
ListElement *password;
crack(list, 1, &password, CSSM_LIST_ELEMENT_DATUM);
return new PasswordAclSubject(alloc, password->data());
}
default:
CssmError::throwMe(CSSM_ERRCODE_INVALID_ACL_SUBJECT_VALUE);
}
}
示例7: insertBefore
void List::insertBefore( ListElement *position, const void *data )
{
ListElement *element = (ListElement *) memAlloc( sizeof( ListElement ) );
element->data( data );
element->next( position );
element->prev( position->prev() );
if( position->prev() != 0 )
{
position->prev()->next( element );
}
position->prev( element );
m_size++;
if ( position == m_head )
m_head = element;
}
示例8: pushBack
void List::pushBack( const void *data )
{
ListElement *element = (ListElement *) memAlloc( sizeof( ListElement ) );
element->data( data );
if ( m_head == 0 )
{
m_head = m_tail = element;
element->prev(0);
}
else {
element->prev( m_tail );
m_tail->next( element );
m_tail = element;
}
m_size++;
element->next( 0 );
}
示例9: popBack
void List::popBack()
{
if ( m_tail == 0 )
return;
ListElement *element = m_tail;
m_tail = m_tail->prev();
if( m_tail == 0 )
m_head = 0;
else
m_tail->next(0);
if( m_deletor != 0 ) {
m_deletor( (void *) element->data() );
}
m_size--;
memFree( element );
}
示例10: popFront
void List::popFront()
{
if ( m_head == 0 )
return;
ListElement *element = m_head;
m_head = m_head->next();
if( m_head != 0 )
m_head->prev( 0 );
else
m_tail = 0;
if( m_deletor != 0 ) {
m_deletor( (void *) element->data() );
}
m_size--;
memFree( element );
}
示例11: gen_dict
void GenTree::gen_dict( const DictDecl *ad )
{
if( ad->empty() ) {
m_out->writeString( " =>" );
return;
}
ListElement *iter = ad->begin();
while( iter != 0 )
{
DictDecl::pair *pair = (DictDecl::pair *) iter->data();
const Value *key = pair->first;
const Value *value = pair->second;
gen_value( key );
m_out->writeString( "=>" );
gen_value( value );
iter = iter->next();
if( iter != 0 )
m_out->writeString( ", " );
}
}
示例12: runModule
void AppFalcon::runModule()
{
ModuleLoader ml;
prepareLoader( ml );
// Create the runtime using the given module loader.
Runtime runtime( &ml );
// now that we have the main module, inject other requested modules
ListElement *pliter = m_options.preloaded.begin();
while ( pliter != 0 )
{
Module *module = ml.loadName ( * ( ( String * ) pliter->data() ) );
runtime.addModule( module );
// abandon our reference to the injected module
module->decref();
pliter = pliter->next();
}
// then add the main module
Module* mainMod = loadInput(ml);
runtime.addModule( mainMod );
// abandon our reference to the main module
mainMod->decref();
//===========================================
// Prepare the virtual machine
//
VMachineWrapper vmachine;
//redirect the VM streams to ours.
// The machine takes ownership of the streams, so they won't be useable anymore
// after the machine destruction.
readyStreams();
vmachine->stdIn( m_stdIn );
vmachine->stdOut( m_stdOut );
vmachine->stdErr( m_stdErr );
// I have given real process streams to the vm
vmachine->hasProcessStreams( true );
// push the core module
// we know we're not launching the core module.
vmachine->launchAtLink( false );
Module* core = core_module_init();
#ifdef NDEBUG
vmachine->link ( core );
#else
LiveModule *res = vmachine->link ( core );
fassert ( res != 0 ); // should not fail
#endif
core->decref();
// prepare environment
Item *item_args = vmachine->findGlobalItem ( "args" );
fassert ( item_args != 0 );
CoreArray *args = new CoreArray ( m_argc - m_script_pos );
String ioEncoding = getIoEncoding();
for ( int ap = m_script_pos; ap < m_argc; ap ++ )
{
CoreString *cs = new CoreString;
if ( ! TranscodeFromString ( m_argv[ap], ioEncoding, *cs ) )
{
cs->bufferize ( m_argv[ap] );
}
args->append ( cs );
}
item_args->setArray ( args );
Item *script_name = vmachine->findGlobalItem ( "scriptName" );
fassert ( script_name != 0 );
*script_name = new CoreString ( mainMod->name() );
Item *script_path = vmachine->findGlobalItem ( "scriptPath" );
fassert ( script_path != 0 );
*script_path = new CoreString ( mainMod->path() );
// Link the runtime in the VM.
// We'll be running the modules as we link them in.
vmachine->launchAtLink( true );
if ( vmachine->link( &runtime ) )
{
vmachine->launch();
if ( vmachine->regA().isInteger() )
exitval( ( int32 ) vmachine->regA().asInteger() );
}
}
示例13: main
//.........这里部分代码省略.........
}
bincode_stream = new FileStream;
bincode_stream->open( input_file );
if ( ! bincode_stream->good() )
{
stdOut->writeString( "falrun: Can't open file " );
stdOut->writeString( input_file );
stdOut->writeString( "\n" );
stdOut->flush();
return 1;
}
String module_name;
String source_path;
findModuleName( input_file, module_name );
findModulepath( input_file, source_path );
//-----------------------------------------
// execute the script.
//
if ( source_path != "" )
source_path += ";";
try
{
ModuleLoader *modloader = new ModuleLoader( source_path + get_load_path() );
Engine::setSearchPath( modloader->getSearchPath() );
// set the module preferred language; ok also if default ("") is used
modloader->setLanguage( module_language );
Module *core = core_module_init();
Module *main_mod = modloader->loadModule( bincode_stream );
VMachine *vmachine = new VMachine(false);
// change default machine streams.
vmachine->stdIn( stdIn );
vmachine->stdOut( stdOut );
vmachine->stdErr( stdErr );
vmachine->init();
vmachine->link( core );
core->decref();
Runtime *runtime = new Runtime( modloader );
// preload required modules
ListElement *pliter = preloaded.begin();
while( pliter != 0 )
{
Module *module = modloader->loadName( * ((String *) pliter->data()) );
runtime->addModule( module );
pliter = pliter->next();
}
Item *item_args = vmachine->findGlobalItem( "args" );
fassert( item_args != 0 );
CoreArray *args = new CoreArray( argc - script_pos );
for ( int ap = script_pos; ap < argc; ap ++ ) {
args->append( new CoreString( argv[ap] ) );
}
item_args->setArray( args );
Item *script_name = vmachine->findGlobalItem( "scriptName" );
fassert( script_name != 0 );
script_name->setString( new CoreString( module_name ) );
// the runtime will try to load the references.
runtime->addModule( main_mod );
if( vmachine->link( runtime ) )
{
vmachine->launch();
if ( vmachine->regA().type() == FLC_ITEM_INT )
return (int32) vmachine->regA().asInteger();
return 0;
}
vmachine->finalize();
}
catch ( Error *err )
{
String temp;
err->toString( temp );
stdErr->writeString( "falcon: FATAL - Program terminated with error.\n" );
stdErr->writeString( temp + "\n" );
err->decref();
return 1;
}
return 255;
}
示例14: generate
//.........这里部分代码省略.........
const StmtWhile *wh = static_cast< const StmtWhile *>( cmp );
m_out->writeString( "WHILE " );
gen_value( wh->condition() );
m_out->writeString( "\n" );
gen_block( wh->children(), depth );
}
break;
case Statement::t_loop:
{
const StmtLoop *wh = static_cast< const StmtLoop *>( cmp );
m_out->writeString( "LOOP " );
m_out->writeString( "\n" );
gen_block( wh->children(), depth );
if( wh->condition() != 0 )
{
m_out->writeString( "END LOOP WHEN " );
gen_value( wh->condition() );
m_out->writeString( "\n" );
}
else
m_out->writeString( "END\n" );
}
break;
case Statement::t_global:
{
m_out->writeString( "GLOBAL " );
const StmtGlobal *sglobal = static_cast< const StmtGlobal *>( cmp );
ListElement *iter = sglobal->getSymbols().begin();
while ( iter != 0 ) {
Symbol *sym = (Symbol *) iter->data();
m_out->writeString( sym->name() + ", " );
iter = iter->next();
}
m_out->writeString( "\n" );
}
break;
case Statement::t_forin:
{
m_out->writeString( "FOR-IN " );
const StmtForin *sfor = static_cast< const StmtForin *>( cmp );
gen_array( sfor->dest() );
m_out->writeString( " IN " );
gen_value( sfor->source() );
m_out->writeString( "\n" );
gen_block( sfor->children(), depth );
gen_block( sfor->firstBlock(), depth, "FORFIRST" );
gen_block( sfor->middleBlock(), depth, "FORMIDDLE" );
gen_block( sfor->lastBlock(), depth, "FORLAST" );
}
break;
case Statement::t_try:
{
m_out->writeString( "TRY\n" );
const StmtTry *stry = static_cast< const StmtTry *>( cmp );
gen_block( stry->children(), depth );
// generatest the switch integer list
if ( ! stry->intCases().empty() )
{
m_out->writeString( "TYPE ID CATCHES " );
MapIterator iter = stry->intCases().begin();