imgtools/imgcheck/libimgutils/inc/romfsentry.h
changeset 0 044383f39525
child 590 360bd6b35136
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 /*
       
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * @internalComponent
       
    16 * @released
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef ROMFSENTRY_H
       
    22 #define ROMFSENTRY_H
       
    23 
       
    24 #include "typedefs.h"
       
    25 
       
    26 /**
       
    27 Class RomImageFSEntry, Base class ROM image file and directory entry structure
       
    28 
       
    29 @internalComponent
       
    30 @released
       
    31 */
       
    32 class RomImageFSEntry 
       
    33 {
       
    34 public:
       
    35 	RomImageFSEntry (char* aName) 
       
    36 	: iName(aName), iSibling(0), iChildren(0)
       
    37 	{
       
    38 	}
       
    39 
       
    40 	virtual ~RomImageFSEntry(void)
       
    41 	{
       
    42 	}
       
    43 
       
    44 	virtual bool IsDirectory(void) = 0;
       
    45 	virtual bool IsExecutable(void) = 0;
       
    46 	const char *Name(void) { return iName.data();}
       
    47 
       
    48 	void Destroy(void)
       
    49 	{
       
    50 		RomImageFSEntry *current = this; // root has no siblings
       
    51 		while (current)
       
    52 		{
       
    53 			if (current->iChildren)
       
    54 				current->iChildren->Destroy();
       
    55 			RomImageFSEntry* prev=current;
       
    56 			current=current->iSibling;
       
    57 			DELETE(prev);
       
    58 		}
       
    59 	}
       
    60 
       
    61 	String iName;
       
    62 	String iPath;
       
    63 	RomImageFSEntry *iSibling;
       
    64 	RomImageFSEntry *iChildren;
       
    65 };
       
    66 
       
    67 /**
       
    68 Class RomImageFileEntry, ROM image file entry structure
       
    69 
       
    70 @internalComponent
       
    71 @released
       
    72 */
       
    73 class RomImageFileEntry : public RomImageFSEntry 
       
    74 {
       
    75 public:
       
    76 	RomImageFileEntry(char* aName) 
       
    77 	: RomImageFSEntry(aName),iExecutable(true)
       
    78 	{
       
    79 	}
       
    80 	~RomImageFileEntry(void)
       
    81 	{
       
    82 	}
       
    83 	bool IsDirectory(void)
       
    84 	{
       
    85 		return false;
       
    86 	}
       
    87 	union ImagePtr
       
    88 	{
       
    89 		TRomImageHeader *iRomFileEntry;
       
    90 		TLinAddr iDataFileAddr;
       
    91 	}ImagePtr;
       
    92 	TRomEntry *iTRomEntryPtr;
       
    93 	bool iExecutable;
       
    94 	/** 
       
    95 	Function responsible to return the node is executable or not.
       
    96 
       
    97 	@internalComponent
       
    98 	@released
       
    99 
       
   100 	@return - returns 'true' if executable or 'false'
       
   101 	*/
       
   102 	bool IsExecutable(void)
       
   103 	{
       
   104 		if (iExecutable)
       
   105 			return true;
       
   106 		else
       
   107 			return false;
       
   108 	}
       
   109 };
       
   110 
       
   111 /**
       
   112 Class RomImageDirEntry, ROM image Directory entry structure
       
   113 
       
   114 @internalComponent
       
   115 @released
       
   116 */
       
   117 class RomImageDirEntry : public RomImageFSEntry
       
   118 {
       
   119 public:
       
   120 	RomImageDirEntry(char* aName) : RomImageFSEntry(aName)
       
   121 	{
       
   122 	}
       
   123 	~RomImageDirEntry(void)
       
   124 	{
       
   125 	}
       
   126 	bool IsDirectory(void)
       
   127 	{
       
   128 		return true;
       
   129 	}
       
   130 	bool IsExecutable(void)
       
   131 	{
       
   132 		return false;
       
   133 	}
       
   134 };
       
   135 
       
   136 #endif //ROMFSENTRY_H