bintools/rcomp/inc/STRUCTST.H
changeset 0 044383f39525
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 /*
       
     2 * Copyright (c) 1997-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 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __STRUCTST_H__
       
    20 #define __STRUCTST_H__
       
    21 
       
    22 #if defined(__MSVCDOTNET__) || defined(__TOOLS2__)
       
    23 #include <iostream>
       
    24 using std::ostream;
       
    25 #else //!__MSVCDOTNET__
       
    26 #include <iostream.h>
       
    27 #endif //__MSVCDOTNET__
       
    28 
       
    29 #include "STRINGAR.H"
       
    30 #include "DATATYPE.H"
       
    31 
       
    32 class ResourceItem;
       
    33 
       
    34 // StructItem
       
    35 
       
    36 class StructItem : public ArrayItem
       
    37 	{
       
    38 public:
       
    39 	virtual ResourceItem * NewResourceItem() = 0;
       
    40 	virtual ostream& StreamOut ( ostream & os) = 0;
       
    41 protected:
       
    42 	StructItem( String LabelToSet);
       
    43 	virtual ~StructItem();
       
    44 	StructItem( StructItem & Source);
       
    45 public:
       
    46 	String	iLabel;
       
    47 	};
       
    48 
       
    49 // SimpleStructItem
       
    50 
       
    51 class SimpleStructItem : public StructItem	// e.g. WORD a = 5
       
    52 	{
       
    53 	friend ostream& operator<< ( ostream & os, SimpleStructItem & o);
       
    54 public:
       
    55 	SimpleStructItem(DataType aItemTypeToSet,String aLabelToSet);
       
    56 	SimpleStructItem(DataType aItemTypeToSet,String aLabelToSet,String aMaxLength);
       
    57 	ResourceItem * NewResourceItem();
       
    58 	ostream& StreamOut ( ostream & os);
       
    59 	virtual ~SimpleStructItem();
       
    60 	SimpleStructItem( SimpleStructItem & Source);
       
    61 	SimpleStructItem& operator=( SimpleStructItem & Source);
       
    62 public:
       
    63 	DataType iItemType;
       
    64 	String iDefault;
       
    65 	String iLengthLimit;
       
    66 	};
       
    67 
       
    68 // ArrayStructItem
       
    69 
       
    70 class ArrayStructItem : public StructItem	// e.g. WORD a[] = {1,2,3}
       
    71 	{
       
    72 	friend ostream& operator<< ( ostream & os, ArrayStructItem & o);
       
    73 public:
       
    74 	ArrayStructItem( DataType ItemTypeToSet, String LabelToSet);
       
    75 	virtual ~ArrayStructItem();
       
    76 	ResourceItem * NewResourceItem();
       
    77 	ostream& StreamOut ( ostream & os);
       
    78 public:
       
    79 	DataType iItemType;
       
    80 	StringArray iDefaults;
       
    81 	DataType iLenType;
       
    82 	String iSize;
       
    83 	};
       
    84 
       
    85 // StructTypeStructItem
       
    86 
       
    87 class StructTypeStructItem : public StructItem	// e.g. STRUCT a
       
    88 	{
       
    89 	friend ostream& operator<< ( ostream & os, StructTypeStructItem & o);
       
    90 public:
       
    91 	StructTypeStructItem( String LabelToSet);
       
    92 	ResourceItem * NewResourceItem();
       
    93 	ostream& StreamOut ( ostream & os);
       
    94 	};
       
    95 
       
    96 // StructArrayStructItem
       
    97 
       
    98 class StructArrayStructItem : public StructItem // e.g. STRUCT a[]
       
    99 	{
       
   100 	friend ostream& operator<< ( ostream & os, StructArrayStructItem & o);
       
   101 public:
       
   102 	StructArrayStructItem( String LabelToSet);
       
   103 	StructArrayStructItem( String LabelToSet, String SizeToSet);
       
   104 	ResourceItem * NewResourceItem();
       
   105 	ostream& StreamOut ( ostream & os);
       
   106 	virtual ~StructArrayStructItem();
       
   107 public:
       
   108 	DataType iLenType;
       
   109 	String iSize;
       
   110 	};
       
   111 
       
   112 // StructItemArray
       
   113 
       
   114 class StructItemArray : public Array
       
   115 	{
       
   116 	friend ostream& operator<< ( ostream & os, StructItemArray & o);
       
   117 public:
       
   118 	StructItemArray();
       
   119 	~StructItemArray();
       
   120 	void Add( StructItem * pNewItem);
       
   121 	};
       
   122 
       
   123 // StructItemArrayIterator
       
   124 
       
   125 class StructItemArrayIterator : public ArrayIterator
       
   126 	{
       
   127 public:
       
   128 	StructItemArrayIterator( const StructItemArray & c);
       
   129 	StructItem * operator() ();
       
   130 	};
       
   131 
       
   132 // StructHeader
       
   133 
       
   134 class StructHeader : public ArrayItem
       
   135 	{
       
   136 	friend ostream& operator<< ( ostream & os, StructHeader & o);
       
   137 public:
       
   138 	StructHeader( String LabelToSet);
       
   139 	StructHeader( String LabelToSet, DataType LenTypeToSet);
       
   140 public:
       
   141 	String iLabel;
       
   142 	DataType iLenType;
       
   143 	StructItemArray iSIA;
       
   144 	};
       
   145 
       
   146 // StructHeaderArray
       
   147 
       
   148 class StructHeaderArray : public Array
       
   149 	{
       
   150 	friend ostream& operator<< ( ostream & os, StructHeaderArray & o);
       
   151 public:
       
   152 	StructHeaderArray();
       
   153 	~StructHeaderArray();
       
   154 	void Add( StructHeader * pNewItem);
       
   155 	StructHeader * Find( const String & LabelSought);
       
   156 private:
       
   157 	static int iInUse;	// Only one instance of this class may exist at a time.
       
   158 	};
       
   159 
       
   160 // StructHeaderArrayIterator
       
   161 
       
   162 class StructHeaderArrayIterator : public ArrayIterator
       
   163 	{
       
   164 public:
       
   165 	StructHeaderArrayIterator( const StructHeaderArray& c);
       
   166 	StructHeader * operator() ();
       
   167 	};
       
   168 
       
   169 #endif
       
   170