policymanagement/policyengine/policyengineserver/inc/OperationParser.h
changeset 0 b497e44ab2fc
child 1 a9c0ce913924
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     1 /*
       
     2 * Copyright (c) 2000 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 "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: Implementation of policymanagement components
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef OPERATION_PARSER_HEADER_
       
    20 #define OPERATION_PARSER_HEADER_
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 // INCLUDES
       
    25 
       
    26 #include "ElementBase.h"
       
    27 #include "PolicyEngineClientServer.h"
       
    28 
       
    29 #include <e32base.h>
       
    30 #include <contenthandler.h>
       
    31 #include <documentparameters.h>
       
    32 #include <cstack.h>
       
    33 #include <parser.h>
       
    34 
       
    35 // CONSTANTS
       
    36 // MACROS
       
    37 // DATA TYPES
       
    38 // FUNCTION PROTOTYPES
       
    39 // FORWARD DECLARATIONS
       
    40 
       
    41 class CElementBase;
       
    42 class CPolicyStorage;
       
    43 class CPolicyManager;
       
    44 
       
    45 // CLASS DECLARATION
       
    46 
       
    47 class COperationInfo	: 	public CBase
       
    48 {
       
    49 	public:
       
    50 		COperationInfo();
       
    51 		~COperationInfo();
       
    52 		static COperationInfo* NewL();
       
    53 		
       
    54 		void SetActionIdL( const TDesC8& aActionId);
       
    55 		void SetTargetElementIdL( const TDesC8& aTargetElementId);
       
    56 		void SetXACMLContentL( const TPtrC8& aXACMLContent);
       
    57 		void SetLineOffset( const TInt& aLineOffset);
       
    58 		void UseBearerCertificate( const TBool aUseBearerCertificate);
       
    59 		
       
    60 		void ExecuteL( CPolicyManager *aManager);
       
    61 		
       
    62 	private:
       
    63 		HBufC8 *iActionId;
       
    64 		HBufC8 *iTargetElement;	
       
    65 		TBool iUseBearerCertificate;
       
    66 		TPtrC8 iXACMLContent;
       
    67 		TInt iLineOffset;
       
    68 };
       
    69 
       
    70 class COperationParser : public CBase, public Xml::MContentHandler
       
    71 {
       
    72 	public:
       
    73 		COperationParser();
       
    74 		~COperationParser();
       
    75 		static COperationParser * NewL( const TDesC8& aOperationDescription);
       
    76 		void ConstructL( const TDesC8& aOperationDescription);
       
    77 	
       
    78 		//operation handling
       
    79 		/*
       
    80 		* NextOperationL();
       
    81 		*/
       
    82 		void ExecuteL( TInt aIndex, CPolicyManager *aManager);
       
    83 		TInt OperationCount();
       
    84 		void ParseOperationsL( TDes8& aReturnTxt);
       
    85 		
       
    86 	private:
       
    87 		void HandleErrorL( const TDesC8& aErrorTxt, const TDesC8& aElementName);
       
    88 		void ResetOperations();
       
    89 	
       
    90 		//from content handler
       
    91 		void OnStartDocumentL(const Xml::RDocumentParameters& aDocParam, TInt aErrorCode);
       
    92     	void OnEndDocumentL(TInt aErrorCode);
       
    93     	void OnStartElementL(const Xml::RTagInfo& aElement, const Xml::RAttributeArray& aAttributes, TInt aErrorCode);
       
    94     	void OnEndElementL(const Xml::RTagInfo& aElement, TInt aErrorCode);
       
    95     	void OnContentL(const TDesC8& aBytes, TInt aErrorCode);
       
    96     	void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, TInt aErrorCode);
       
    97     	void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode);
       
    98     	void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode);
       
    99     	void OnSkippedEntityL(const RString& aName, TInt aErrorCode);
       
   100     	void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode);
       
   101     	void OnError(TInt aErrorCode);
       
   102 		TAny* GetExtendedInterface(const TInt32 aUid);
       
   103 	private:
       
   104 		Xml::CParser *iParser;
       
   105 		COperationInfo * iActiveOperation;
       
   106 		RArray<COperationInfo *> iOperations;
       
   107 
       
   108 		TInt iXMLStackPointer;
       
   109 		TInt iActiveLine;
       
   110 		TDes8* iReturnText;
       
   111 		TPtrC8 iXMLContent;
       
   112 };
       
   113 
       
   114 
       
   115 #endif