epoc32/include/mw/cdtdmodel.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // contains the parser specialisation (BNF grammar) for a DTD parser.
    15 // See CBNFParser for function details
    16 // 
    17 //
    18 
    19 #ifndef __CDTDMODEL_H__
    20 #define __CDTDMODEL_H__
    21 
    22 #include <cbnfnode.h>
    23 #include <cbnfparser.h>
    24 #include <crulemarkedstack.h>
    25 
    26 //##ModelId=3B666BCB001C
    27 
    28 
    29 
    30 class CDTDModel : public CBNFParser
    31 /** Creates a tree that represents a specified DTD.
    32 
    33 To use it:
    34 
    35 1. call the base class function ProcessDataL() with the filename of the DTD, and call CommitL()
    36 
    37 2. call GeneratedTree() to get the tree
    38 
    39 	@publishedAll
    40 	@deprecated
    41 */
    42 	{
    43 public:
    44     class CDTDElementAttribute : public CBase
    45 	/** Represents an attribute of a DTD element. */
    46 		{
    47 	public:
    48 		/** DTD element attribute value types. */
    49 		enum KValueType
    50 			{
    51 			/** Attribute supplies a default. */
    52 			EDefault, 
    53 			/** Attribute is #REQUIRED. */
    54 			ERequired, 
    55 			/** Attribute is #IMPLIED. */
    56 			EImplied, 
    57 			/** Attribute is #FIXED. */
    58 			EFixed, 
    59 			/** Attribute is a reference. */
    60 			EReference
    61 			};
    62 
    63 	public:
    64 		/** Destructor.
    65 		*/
    66 		virtual ~CDTDElementAttribute() 
    67 			{ 
    68 			delete iType; 
    69 			delete iValue; 
    70 			}
    71 
    72 	public:
    73 		/** Node that specifies the attribute type. */
    74 		CBNFNode*	iType;
    75 		/** Node that specifies the attribute value. */
    76         CBNFNode*	iValue;
    77 		/** Attribute value type. */
    78         KValueType	iValueType;
    79 		};
    80 
    81 
    82 	enum TRuleMarks 
    83 		{
    84 		ERuleStartMark = 1, 
    85 		EConditionalMark, 
    86 		EGroupMark 
    87 		};
    88 
    89 	//##ModelId=3B666BCB0321
    90 	IMPORT_C static CDTDModel* NewL(CAttributeLookupTable& aLUT);
    91 	//##ModelId=3B666BCB0320
    92 	IMPORT_C virtual ~CDTDModel();
    93 
    94 	// This method MUST be invoked before data can be processed by the parser.
    95 	//##ModelId=3B666BCB031F
    96 	IMPORT_C virtual void ResetL();
    97 
    98 	//##ModelId=3B666BCB0315
    99 	IMPORT_C CBNFNode* GeneratedTree();
   100 
   101 	// Building method for a hard coded WML1.1 DTD tree
   102 	// Input:
   103 	//		aPackageRoot - A root node to which the generated tree is attached
   104 	//
   105 	//##ModelId=3B666BCB030B
   106 	IMPORT_C void BuildWml11DTDL(CBNFNode& aPackageRootNode);
   107 
   108 protected:
   109     IMPORT_C CDTDModel(CAttributeLookupTable& aLUT);	
   110 
   111 	// construct our BNF rule tree
   112 	//##ModelId=3B666BCB0302
   113 	IMPORT_C virtual CBNFNode* TreeL();
   114 	
   115 	// to control our internal state on conditional rules.
   116 	//##ModelId=3B666BCB02F7
   117 	IMPORT_C virtual void StartConditional(TParserNodeTypes aRuleType); 
   118 	//##ModelId=3B666BCB02E3
   119 	IMPORT_C virtual void EndConditional(TParserNodeTypes aRuleType, TBool aSuccess);
   120 
   121 	// rule callbacks to build the DTD Tree
   122 	//##ModelId=3B666BCB02D9
   123 	static void PreRulesL(CBNFParser& aParser);
   124 	//##ModelId=3B666BCB02CF
   125 	static void PostRulesL(CBNFParser& aParser);
   126 	//##ModelId=3B666BCB02C5
   127 	static void PreElementDeclL(CBNFParser& aParser);
   128 	//##ModelId=3B666BCB02B1
   129 	static void PostElementDeclL(CBNFParser& aParser);
   130 	//##ModelId=3B666BCB02A7
   131 	static void PreEntityDeclL(CBNFParser& aParser);
   132 	//##ModelId=3B666BCB0294
   133 	static void PostEntityDeclL(CBNFParser& aParser);
   134 	//##ModelId=3B666BCB0289
   135 	static void PreAttlistLineL(CBNFParser& aParser);
   136 	//##ModelId=3B666BCB027F
   137 	static void PostAttlistLineL(CBNFParser& aParser);
   138 	//##ModelId=3B666BCB0275
   139 	static void PostAttlistReferenceL(CBNFParser& aParser);
   140 	//##ModelId=3B666BCB026B
   141 	static void PreAttValueL(CBNFParser& aParser);
   142 	//##ModelId=3B666BCB0261
   143 	static void PostAttValueL(CBNFParser& aParser);
   144 	//##ModelId=3B666BCB024E
   145 	static void PostRequiredL(CBNFParser& aParser);
   146 	//##ModelId=3B666BCB0243
   147 	static void PostFixedL(CBNFParser& aParser);
   148 	//##ModelId=3B666BCB0239
   149 	static void PostImpliedL(CBNFParser& aParser);
   150 	//##ModelId=3B666BCB022F
   151 	static void PostAndL(CBNFParser& aParser);
   152 	//##ModelId=3B666BCB0225
   153 	static void PostOrL(CBNFParser& aParser);
   154 	//##ModelId=3B666BCB021B
   155 	static void PreGroupL(CBNFParser& aParser);
   156 	//##ModelId=3B666BCB0208
   157 	static void PostGroupL(CBNFParser& aParser);
   158 	//##ModelId=3B666BCB01FD
   159 	static void PostMatch0PlusL(CBNFParser& aParser);
   160 	//##ModelId=3B666BCB01F3
   161 	static void PostMatch1PlusL(CBNFParser& aParser);
   162 	//##ModelId=3B666BCB01E9
   163 	static void PostOptionalL(CBNFParser& aParser);
   164 	//##ModelId=3B666BCB01DF
   165 	static void PostIdentifierL(CBNFParser& aParser);
   166 	//##ModelId=3B666BCB01CC
   167 	static void PostEntityDeclNameL(CBNFParser& aParser);
   168 	//##ModelId=3B666BCB01C1
   169 	static void PostElementDeclNameL(CBNFParser& aParser);
   170 	//##ModelId=3B666BCB01B7
   171 	static void PostAttlistDeclNameL(CBNFParser& aParser);
   172 	//##ModelId=3B666BCB01AD
   173 	static void PostAttfieldNameL(CBNFParser& aParser);
   174 	//##ModelId=3B666BCB01A3
   175 	static void PostReferenceNameL(CBNFParser& aParser);
   176 	//##ModelId=3B666BCB0199
   177 	static void PostStringL(CBNFParser& aParser);
   178 	//##ModelId=3B666BCB0186
   179 	static void PostValidHexCharL(CBNFParser& aParser);
   180 	//##ModelId=3B666BCB017B
   181 	static void PostValidDecCharL(CBNFParser& aParser);
   182 	//##ModelId=3B666BCB0171
   183 	static void PrePEDeclL(CBNFParser& aParser);
   184 	//##ModelId=3B666BCB0167
   185 	static void PostPEDeclL(CBNFParser& aParser);
   186 	//##ModelId=3B666BCB015D
   187 	static void PostGEDeclL(CBNFParser& aParser);
   188 	//##ModelId=3B666BCB0153
   189 	static void PreGEContentL(CBNFParser& aParser);
   190 	//##ModelId=3B666BCB0149
   191 	static void PostGEContentL(CBNFParser& aParser);	
   192 
   193 	// utility functions
   194 	//##ModelId=3B666BCB0135
   195 	static void PostValidCharL(CBNFParser& aParser, TRadix aRadix);
   196 	//##ModelId=3B666BCB0117
   197 	static void PostRuleL(CBNFParser& aParser, TParserNodeTypes aType, const TDesC* aAttribute);
   198 
   199 	//##ModelId=3B666BCB0104
   200 	void CharRefReplacement(TPtr& aString);
   201 
   202 	//##ModelId=3B666BCB0103
   203 	void DoClear();
   204 
   205 	// Help methods for the hardcoded WML 1.1 tree
   206 	//##ModelId=3B666BCB00DB
   207 	void AddNewAttributeL(CBNFNode& aNode, const TDesC* aAttributeId, const TDesC& aAttributeType, CDTDElementAttribute::KValueType aAttributeValueType, CBNFNode* aRootNode);
   208 	//##ModelId=3B666BCB00BD
   209 	void AddNewReferenceAttributeL(CBNFNode& aNode, const TDesC& aAttributeType, CBNFNode* aRootNode);
   210 	//##ModelId=3B666BCB0095
   211 	void AddNewAttributeWithValueL(CBNFNode& aNode, const TDesC* aAttributeId, const TDesC& aAttributeType, const TDesC& aAttributeDefaultValue, CBNFNode* aRootNode);
   212 
   213 
   214 protected:
   215     typedef CRuleMarkedStack<ETrue> COwnerRuleMarkedStack;
   216 
   217 protected:
   218 	//##ModelId=3B666BCB008B
   219 	TBool					iInPEDecl;	
   220 	//##ModelId=3B666BCB0078
   221 	TBool					iCharRefCheck;
   222 	//##ModelId=3B666BCB006E
   223 	HBufC*					iGEContent;
   224 
   225 	//##ModelId=3B666BCB0064
   226 	HBufC*					iNewAttfieldName;
   227 	//##ModelId=3B666BCB005A
   228 	CDTDElementAttribute*	iNewElementAttribute;
   229 	//##ModelId=3B666BCB0046
   230 	CBNFNode*				iNewRule;
   231 	//##ModelId=3B666BCB003C
   232 	CBNFNode*				iNewTree;
   233 	//##ModelId=3B666BCB0030
   234 	COwnerRuleMarkedStack	iNewRuleStack;
   235 	};
   236 
   237 #endif // __CDTDMODEL_H__