imgtools/romtools/rofsbuild/r_romnode.h
changeset 590 360bd6b35136
parent 0 044383f39525
child 691 9eeecb73a5d4
equal deleted inserted replaced
588:c7c26511138f 590:360bd6b35136
    17 
    17 
    18 
    18 
    19 #ifndef __R_ROMNODE_H__
    19 #ifndef __R_ROMNODE_H__
    20 #define __R_ROMNODE_H__
    20 #define __R_ROMNODE_H__
    21 
    21 
    22 #if defined(__MSVCDOTNET__) || defined(__TOOLS2__)
       
    23 #include <fstream>
    22 #include <fstream>
    24 #else //!__MSVCDOTNET__
       
    25 #include <fstream.h>
       
    26 #endif //__MSVCDOTNET__
       
    27 
       
    28 #include <e32std.h>
    23 #include <e32std.h>
    29 #include "rofs.h"
    24 #include "rofs.h"
    30 #include "e32image.h"
    25 #include "e32image.h"
    31 #include "h_utl.h"
    26 #include "h_utl.h"
    32 
    27 
    63 class TRomBuilderEntry;
    58 class TRomBuilderEntry;
    64 class RomFileStructure;
    59 class RomFileStructure;
    65 class TRomNode
    60 class TRomNode
    66 	{
    61 	{
    67 public:
    62 public:
    68 	TRomNode(TText* aName, TRomBuilderEntry* aEntry=0);
    63 	TRomNode(const char* aName, TRomBuilderEntry* aEntry = 0);
    69 	~TRomNode();
    64 	~TRomNode();
    70 	void Destroy();
    65 	void Destroy();
    71 
    66 
    72 	static inline TRomNode* FirstNode() { return TheFirstNode; };
    67 	static inline TRomNode* FirstNode() { return TheFirstNode; };
    73 	inline TRomNode* NextNode() { return iNextNode; };
    68 	inline TRomNode* NextNode() { return iNextNode; };
    74 	inline void SetNextNode(TRomNode* aNode) { iNextNode = aNode; };
    69 	inline void SetNextNode(TRomNode* aNode) { iNextNode = aNode; };
    75 	inline TRomNode* Currentchild() const { return iChild; };
    70 	inline TRomNode* Currentchild() const { return iChild; };
    76 	inline TRomNode* Currentsibling() const { return iSibling; };
    71 	inline TRomNode* Currentsibling() const { return iSibling; };
    77 
    72 
    78 	void DisplayStructure(ostream* aOut);
    73 	void DisplayStructure(ostream* aOut);
    79 	TRomNode* FindInDirectory(TText *aName);
    74 	TRomNode* FindInDirectory(const char *aName) const;
    80 	void AddFile(TRomNode *aChild);
    75 	void AddFile(TRomNode *aChild);
    81 	TRomNode* NewSubDir(TText *aName);
    76 	TRomNode* NewSubDir(const char *aName);
    82 	TInt SetAtt(TText *anAttWord);
    77 	TInt SetAtt(char *anAttWord);
    83 	TInt SetAttExtra(TText *anAttWord, TRomBuilderEntry* aFile, enum EKeyword aKeyword);
    78 	TInt SetAttExtra(char *anAttWord, TRomBuilderEntry* aFile, enum EKeyword aKeyword);
    84 	inline void SetStackSize(TInt aValue);
    79 	inline void SetStackSize(TInt aValue);
    85 	inline void SetHeapSizeMin(TInt aValue);
    80 	inline void SetHeapSizeMin(TInt aValue);
    86 	inline void SetHeapSizeMax(TInt aValue);
    81 	inline void SetHeapSizeMax(TInt aValue);
    87 	inline void SetCapability(SCapabilitySet& aCapability);
    82 	inline void SetCapability(SCapabilitySet& aCapability);
    88 	inline void SetUid1(TInt aValue);
    83 	inline void SetUid1(TInt aValue);
    91 	inline void SetPriority(TProcessPriority aValue);
    86 	inline void SetPriority(TProcessPriority aValue);
    92 	inline void SetFixed();
    87 	inline void SetFixed();
    93 	inline void SetDllData();
    88 	inline void SetDllData();
    94 
    89 
    95 
    90 
    96 	TBool IsDirectory() const { return 0==iEntry; };
    91 	TBool IsDirectory() const { return 0 == iEntry; };
    97 	TBool IsFile() const { return 0!=iEntry; };
    92 	TBool IsFile() const { return 0!=iEntry; };
    98 
    93 
    99 	TInt CalculateDirectoryEntrySize( TInt& aDirectoryBlockSize,
    94 	TInt CalculateDirectoryEntrySize( TInt& aDirectoryBlockSize,
   100 										    TInt& aFileBlockSize );
    95 										    TInt& aFileBlockSize );
   101 
    96 
   102 	TInt CountFileAndDir(TInt& aFileCount, TInt& aDirCount);
    97 	TInt CountFileAndDir(TInt& aFileCount, TInt& aDirCount);
   103 
    98 
   104 	TInt PlaceFile( TUint8* &aDest, TUint aOffset, TUint aMaxSize, CBytePair *aBPE );
    99 	TInt PlaceFile( TUint8* &aDest, TUint aOffset, TUint aMaxSize, CBytePair *aBPE );
   105 	TInt Place( TUint8* aDestBase );
   100 	TInt Place( TUint8* aDestBase ); 
   106 
   101 	
   107 	TInt NameCpy(char* aDest, TUint8& aUnicodeLength );
   102 	TInt NameCpy(char* aDest, TUint8& aUnicodeLength );
   108 	TInt NameLengthUnicode() const;
   103 	TInt NameLengthUnicode() const;
   109 
   104 
   110 	void Rename(TRomNode *aOldParent, TRomNode* aNewParent, TText* aNewName);
   105 	void Rename(TRomNode *aOldParent, TRomNode* aNewParent, const char* aNewName);
   111 
   106 
   112 	TRofsEntry* RofsEntry() const { return iRofsEntry; };
   107 	TRofsEntry* RofsEntry() const { return iRofsEntry; };
   113 	void SetRofsEntry(TRofsEntry* aEntry);
   108 	void SetRofsEntry(TRofsEntry* aEntry);
   114 	inline void SetImagePosition( TInt aPosition ) { iImagePosition = aPosition; };
   109 	inline void SetImagePosition( TInt aPosition ) { iImagePosition = aPosition; };
   115 	inline void SetFileBlockPosition( TInt aPosition ) { iFileBlockPosition = aPosition; };
   110 	inline void SetFileBlockPosition( TInt aPosition ) { iFileBlockPosition = aPosition; };
   162 	TInt iFileBlockPosition;	// position of directory file block in image
   157 	TInt iFileBlockPosition;	// position of directory file block in image
   163 
   158 
   164 	friend class FileEntry;
   159 	friend class FileEntry;
   165 
   160 
   166 public:
   161 public:
   167 	TText* iName;
   162 	char* iName;
   168 	TUint8 iAtt;
   163 	TUint8 iAtt;
   169 	TUint8 iAttExtra;
   164 	TUint8 iAttExtra;
   170 	TBool iHidden;
   165 	TBool iHidden;
   171 	TRomBuilderEntry* iEntry;		// represents file data
   166 	TRomBuilderEntry* iEntry;		// represents file data
   172 	TUint	iFileStartOffset;		// position in image of start of file
   167 	TUint	iFileStartOffset;		// position in image of start of file
   193 
   188 
   194 class DllDataEntry;
   189 class DllDataEntry;
   195 class TRomBuilderEntry
   190 class TRomBuilderEntry
   196 	{
   191 	{
   197 public:
   192 public:
   198 	TRomBuilderEntry(const char *aFileName, TText *aName);
   193 	TRomBuilderEntry(const char *aFileName, const char *aName);
   199 	~TRomBuilderEntry();
   194 	~TRomBuilderEntry();
   200 	void SetRomNode(TRomNode* aNode);
   195 	void SetRomNode(TRomNode* aNode);
   201 	TRofsEntry* RofsEntry() const {return iRomNode->RofsEntry(); };
   196 	TRofsEntry* RofsEntry() const {return iRomNode->RofsEntry(); };
   202 	TInt PlaceFile( TUint8* &aDest, TUint aMaxSize, CBytePair *aBPE );
   197 	TInt PlaceFile( TUint8* &aDest, TUint aMaxSize, CBytePair *aBPE );
   203 
   198 
   210 	TRomBuilderEntry(const TRomBuilderEntry&);
   205 	TRomBuilderEntry(const TRomBuilderEntry&);
   211 	const TRomBuilderEntry& operator==(const TRomBuilderEntry &);
   206 	const TRomBuilderEntry& operator==(const TRomBuilderEntry &);
   212 	DllDataEntry* iFirstDllDataEntry;
   207 	DllDataEntry* iFirstDllDataEntry;
   213 
   208 
   214 public:
   209 public:
   215 	TText *iName;
   210 	char *iName;
   216 	char *iFileName;
   211 	char *iFileName;
   217 
   212 
   218 	TRomBuilderEntry* iNext;
   213 	TRomBuilderEntry* iNext;
   219 	TRomBuilderEntry* iNextInArea;
   214 	TRomBuilderEntry* iNextInArea;
   220 	TBool iExecutable;
   215 	TBool iExecutable;