rpparser.h
上传用户:dangjiwu
上传日期:2013-07-19
资源大小:42019k
文件大小:11k
源码类别:

Symbian

开发平台:

Visual C++

  1. /* ***** BEGIN LICENSE BLOCK *****
  2.  * Source last modified: $Id: rpparser.h,v 1.1.26.1 2004/07/09 01:54:36 hubbe Exp $
  3.  * 
  4.  * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
  5.  * 
  6.  * The contents of this file, and the files included with this file,
  7.  * are subject to the current version of the RealNetworks Public
  8.  * Source License (the "RPSL") available at
  9.  * http://www.helixcommunity.org/content/rpsl unless you have licensed
  10.  * the file under the current version of the RealNetworks Community
  11.  * Source License (the "RCSL") available at
  12.  * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
  13.  * will apply. You may also obtain the license terms directly from
  14.  * RealNetworks.  You may not use this file except in compliance with
  15.  * the RPSL or, if you have a valid RCSL with RealNetworks applicable
  16.  * to this file, the RCSL.  Please see the applicable RPSL or RCSL for
  17.  * the rights, obligations and limitations governing use of the
  18.  * contents of the file.
  19.  * 
  20.  * Alternatively, the contents of this file may be used under the
  21.  * terms of the GNU General Public License Version 2 or later (the
  22.  * "GPL") in which case the provisions of the GPL are applicable
  23.  * instead of those above. If you wish to allow use of your version of
  24.  * this file only under the terms of the GPL, and not to allow others
  25.  * to use your version of this file under the terms of either the RPSL
  26.  * or RCSL, indicate your decision by deleting the provisions above
  27.  * and replace them with the notice and other provisions required by
  28.  * the GPL. If you do not delete the provisions above, a recipient may
  29.  * use your version of this file under the terms of any one of the
  30.  * RPSL, the RCSL or the GPL.
  31.  * 
  32.  * This file is part of the Helix DNA Technology. RealNetworks is the
  33.  * developer of the Original Code and owns the copyrights in the
  34.  * portions it created.
  35.  * 
  36.  * This file, and the files included with this file, is distributed
  37.  * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
  38.  * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
  39.  * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
  40.  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
  41.  * ENJOYMENT OR NON-INFRINGEMENT.
  42.  * 
  43.  * Technology Compatibility Kit Test Suite(s) Location:
  44.  *    http://www.helixcommunity.org/content/tck
  45.  * 
  46.  * Contributor(s):
  47.  * 
  48.  * ***** END LICENSE BLOCK ***** */
  49. #ifndef RPPARSER_H
  50. #define RPPARSER_H
  51. #define REALPIX_STRICTNESS_LOW     0  // legacy errors pass through, no warnings
  52. #define REALPIX_STRICTNESS_MEDIUM  1  // legacy errors pass through, logged as warnings
  53. #define REALPIX_STRICTNESS_HIGH    2  // legacy errors thrown as errors
  54. class PXRealPixParser : public CHXBaseCountingObject,
  55.                         public CUnknownIMP,
  56.                         public IHXXMLParserResponse
  57. {
  58.     DECLARE_UNKNOWN(PXRealPixParser)
  59. public:
  60.     // PXRealPixParser methods
  61.     STDMETHOD(Init)                        (THIS_ IUnknown*        pContext,
  62.                                                   PXRealPixFile*   pRealPixFile,
  63.                                                   UINT32           ulStrictnessLevel);
  64.     STDMETHOD(Parse)                       (THIS_ IHXBuffer*      pFileBuffer,
  65.                                                   BOOL             bIsFinal,
  66.                                                   REF(IHXBuffer*) rpErrorText);
  67.     // IHXXMLParserResponse methods
  68.     STDMETHOD(HandleStartElement)          (THIS_ const char* pName,
  69.                                                   IHXValues* pAttributes,
  70.                                                   UINT32      ulLineNumber,
  71.                                                   UINT32      ulColumnNumber);
  72.     STDMETHOD(HandleEndElement)            (THIS_ const char* pName,
  73.                                                   UINT32      ulLineNumber,
  74.                                                   UINT32      ulColumnNumber);
  75.     STDMETHOD(HandleCharacterData)         (THIS_ IHXBuffer* pBuffer,
  76.                                                   UINT32      ulLineNumber,
  77.                                                   UINT32      ulColumnNumber);
  78.     STDMETHOD(HandleProcessingInstruction) (THIS_ const char* pTarget,
  79.                                                   IHXValues* pAttributes,
  80.                                                   UINT32      ulLineNumber,
  81.                                                   UINT32      ulColumnNumber);
  82.     STDMETHOD(HandleUnparsedEntityDecl)    (THIS_ const char* pEntityName,
  83.                                                   const char* pSystemID,
  84.                                                   const char* pPublicID,
  85.                                                   const char* pNotationName,
  86.                                                   UINT32      ulLineNumber,
  87.                                                   UINT32      ulColumnNumber);
  88.     STDMETHOD(HandleNotationDecl)          (THIS_ const char* pNotationName,
  89.                                                   const char* pSystemID,
  90.                                                   const char* pPublicID,
  91.                                                   UINT32      ulLineNumber,
  92.                                                   UINT32      ulColumNumber);
  93.     STDMETHOD(HandleComment)               (THIS_ const char* pComment,
  94.                                                   UINT32      ulLineNumber,
  95.                                                   UINT32      ulColumnNumber);
  96.     STDMETHOD(HandleUnparsedDoctypeDecl)   (THIS_ const char* pDoctype,
  97.                                                   const char* pSystemID,
  98.                                                   const char* pPublicID,
  99.                                                   UINT32      ulLineNumber,
  100.                                                   UINT32      ulColumnNumber);
  101.     STDMETHOD(HandleDefault)               (THIS_ IHXBuffer* pBuffer,
  102.                                                   UINT32      ulLineNumber,
  103.                                                   UINT32      ulColumnNumber);
  104. protected:
  105.     PXRealPixParser();
  106.     virtual ~PXRealPixParser();
  107.     enum
  108.     {
  109.         kTagRoot,
  110.         kTagHead,
  111.         kTagImage,
  112.         kTagFill,
  113.         kTagFadein,
  114.         kTagCrossfade,
  115.         kTagFadeout,
  116.         kTagWipe,
  117.         kTagAnimate,
  118.         kTagViewchange,
  119.         kTagEffect,
  120.         kNumTags  // This should always be last in the enum
  121.     };
  122.     enum
  123.     {
  124.         kAttrWidth,
  125.         kAttrHeight,
  126.         kAttrBitrate,
  127.         kAttrTimeformat,
  128.         kAttrVersion,
  129.         kAttrTitle,
  130.         kAttrAuthor,
  131.         kAttrCopyright,
  132.         kAttrBackgroundcolor,
  133.         kAttrBackgroundOpacity,
  134.         kAttrStart,
  135.         kAttrPreroll,
  136.         kAttrAspect,
  137.         kAttrUrl,
  138.         kAttrMaxfps,
  139.         kAttrDuration,
  140.         kAttrHandle,
  141.         kAttrName,
  142.         kAttrTarget,
  143.         kAttrSrcx,
  144.         kAttrSrcy,
  145.         kAttrSrcw,
  146.         kAttrSrch,
  147.         kAttrDstx,
  148.         kAttrDsty,
  149.         kAttrDstw,
  150.         kAttrDsth,
  151.         kAttrColor,
  152.         kAttrDirection,
  153.         kAttrType,
  154.         kAttrPackage,
  155.         kAttrData,
  156.         kAttrFile,
  157.         kAttrStartsrcx,
  158.         kAttrStartsrcy,
  159.         kAttrStartsrcw,
  160.         kAttrStartsrch,
  161.         kAttrStartdstx,
  162.         kAttrStartdsty,
  163.         kAttrStartdstw,
  164.         kAttrStartdsth,
  165.         kAttrCenter,
  166.         kAttrSize,
  167.         kAttrMime,
  168.         kNumAttr   // This should always be last in the enum
  169.     };
  170.     enum
  171.     {
  172.         kStateConstructed,
  173.         kStateInitialized,
  174.         kStateSawRootStart,
  175.         kStateSawHead,
  176.         kStateSawRootEnd
  177.     };
  178.     struct PXStringTable
  179.     {
  180.         UINT32      m_ulStringID;
  181.         const char* m_pszString;
  182.     };
  183.     HX_RESULT   SetError(UINT32 ulErrorID, UINT32 ulLine, UINT32 ulCol,
  184.                          const char* pszArg1, const char* pszArg2,
  185.                          REF(IHXBuffer*) rpErrStr);
  186.     HX_RESULT   ParseTag(UINT32 ulTagID, IHXValues* pAttr, UINT32 ulLine, UINT32 ulCol, REF(IHXBuffer*) rpError);
  187.     HX_RESULT   ParseHeadTag(IHXValues* pAttr, UINT32 ulLine, UINT32 ulCol, REF(IHXBuffer*) rpError);
  188.     HX_RESULT   ParseImageTag(IHXValues* pAttr, UINT32 ulLine, UINT32 ulCol, REF(IHXBuffer*) rpError);
  189.     HX_RESULT   ParseEffectTag(UINT32 ulTagID, IHXValues* pAttr, UINT32 ulLine,
  190.                                UINT32 ulCol, REF(IHXBuffer*) rpError);
  191.     HX_RESULT   SetupLegalAttrLUT();
  192.     HX_RESULT   SetupIDMaps();
  193.     BOOL        IsLegalAttr(UINT32 ulTagID, const char* pszAttr);
  194.     HX_RESULT   GetTagNameFromID(UINT32 ulTagID, REF(const char*) rpszTag);
  195.     HX_RESULT   GetTagIDFromName(const char* pszTag, REF(UINT32) rulTagID);
  196.     HX_RESULT   GetAttributeNameFromID(UINT32 ulAttrID, REF(const char*) rpszAttr);
  197.     HX_RESULT   GetAttributeIDFromName(const char* pszAttr, REF(UINT32) rulAttrID);
  198.     HX_RESULT   GetFirstRequiredAttribute(UINT32 ulTagID, REF(const char*) rpszAttr);
  199.     HX_RESULT   GetNextRequiredAttribute(UINT32 ulTagID, REF(const char*) rpszAttr);
  200.     HX_RESULT   CheckStringContents(IHXBuffer* pString);
  201.     HX_RESULT   ConvertTimeValue(IHXBuffer* pValue, UINT32 ulTimeFormat, REF(UINT32) ulTime);
  202.     HX_RESULT   ConvertBoolValue(IHXBuffer* pValue, REF(BOOL) rbValue);
  203.     HX_RESULT   ConvertVersionValue(IHXBuffer* pValue, REF(UINT32) rulVersion);
  204.     HX_RESULT   ConvertColorValue(IHXBuffer* pValue, REF(BYTE) rucRed,
  205.                                   REF(BYTE) rucGreen, REF(BYTE) rucBlue);
  206.     HX_RESULT   ConvertWipeDirectionValue(IHXBuffer* pValue, REF(BYTE) rucDir);
  207.     HX_RESULT   ConvertWipeTypeValue(IHXBuffer* pValue, REF(BYTE) rucType);
  208.     HX_RESULT   CheckVersion(UINT32 ulMinVersion);
  209.     void        ReportError(const UINT8 ucSeverity, HX_RESULT lHXCode, IHXBuffer* pErrorStr);
  210.     IUnknown*                  m_pContext;
  211.     IHXCommonClassFactory*     m_pCommonClassFactory;
  212.     IHXXMLParser*              m_pParser;
  213.     PXRealPixFile*             m_pRealPixFile;
  214.     IHXBuffer*                 m_pErrorText;
  215.     IHXBuffer*                 m_pLegalAttrLUT;
  216.     CHXMapStringToOb*          m_pTagToIDMap;
  217.     CHXMapStringToOb*          m_pAttrToIDMap;
  218.     BOOL                       m_bRealPixError;
  219.     BYTE*                      m_pByteListCursor;
  220.     UINT32                     m_ulState;
  221.     PXEffect*                  m_pLastEffect;
  222.     BOOL                       m_bVersionSpecified;
  223.     UINT32                     m_ulStrictnessLevel;
  224.     static const PXStringTable m_pTagTable[];
  225.     static const PXStringTable m_pAttrTable[];
  226.     static const BYTE          m_pAttrList[];
  227.     static const BYTE          m_pRequiredAttrList[];
  228.     static const UINT32        m_ulHighestSupportedContentVersion;
  229. };
  230. #endif