本文整理汇总了C++中ListIterator类的典型用法代码示例。如果您正苦于以下问题:C++ ListIterator类的具体用法?C++ ListIterator怎么用?C++ ListIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ListIterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
void TransformNode::render(Pixel* px, Matrix* later, Matrix* zbuffer, Color *ambient, Light *pointLight, Vertex *eye, double attenuation)
{
//transform passed in from higher in the scene graph
Matrix* updated = later->multiply(transform);
ListIterator<Node>* iter = children->iterator();
while (iter->hasNext())
{
Node* node = iter->next();
node->render(px, updated, zbuffer, ambient, pointLight, eye, attenuation);
}
delete iter;
delete updated;
}
示例2:
TransformNode::~TransformNode()
{
ListIterator<Node>* iter = nodes->iterator();
printf("\nDeleting transform node - start");
while(iter->hasNext())
{
printf("\nin loop temp");
iter->next()->removeRef();
}
delete iter;
delete nodes;
printf("\nDeleting transform node - end");
}
示例3: it
PageSelector::~PageSelector()
{
if (this->page_buttons) {
// The superclass destructor calls clear() but I'm confused
// about what the virtual call from the destructor is going
// to do. So I'll add the needed statements.
ListIterator it (*this->page_buttons);
PageTab* page_button;
while ( (page_button = (PageTab*)it.getNext()) ) {
page_button->unmanage();
delete page_button;
}
delete this->page_buttons;
this->page_buttons = NUL(List*);
}
示例4: while
/**
* ~BasicObject
* Deconstuctor.
* Preconditions:
* None.
* Postconditions:
* BasicObject object is destroyed.
*/
BasicObject::~BasicObject()
{
ListIterator<Face>* iter = faces->iterator();
while ( iter->hasNext() ) {
delete iter->next();
}
delete iter;
delete faces;
vertices->removeAll();
delete vertices;
}
示例5: reHashRecords
void Hash::reHashRecords(Bucket* bucket, int bucketNumber, Bucket* newBucket)
{
List<Record*>* recordList = bucket->getRecordList();
ListIterator<Record*> it = recordList->getIterator();
Record* auxRecord = NULL;
int bucketDestinationNumber = 0;
while(it.hasNext()){
auxRecord = it.next();
bucketDestinationNumber = this->hashTable->getBlock(this->hashKey(auxRecord->getKey()));
if(bucketDestinationNumber != bucketNumber){
newBucket->insertRecord(auxRecord->clone());
bucket->deleteRecord(auxRecord->getKey());
}
}
}
示例6: getValue
//The function takes in an iterator and TokenList and will rewrite numbers at the iterator's
//Pre- The position is located at a number or a parethesis
//Post- It will write to the postFix TokenList and update the iterator
void getValue(ListIterator &iter, TokenList &postFix)
{
//If parethesis are found this else if will rewrite the parenthesis in postFix
if (iter.tokenChar() == '(')
{
iter.advance();
getValue(iter, postFix);
iter.advance();
assignOp(iter, postFix);
}
//If the current position is an integer
else
{
postFix.push_back(iter.token());
}
}
示例7: tokenText
string tokenText(ListIterator& infix, TokenList& list)
{
if (infix != list.end())
return infix.token().tokenText();
else
return "";
}
示例8: UString
UString Debugger::varInfo(const UString &ident)
{
if (!eng)
return UString();
const List *chain = Context::current()->pScopeChain();
ListIterator scope = chain->begin();
while (scope != chain->end()) {
if (scope->hasProperty(ident)) {
KJSO val = scope->get(ident);
return UString(val.imp()->typeInfo()->name) + ":" +
val.toString().value();
}
scope++;
}
return UString();
}
示例9:
boolean
MacroParameterNode::canCoerceValue (const char* option, List* types)
{
ListIterator iter;
boolean coerced = FALSE;
DXType* dxtype;
for (iter.setList(*types) ; (dxtype = (DXType*)iter.getNext()) ; ) {
char* s = DXValue::CoerceValue (option, dxtype->getType());
if (s) {
coerced = TRUE;
delete s;
break;
}
}
return coerced;
}
示例10: evalStep
// evalStep
// Evaluates the current operator
// Parameters:
// iter - the iterator for the list of tokens
// postExpr - the postfix expression we are converting to
// Pre-condition: Next token is an operator (although, it will just advance if it isn't)
// Post-condition: All values related to this operation pushed to postExpr in the order dictated by postfix
// Iter is on the last token evaluated in this step (so iter.advance() next time will
// bring it to the next thing to be evaluated)
void evalStep(ListIterator& iter, TokenList& postExpr)
{
iter.advance();
switch (iter.tokenChar())
{
case '*':
case '/':
case '%':
handleMultiplyLevelOperation(iter, postExpr);
break;
case '+':
case '-':
handleAdditionLevelOperation(iter, postExpr);
break;
}
}
示例11: Matrix
/**
* render
* Renders the scene.
* Preconditions:
* The pixel object.
* Postconditions:
* The scene is rendered when the final render method is reached.
*/
void Scene::render( Pixel* pix )
{
Matrix* zbuffer = new Matrix( pix->getHeight(), pix->getWidth() );
for ( int i = 0; i < pix->getHeight(); i++ ) {
for ( int j = 0; j < pix->getWidth(); j++ ) {
zbuffer->setElement( i, j, -1 );
}
}
ListIterator<Node>* iter = scene->iterator();
while( iter->hasNext() ) {
iter->next()->render( pix, wnd, zbuffer );
}
delete iter;
delete zbuffer;
}
示例12:
void List<Object>::insert( const Object& data,
const ListIterator<Object> &iter ) {
if (iter.isValid()) {
ListNode<Object>* newnode = new ListNode<Object>( data, iter.current->getNext() );
iter.current->setNext( newnode );
}
}
示例13: makeFunction
void makeFunction(ListIterator& infix, TokenList& list, FunctionDef& funs)
{
infix.advance(); //advance past deffn
string name = tokenText(infix, list);
funs[name] = FunDef();
FunDef* function = &funs[name]; //to avoid multiple lookups in this function body
function->name = name;
infix.advance(); //advance past function name
infix.advance(); //advance past '('
function->locals = new VarTree();
int paramcount = 0;
while (tokenText(infix, list) != ")")
{
string paramname = tokenText(infix, list);
function->parameter[paramcount] = paramname;
function->locals->assign(paramname, 0);
++paramcount;
infix.advance();
if (tokenText(infix, list) == ",")
infix.advance();
} //we are now on a ")"
infix.advance(); //so advance past ")"
for (int i = paramcount; i < 10; ++i)
function->parameter[i] = "";
function->functionBody = assignmentToTree(infix,list,funs);
#ifdef DEBUG
cout << "Function:" << endl;
cout << " Name: " << function->name << endl;
for (int i = 0; i < 10 && function->parameter[i] != ""; ++i)
cout << " Parameter " << i << ": " << function->parameter[i] << endl;
cout << " VarTree: " << function->locals << endl;
cout << " VarTree: " << *function->locals << endl;
cout << " ExprNode: " << function->functionBody << endl;
cout << " ExprNode: " << *function->functionBody << endl;
#endif
}
示例14: GetMetaValue
int Ardb::RenameList(Context& ctx, DBID srcdb, const std::string& srckey, DBID dstdb, const std::string& dstkey)
{
Context tmpctx;
tmpctx.currentDB = srcdb;
ValueObject v;
int err = GetMetaValue(tmpctx, srckey, LIST_META, v);
CHECK_ARDB_RETURN_VALUE(ctx.reply, err);
if (0 != err)
{
fill_error_reply(ctx.reply, "no such key or some error");
return 0;
}
if (v.meta.Encoding() == COLLECTION_ENCODING_ZIPLIST)
{
DelKeyValue(tmpctx, v.key);
v.key.encode_buf.Clear();
v.key.db = dstdb;
v.key.key = dstkey;
v.meta.expireat = 0;
SetKeyValue(ctx, v);
}
else
{
ListIterator iter;
ListIter(ctx, v, iter, false);
tmpctx.currentDB = dstdb;
ValueObject dstmeta;
dstmeta.key.type = KEY_META;
dstmeta.key.key = dstkey;
dstmeta.type = LIST_META;
dstmeta.meta.SetFlag(COLLECTION_FLAG_SEQLIST);
dstmeta.meta.SetEncoding(COLLECTION_ENCODING_ZIPLIST);
BatchWriteGuard guard(GetKeyValueEngine());
while (iter.Valid())
{
std::string tmpstr;
ListInsert(tmpctx, dstmeta, NULL, iter.Element()->GetDecodeString(tmpstr), false, false);
iter.Next();
}
SetKeyValue(tmpctx, dstmeta);
tmpctx.currentDB = srcdb;
DeleteKey(tmpctx, srckey);
}
ctx.data_change = true;
return 0;
}
示例15: cpy
void MaxCPlanarMaster::generateVariablesForFeasibility(const List<ChunkConnection*>& ccons, List<EdgeVar*>& connectVars) {
List<ChunkConnection*> cpy(ccons);
#if 0
for(ChunkConnection *cc : cpy) {
cc->printMe();
}
#endif
ArrayBuffer<ListIterator<NodePair> > creationBuffer(ccons.size());
for (ListIterator<NodePair> npit = m_inactiveVariables.begin(); npit.valid(); ++npit) {
bool select = false;
#if 0
(*npit).printMe();
#endif
ListIterator<ChunkConnection*> ccit = cpy.begin();
while(ccit.valid()) {
if((*ccit)->coeff(*npit)) {
ListIterator<ChunkConnection*> delme = ccit;
++ccit;
cpy.del(delme);
select = true;
} else
++ccit;
}
if(select) {
#if 0
Logger::slout() << "<--CREATE";
#endif
creationBuffer.push(npit);
}
if(cpy.size()==0) break;
}
#if 0
for(ChunkConnection *cc : cpy) {
cc->printMe();
}
#endif
OGDF_ASSERT(cpy.size()==0);
Logger::slout() << "Creating " << creationBuffer.size() << " Connect-Variables for feasibility\n";
m_varsInit = creationBuffer.size();
// realize creationList
for(int i = creationBuffer.size(); i-- > 0;) {
connectVars.pushBack( createVariable( creationBuffer[i] ) );
}
}