omadrm/drmengine/ro/inc/DRMProtectedRoParser.h
branchRCL_3
changeset 18 8a03a285ab14
parent 0 95b198f216e5
child 41 29f3cf766061
equal deleted inserted replaced
17:e16d72588c28 18:8a03a285ab14
    20 #ifndef DRMPROTECTEDROPARSER_H
    20 #ifndef DRMPROTECTEDROPARSER_H
    21 #define DRMPROTECTEDROPARSER_H
    21 #define DRMPROTECTEDROPARSER_H
    22 
    22 
    23 //  INCLUDES
    23 //  INCLUDES
    24 #include <e32std.h>
    24 #include <e32std.h>
    25 #include <Xml/Parser.h>
    25 #include <xml/parser.h>
    26 #include <Xml/ContentHandler.h>
    26 #include <xml/contenthandler.h>
    27 #include <Xml/XmlParserErrors.h>
    27 #include <xml/xmlparsererrors.h>
    28 #include <Xml/Attribute.h>
    28 #include <xml/attribute.h>
    29 #include "DrmRightsClient.h"
    29 #include "DRMRightsClient.h"
    30 
    30 
    31 using namespace Xml;
    31 using namespace Xml;
    32 
    32 
    33 // FORWARD DECLARATIONS
    33 // FORWARD DECLARATIONS
    34 class CDRMRights;
    34 class CDRMRights;
    50         enum TParserType
    50         enum TParserType
    51             {
    51             {
    52             EXmlParser,
    52             EXmlParser,
    53             EWbxmlParser
    53             EWbxmlParser
    54             };
    54             };
    55             
    55 
    56         static const TInt KMaxElementCount = 40;
    56         static const TInt KMaxElementCount = 40;
    57         static const TInt KMaxElementNesting = 16;
    57         static const TInt KMaxElementNesting = 16;
    58         
    58 
    59     public:  // Constructors and destructor
    59     public:  // Constructors and destructor
    60         
    60 
    61         /**
    61         /**
    62         * Two-phased constructor.
    62         * Two-phased constructor.
    63         */
    63         */
    64         IMPORT_C static CDrmProtectedRoParser* NewL();
    64         IMPORT_C static CDrmProtectedRoParser* NewL();
    65         
    65 
    66         /**
    66         /**
    67         * Destructor.
    67         * Destructor.
    68         */
    68         */
    69         IMPORT_C ~CDrmProtectedRoParser();
    69         IMPORT_C ~CDrmProtectedRoParser();
    70 
    70 
    71     public: // New functions
    71     public: // New functions
    72         
    72 
    73         /**
    73         /**
    74         * ?member_description.
    74         * ?member_description.
    75         * @since Series ?XX ?SeriesXX_version
    75         * @since Series ?XX ?SeriesXX_version
    76         * @param ?arg1 ?description
    76         * @param ?arg1 ?description
    77         * @return ?description
    77         * @return ?description
    81             CParsedProtectedRo*& aResultRights);
    81             CParsedProtectedRo*& aResultRights);
    82 
    82 
    83         IMPORT_C void ParseAndStoreL(
    83         IMPORT_C void ParseAndStoreL(
    84             const TDesC8& aProtectedRo,
    84             const TDesC8& aProtectedRo,
    85             RPointerArray<CDRMRights>& aResultRights);
    85             RPointerArray<CDRMRights>& aResultRights);
    86             
    86 
    87         IMPORT_C HBufC8* GetRiUrlL(
    87         IMPORT_C HBufC8* GetRiUrlL(
    88             const TDesC8& aProtectedRo);
    88             const TDesC8& aProtectedRo);
    89 
    89 
    90         IMPORT_C HBufC8* GetDomainIdL(
    90         IMPORT_C HBufC8* GetDomainIdL(
    91             const TDesC8& aProtectedRo);
    91             const TDesC8& aProtectedRo);
    97 
    97 
    98         /**
    98         /**
    99         * From ?base_class ?member_description.
    99         * From ?base_class ?member_description.
   100         * @param aDocParam Specifies the various parameters of the document.
   100         * @param aDocParam Specifies the various parameters of the document.
   101         * @arg   aDocParam.iCharacterSetName The character encoding of the document.
   101         * @arg   aDocParam.iCharacterSetName The character encoding of the document.
   102         * @param aErrorCode is the error code. 
   102         * @param aErrorCode is the error code.
   103         *        If this is not KErrNone then special action may be required.
   103         *        If this is not KErrNone then special action may be required.
   104         */
   104         */
   105         void OnStartDocumentL(
   105         void OnStartDocumentL(
   106             const RDocumentParameters& aDocParam,
   106             const RDocumentParameters& aDocParam,
   107             TInt aErrorCode);
   107             TInt aErrorCode);
   108 
   108 
   109         /**
   109         /**
   110         * From ?base_class ?member_description.
   110         * From ?base_class ?member_description.
   111         * @param aErrorCode is the error code. 
   111         * @param aErrorCode is the error code.
   112         *        If this is not KErrNone then special action may be required.
   112         *        If this is not KErrNone then special action may be required.
   113         */
   113         */
   114         void OnEndDocumentL(
   114         void OnEndDocumentL(
   115             TInt aErrorCode);
   115             TInt aErrorCode);
   116 
   116 
   121         * @param aErrorCode is the error code.
   121         * @param aErrorCode is the error code.
   122         *        If this is not KErrNone then special action may be required.
   122         *        If this is not KErrNone then special action may be required.
   123         */
   123         */
   124         void OnStartElementL(
   124         void OnStartElementL(
   125             const RTagInfo& aElement,
   125             const RTagInfo& aElement,
   126             const RAttributeArray& aAttributes, 
   126             const RAttributeArray& aAttributes,
   127 			TInt aErrorCode);
   127             TInt aErrorCode);
   128 
   128 
   129         /**
   129         /**
   130         * From ?base_class ?member_description.
   130         * From ?base_class ?member_description.
   131         * @param aElement is a handle to the element's details.
   131         * @param aElement is a handle to the element's details.
   132         * @param aErrorCode is the error code.
   132         * @param aErrorCode is the error code.
   136             const RTagInfo& aElement,
   136             const RTagInfo& aElement,
   137             TInt aErrorCode);
   137             TInt aErrorCode);
   138 
   138 
   139         /**
   139         /**
   140         * From ?base_class ?member_description.
   140         * From ?base_class ?member_description.
   141         * @param aBytes is the raw content data for the element. 
   141         * @param aBytes is the raw content data for the element.
   142         *        The client is responsible for converting the data to the 
   142         *        The client is responsible for converting the data to the
   143         *        required character set if necessary.
   143         *        required character set if necessary.
   144         *        In some instances the content may be binary and must not be converted.
   144         *        In some instances the content may be binary and must not be converted.
   145         * @param aErrorCode is the error code.
   145         * @param aErrorCode is the error code.
   146         *        If this is not KErrNone then special action may be required.
   146         *        If this is not KErrNone then special action may be required.
   147         */
   147         */
   156         * @param aErrorCode is the error code.
   156         * @param aErrorCode is the error code.
   157         *        If this is not KErrNone then special action may be required.
   157         *        If this is not KErrNone then special action may be required.
   158         */
   158         */
   159         void OnStartPrefixMappingL(
   159         void OnStartPrefixMappingL(
   160             const RString& aPrefix,
   160             const RString& aPrefix,
   161             const RString& aUri, 
   161             const RString& aUri,
   162 			TInt aErrorCode);
   162             TInt aErrorCode);
   163 
   163 
   164         /**
   164         /**
   165         * From ?base_class ?member_description.
   165         * From ?base_class ?member_description.
   166         * @param aPrefix is the Namespace prefix that was mapped.
   166         * @param aPrefix is the Namespace prefix that was mapped.
   167         * @param aErrorCode is the error code.
   167         * @param aErrorCode is the error code.
   198         * @param aErrorCode is the error code.
   198         * @param aErrorCode is the error code.
   199         *        If this is not KErrNone then special action may be required.
   199         *        If this is not KErrNone then special action may be required.
   200         */
   200         */
   201         void OnProcessingInstructionL(
   201         void OnProcessingInstructionL(
   202             const TDesC8& aTarget,
   202             const TDesC8& aTarget,
   203             const TDesC8& aData, 
   203             const TDesC8& aData,
   204 			TInt aErrorCode);
   204             TInt aErrorCode);
   205 
   205 
   206         /**
   206         /**
   207         * From ?base_class ?member_description.
   207         * From ?base_class ?member_description.
   208         */
   208         */
   209         void OnOutOfData();
   209         void OnOutOfData();
   216         void OnError(
   216         void OnError(
   217             TInt aErrorCode);
   217             TInt aErrorCode);
   218 
   218 
   219         /**
   219         /**
   220         * From ?base_class ?member_description.
   220         * From ?base_class ?member_description.
   221         * @return				0 if no interface matching the uid is found.
   221         * @return               0 if no interface matching the uid is found.
   222                 Otherwise, the this pointer cast to that interface.
   222                 Otherwise, the this pointer cast to that interface.
   223         * @param aUid the uid identifying the required interface.
   223         * @param aUid the uid identifying the required interface.
   224         */
   224         */
   225         TAny* GetExtendedInterface(
   225         TAny* GetExtendedInterface(
   226             const TInt32 aUid);
   226             const TInt32 aUid);
   227 
   227 
   228     protected:  // New functions
   228     protected:  // New functions
   229         
   229 
   230         /**
   230         /**
   231         * ?member_description.
   231         * ?member_description.
   232         * @since Series ?XX ?SeriesXX_version
   232         * @since Series ?XX ?SeriesXX_version
   233         * @param ?arg1 ?description
   233         * @param ?arg1 ?description
   234         * @return ?description
   234         * @return ?description
   258         TBool GetElementStartEnd(
   258         TBool GetElementStartEnd(
   259             const TDesC8& aElement,
   259             const TDesC8& aElement,
   260             const TDesC8& aData,
   260             const TDesC8& aData,
   261             TInt& aStart,
   261             TInt& aStart,
   262             TInt& aEnd);
   262             TInt& aEnd);
   263             
   263 
   264         /**
   264         /**
   265         * Handle a parsed domain RO which could not be added to the rights DB
   265         * Handle a parsed domain RO which could not be added to the rights DB
   266         * because the device is not part of the domain.
   266         * because the device is not part of the domain.
   267         * @since Series 60 3.0
   267         * @since Series 60 3.0
   268         * @param aDomainRoData domain RO as XML data
   268         * @param aDomainRoData domain RO as XML data
   270         */
   270         */
   271         void HandleUnregisteredDomainRoL(
   271         void HandleUnregisteredDomainRoL(
   272             const TDesC8& aContentId,
   272             const TDesC8& aContentId,
   273             const TDesC8& aDomainRoData,
   273             const TDesC8& aDomainRoData,
   274             CParsedProtectedRo* aDomainRo);
   274             CParsedProtectedRo* aDomainRo);
   275             
   275 
   276         /**
   276         /**
   277         * Adds ROAP namespace URI to aProtectedRo if not already present
   277         * Adds ROAP namespace URI to aProtectedRo if not already present
   278         * @since Series 60 3.0
   278         * @since Series 60 3.0
   279         * @param aProtectedRo protected RO element
   279         * @param aProtectedRo protected RO element
   280         * @return protected RO element, if namespace was not added NULL
   280         * @return protected RO element, if namespace was not added NULL
   281         */    
   281         */
   282         HBufC8* CDrmProtectedRoParser::AddRoapNamespaceL(
   282         HBufC8* CDrmProtectedRoParser::AddRoapNamespaceL(
   283             TDesC8& aProtectedRo ) const;
   283             TDesC8& aProtectedRo ) const;
   284 
   284 
   285     private:
   285     private:
   286 
   286 
   292         void ConstructL(void);
   292         void ConstructL(void);
   293 
   293 
   294     private:  // Data
   294     private:  // Data
   295         // The XML parser
   295         // The XML parser
   296         CParser* iParser;
   296         CParser* iParser;
   297         
   297 
   298         // Result of parsing the protected RO element
   298         // Result of parsing the protected RO element
   299         CParsedProtectedRo* iRights;
   299         CParsedProtectedRo* iRights;
   300         
   300 
   301         // Expected element names
   301         // Expected element names
   302         RString iElements[KMaxElementCount];
   302         RString iElements[KMaxElementCount];
   303         
   303 
   304         // Parsing stack
   304         // Parsing stack
   305         TInt iElementStack[KMaxElementNesting];
   305         TInt iElementStack[KMaxElementNesting];
   306         
   306 
   307         // Depth of the parsing stack
   307         // Depth of the parsing stack
   308         TInt iElementStackDepth;
   308         TInt iElementStackDepth;
   309         
   309 
   310         // Content between elements
   310         // Content between elements
   311         HBufC8* iContent;
   311         HBufC8* iContent;
   312 
   312 
   313     };
   313     };
   314 
   314 
   315 #endif      // DRMPROTECTEDROPARSER_H   
   315 #endif      // DRMPROTECTEDROPARSER_H
   316             
   316 
   317 // End of File
   317 // End of File