本文整理汇总了C++中ListElement::next方法的典型用法代码示例。如果您正苦于以下问题:C++ ListElement::next方法的具体用法?C++ ListElement::next怎么用?C++ ListElement::next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListElement
的用法示例。
在下文中一共展示了ListElement::next方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//
// Managing list elements
//
ListElement *ListElement::last()
{
for (ListElement *p = this; ; p = p->next())
if (p->next() == NULL)
return p;
// not reached
}
示例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: 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();
}
}
示例4: 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();
}
}
示例5: length
unsigned int CssmList::length() const
{
unsigned int len = 0;
for (ListElement *elem = first(); elem; elem = elem->next())
len++;
return len;
}
示例6: clear
void CssmList::clear(Allocator &alloc)
{
ListElement *elem = first();
while (elem) {
ListElement *next = elem->next();
destroy(elem, alloc);
elem = next;
}
}
示例7: pushFront
void List::pushFront( uint32 data )
{
ListElement *element = (ListElement *) memAlloc( sizeof( ListElement ) );
element->iData( data );
if ( m_head == 0 )
{
m_head = m_tail = element;
element->next(0);
}
else {
element->next( m_head );
m_head->prev( element );
m_head = element;
}
m_size++;
element->prev( 0 );
}
示例8: 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( ", " );
}
}
示例9: 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();
}
}
示例10:
//
// Parsing helper for subject makers.
// Note that count/array exclude the first element of list, which is the subject type wordid.
//
void AclSubject::Maker::crack(const CssmList &list, uint32 count, ListElement **array, ...)
{
if (count != list.length() - 1)
CssmError::throwMe(CSSM_ERRCODE_INVALID_ACL_SUBJECT_VALUE);
if (count > 0) {
va_list args;
va_start(args, array);
ListElement *elem = list.first()->next();
for (uint32 n = 0; n < count; n++, elem = elem->next()) {
CSSM_LIST_ELEMENT_TYPE expectedType = va_arg(args, CSSM_LIST_ELEMENT_TYPE);
if (elem->type() != expectedType)
CssmError::throwMe(CSSM_ERRCODE_INVALID_ACL_SUBJECT_VALUE);
array[n] = elem;
}
va_end(args);
}
}
示例11: 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;
}
示例12: 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 );
}
示例13: 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( ", " );
}
}
示例14: generate
void GenTree::generate( const Statement *cmp, const char *specifier, bool sameline, int depth )
{
if ( ! sameline ) {
String line;
line.writeNumber( (int64) cmp->line() );
int pos = 0;
while (pos + line.length() < 5 ) {
pos ++;
m_out->writeString( " " );
}
m_out->writeString( line + " : " );
for (int i = 0; i < depth; i++ )
m_out->writeString( " " );
}
if ( specifier != 0 ) {
m_out->writeString( specifier );
m_out->writeString( " " );
}
switch( cmp->type() )
{
case Statement::t_none: m_out->writeString( "(placeholder none statement)\n" ); break;
case Statement::t_break: m_out->writeString( "BREAK\n" ); break;
case Statement::t_continue:
m_out->writeString( "CONTINUE" );
if( static_cast< const StmtContinue *>( cmp )->dropping() )
m_out->writeString( " DROPPING" );
m_out->writeString( "\n" );
break;
case Statement::t_launch:
m_out->writeString( "LAUNCH " );
gen_value( static_cast< const StmtExpression *>( cmp )->value() );
m_out->writeString( "\n" );
break;
case Statement::t_autoexp:
m_out->writeString( "AUTOEXPR " );
gen_value( static_cast< const StmtExpression *>( cmp )->value() );
m_out->writeString( "\n" );
break;
case Statement::t_return:
m_out->writeString( "RETURN " );
gen_value( static_cast< const StmtExpression *>( cmp )->value() );
m_out->writeString( "\n" );
break;
case Statement::t_fordot:
m_out->writeString( "FORDOT " );
gen_value( static_cast< const StmtExpression *>( cmp )->value() );
m_out->writeString( "\n" );
break;
case Statement::t_raise:
m_out->writeString( "RAISE " );
gen_value( static_cast< const StmtExpression *>( cmp )->value() );
m_out->writeString( "\n" );
break;
case Statement::t_give:
{
const StmtGive *give = static_cast< const StmtGive *>( cmp );
m_out->writeString( "GIVE " );
gen_array( give->attributes() );
m_out->writeString( " to " );
gen_array( give->objects() );
m_out->writeString( "\n" );
}
break;
case Statement::t_self_print:
{
const StmtSelfPrint *sp = static_cast< const StmtSelfPrint *>( cmp );
m_out->writeString( "FAST PRINT " );
gen_array( sp->toPrint() );
m_out->writeString( "\n" );
}
break;
case Statement::t_if:
{
m_out->writeString( "IF " );
const StmtIf *sif = static_cast< const StmtIf *>( cmp );
gen_value( sif->condition() );
m_out->writeString( "\n" );
gen_block( sif->children(), depth );
const Statement *stmt = sif->elifChildren().front();
while( stmt != 0 ) {
generate( stmt, 0, false, depth + 1 );
stmt = static_cast<const Statement *>(stmt->next());
}
gen_block( sif->elseChildren(), depth, "ELSE" );
}
//.........这里部分代码省略.........
示例15: 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;
}