diff -r 000000000000 -r 044383f39525 imgtools/romtools/rombuild/r_dir.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgtools/romtools/rombuild/r_dir.h Tue Oct 27 16:36:35 2009 +0000 @@ -0,0 +1,214 @@ +/* +* Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef __R_DIR_H__ +#define __R_DIR_H__ + +#include + +// Generalised set handling +class SetMember + { +public: + TBool operator==(const SetMember& aMember) {return(Compare(aMember)==0);} + virtual SetMember* Copy() const =0; + virtual void Close(); +public: + TInt Type() const {return iType;} + virtual TInt Compare(const SetMember& aMember) const =0; + virtual void DebugPrint() const =0; +protected: + virtual ~SetMember(); + SetMember(TInt aType) : iType(aType) {TotalInSystem++;} + SetMember(const SetMember& aMember) : iType(aMember.iType) {TotalInSystem++;} + TBool operator<(const SetMember& aMember) {return(Compare(aMember)<0);} + TBool operator>(const SetMember& aMember) {return(Compare(aMember)>0);} +private: + TInt iType; + static TInt TotalInSystem; + }; + +class FiniteSet : public SetMember + { +protected: + enum TFiniteSetType {EFiniteSetType=100}; +public: + static FiniteSet* New(TInt aMaxCount); + static FiniteSet* Singleton(TInt aMaxCount, const SetMember& aMember); + virtual ~FiniteSet(); + virtual SetMember* Copy() const; + TInt Find(const SetMember& aMember) const; + TBool SubsetOf(const FiniteSet& aSet) const; + TInt Intersection(const FiniteSet& aSet); + TInt Union(const FiniteSet& aSet); + TInt Difference(const FiniteSet& aSet); + TInt Add(const SetMember& aMember); + TInt Remove(const SetMember& aMember); + SetMember* Detach(TInt anIndex); + TInt Count() const {return iCount;} + TBool Empty() const {return !iCount;} + SetMember& operator[](TInt anIndex) const {return *iMembers[anIndex];} + virtual void DebugPrint() const; +protected: + FiniteSet(TInt aMaxCount); + FiniteSet(const FiniteSet& aSet); + FiniteSet* Construct(); + virtual TInt Compare(const SetMember& aMember) const; + TInt Find(const SetMember& aMember, TInt& anIndex) const; + TInt Insert(const SetMember& aMember, TInt anIndex); +protected: + TInt iMaxCount; + TInt iCount; + SetMember** iMembers; + }; + +// ROMBUILD-specific stuff +#include + +class CObeyFile; +class TRomNode; +class THardwareVariant; + +class RomFileStructure; +class TVariantList + { +public: + enum {EMaxVariants=32}; + static void Setup(CObeyFile* aObey); + TVariantList() : iList(0) + {} + TVariantList(TInt aVariant) + {iList=TUint(1<=(const TVariantList aList) const + {return(iList==(iList|aList.iList));} + TBool operator[](TInt aVariant) const + {return(iList&TUint(1<