diff options
Diffstat (limited to 'kig/misc/object_hierarchy.cc')
-rw-r--r-- | kig/misc/object_hierarchy.cc | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/kig/misc/object_hierarchy.cc b/kig/misc/object_hierarchy.cc index 7a977e63..264f7e8c 100644 --- a/kig/misc/object_hierarchy.cc +++ b/kig/misc/object_hierarchy.cc @@ -47,14 +47,14 @@ public: // on the given objects. The dependsstack contains a set of // booleans telling which parts of the hierarchy certainly depend on // the given objects. In this function, the node should check - // whether any of its tqparents have true set, and if so, set its own + // whether any of its parents have true set, and if so, set its own // value to true. virtual void checkDependsOnGiven( std::vector<bool>& dependsstack, int loc ) const = 0; // this function is used to check whether the given objects are all // used by one or more of the final objects. The usedstack tqcontains // a set of booleans telling which parts of the hierarchy are // certainly ancestors of the final objects. In this function, the - // node should set all of its tqparents' booleans to true. + // node should set all of its parents' booleans to true. virtual void checkArgumentsUsed( std::vector<bool>& usedstack ) const = 0; }; @@ -118,15 +118,15 @@ class ApplyTypeNode : public ObjectHierarchy::Node { const ObjectType* mtype; - std::vector<int> mtqparents; + std::vector<int> mparents; public: - ApplyTypeNode( const ObjectType* type, const std::vector<int>& tqparents ) - : mtype( type ), mtqparents( tqparents ) {} + ApplyTypeNode( const ObjectType* type, const std::vector<int>& parents ) + : mtype( type ), mparents( parents ) {} ~ApplyTypeNode(); Node* copy() const; const ObjectType* type() const { return mtype; } - const std::vector<int>& tqparents() const { return mtqparents; } + const std::vector<int>& parents() const { return mparents; } int id() const; void apply( std::vector<const ObjectImp*>& stack, @@ -141,17 +141,17 @@ int ApplyTypeNode::id() const { return ID_ApplyType; } void ApplyTypeNode::checkArgumentsUsed( std::vector<bool>& usedstack ) const { - for ( uint i = 0; i < mtqparents.size(); ++i ) + for ( uint i = 0; i < mparents.size(); ++i ) { - usedstack[mtqparents[i]] = true; + usedstack[mparents[i]] = true; } } void ApplyTypeNode::checkDependsOnGiven( std::vector<bool>& dependsstack, int loc ) const { bool result = false; - for ( uint i = 0; i < mtqparents.size(); ++i ) - if ( dependsstack[mtqparents[i]] == true ) result = true; + for ( uint i = 0; i < mparents.size(); ++i ) + if ( dependsstack[mparents[i]] == true ) result = true; dependsstack[loc] = result; } @@ -161,23 +161,23 @@ ApplyTypeNode::~ApplyTypeNode() ObjectHierarchy::Node* ApplyTypeNode::copy() const { - return new ApplyTypeNode( mtype, mtqparents ); + return new ApplyTypeNode( mtype, mparents ); } void ApplyTypeNode::apply( std::vector<ObjectCalcer*>& stack, int loc ) const { - std::vector<ObjectCalcer*> tqparents; - for ( uint i = 0; i < mtqparents.size(); ++i ) - tqparents.push_back( stack[ mtqparents[i] ] ); - stack[loc] = new ObjectTypeCalcer( mtype, tqparents ); + std::vector<ObjectCalcer*> parents; + for ( uint i = 0; i < mparents.size(); ++i ) + parents.push_back( stack[ mparents[i] ] ); + stack[loc] = new ObjectTypeCalcer( mtype, parents ); } void ApplyTypeNode::apply( std::vector<const ObjectImp*>& stack, int loc, const KigDocument& doc ) const { Args args; - for ( uint i = 0; i < mtqparents.size(); ++i ) - args.push_back( stack[mtqparents[i]] ); + for ( uint i = 0; i < mparents.size(); ++i ) + args.push_back( stack[mparents[i]] ); args = mtype->sortArgs( args ); stack[loc] = mtype->calc( args, doc ); } @@ -297,23 +297,23 @@ int ObjectHierarchy::visit( const ObjectCalcer* o, std::map<const ObjectCalcer*, // because that's where we expect it.. We therefore copy it // there using CopyObjectType.. int ret = mnumberofargs + mnodes.size(); - std::vector<int> tqparents; - tqparents.push_back( smi->second ); - mnodes.push_back( new ApplyTypeNode( CopyObjectType::instance(), tqparents ) ); + std::vector<int> parents; + parents.push_back( smi->second ); + mnodes.push_back( new ApplyTypeNode( CopyObjectType::instance(), parents ) ); return ret; } else return smi->second; } - std::vector<ObjectCalcer*> p( o->tqparents() ); + std::vector<ObjectCalcer*> p( o->parents() ); // we check if o descends from the given objects.. bool descendsfromgiven = false; - std::vector<int> tqparents; - tqparents.resize( p.size(), -1 ); + std::vector<int> parents; + parents.resize( p.size(), -1 ); for ( uint i = 0; i < p.size(); ++i ) { int v = visit( p[i], seenmap, false ); - tqparents[i] = v; + parents[i] = v; descendsfromgiven |= (v != -1); }; @@ -335,7 +335,7 @@ int ObjectHierarchy::visit( const ObjectCalcer* o, std::map<const ObjectCalcer*, return -1; }; - return storeObject( o, p, tqparents, seenmap ); + return storeObject( o, p, parents, seenmap ); } ObjectHierarchy::~ObjectHierarchy() @@ -385,9 +385,9 @@ void ObjectHierarchy::init( const std::vector<ObjectCalcer*>& from, const std::v seenmap[from[i]] = i; for ( std::vector<ObjectCalcer*>::const_iterator i = to.begin(); i != to.end(); ++i ) { - std::vector<ObjectCalcer*> tqparents = (*i)->tqparents(); - for ( std::vector<ObjectCalcer*>::const_iterator j = tqparents.begin(); - j != tqparents.end(); ++j ) + std::vector<ObjectCalcer*> parents = (*i)->parents(); + for ( std::vector<ObjectCalcer*>::const_iterator j = parents.begin(); + j != parents.end(); ++j ) visit( *j, seenmap, true ); } for ( std::vector<ObjectCalcer*>::const_iterator i = to.begin(); i != to.end(); ++i ) @@ -438,9 +438,9 @@ void ObjectHierarchy::serialize( TQDomElement& tqparent, TQDomDocument& doc ) co const ApplyTypeNode* node = static_cast<const ApplyTypeNode*>( mnodes[i] ); e.setAttribute( "action", "calc" ); e.setAttribute( "type", TQString::tqfromLatin1( node->type()->fullName() ) ); - for ( uint i = 0; i < node->tqparents().size(); ++i ) + for ( uint i = 0; i < node->parents().size(); ++i ) { - int tqparent = node->tqparents()[i] + 1; + int tqparent = node->parents()[i] + 1; TQDomElement arge = doc.createElement( "arg" ); arge.appendChild( doc.createTextNode( TQString::number( tqparent ) ) ); e.appendChild( arge ); @@ -548,7 +548,7 @@ ObjectHierarchy* ObjectHierarchy::buildSafeObjectHierarchy( const TQDomElement& return 0; } - std::vector<int> tqparents; + std::vector<int> parents; for ( TQDomNode p = e.firstChild(); !p.isNull(); p = p.nextSibling() ) { TQDomElement q = p.toElement(); @@ -556,9 +556,9 @@ ObjectHierarchy* ObjectHierarchy::buildSafeObjectHierarchy( const TQDomElement& if ( q.tagName() != "arg" ) KIG_GENERIC_PARSE_ERROR; int pid = q.text().toInt(&ok ); if ( !ok ) KIG_GENERIC_PARSE_ERROR; - tqparents.push_back( pid - 1 ); + parents.push_back( pid - 1 ); }; - newnode = new ApplyTypeNode( type, tqparents ); + newnode = new ApplyTypeNode( type, parents ); } else if ( tmp == "fetch-property" ) { @@ -640,11 +640,11 @@ ObjectHierarchy ObjectHierarchy::transformFinalObject( const Transformation& t ) ObjectHierarchy ret( *this ); ret.mnodes.push_back( new PushStackNode( new TransformationImp( t ) ) ); - std::vector<int> tqparents; - tqparents.push_back( ret.mnodes.size() - 1); - tqparents.push_back( ret.mnodes.size() ); + std::vector<int> parents; + parents.push_back( ret.mnodes.size() - 1); + parents.push_back( ret.mnodes.size() ); const ObjectType* type = ApplyTransformationObjectType::instance(); - ret.mnodes.push_back( new ApplyTypeNode( type, tqparents ) ); + ret.mnodes.push_back( new ApplyTypeNode( type, parents ) ); return ret; } @@ -696,7 +696,7 @@ const ObjectImpType* lowermost( const ObjectImpType* a, const ObjectImpType* b ) // this function is part of the visit procedure really. It is // factored out, because it recurses for cache ObjectImp's. What this // does is, it makes sure that object o is calcable, by putting -// appropriate Node's in mnodes.. po is o->tqparents() and pl tqcontains +// appropriate Node's in mnodes.. po is o->parents() and pl tqcontains // the location of objects that are already in mnodes and -1 // otherwise.. -1 means we have to store their ObjectImp, unless // they're cache ObjectImp's etc. @@ -723,8 +723,8 @@ int ObjectHierarchy::storeObject( const ObjectCalcer* o, const std::vector<Objec } else if ( (uint) pl[i] < mnumberofargs ) { - ObjectCalcer* tqparent = o->tqparents()[i]; - std::vector<ObjectCalcer*> opl = o->tqparents(); + ObjectCalcer* tqparent = o->parents()[i]; + std::vector<ObjectCalcer*> opl = o->parents(); margrequirements[pl[i]] = lowermost( margrequirements[pl[i]], |