smlparse.h
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:42k
源码类别:

Symbian

开发平台:

C/C++

  1. /* ***** BEGIN LICENSE BLOCK ***** 
  2.  * Version: RCSL 1.0/RPSL 1.0 
  3.  *  
  4.  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
  5.  *      
  6.  * The contents of this file, and the files included with this file, are 
  7.  * subject to the current version of the RealNetworks Public Source License 
  8.  * Version 1.0 (the "RPSL") available at 
  9.  * http://www.helixcommunity.org/content/rpsl unless you have licensed 
  10.  * the file under the RealNetworks Community Source License Version 1.0 
  11.  * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, 
  12.  * in which case the RCSL will apply. You may also obtain the license terms 
  13.  * directly from RealNetworks.  You may not use this file except in 
  14.  * compliance with the RPSL or, if you have a valid RCSL with RealNetworks 
  15.  * applicable to this file, the RCSL.  Please see the applicable RPSL or 
  16.  * RCSL for the rights, obligations and limitations governing use of the 
  17.  * contents of the file.  
  18.  *  
  19.  * This file is part of the Helix DNA Technology. RealNetworks is the 
  20.  * developer of the Original Code and owns the copyrights in the portions 
  21.  * it created. 
  22.  *  
  23.  * This file, and the files included with this file, is distributed and made 
  24.  * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
  25.  * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
  26.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS 
  27.  * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
  28.  * 
  29.  * Technology Compatibility Kit Test Suite(s) Location: 
  30.  *    http://www.helixcommunity.org/content/tck 
  31.  * 
  32.  * Contributor(s): 
  33.  *  
  34.  * ***** END LICENSE BLOCK ***** */ 
  35. #ifndef _SMLPARSE_H_
  36. #define _SMLPARSE_H_
  37. #define MAX_PENDING_CHECK_CALLDEPTH 20
  38. /* <body dur="20s">[no sources]</body> is valid; we need to handle it: */
  39. #define DEFAULT_DUR_IF_NO_SOURCES_SCHEDULED   SMILTIME_INVALID
  40. // forward declarations
  41. typedef _INTERFACE IHXSystemRequired     IHXSystemRequired;
  42. typedef _INTERFACE IHXBuffer             IHXBuffer;
  43. typedef _INTERFACE IHXValues             IHXValues;
  44. typedef _INTERFACE IHXXMLParserResponse  IHXXMLParserResponse;
  45. typedef _INTERFACE IHXCommonClassFactory IHXCommonClassFactory;
  46. typedef _INTERFACE IHXXMLParser          IHXXMLParser;
  47. typedef void*                             LISTPOSITION;
  48. class CHXString;
  49. class SMILNodeList;
  50. class CSmilElement;
  51. class CHXSimpleList;
  52. class ErrorNotifier;
  53. class CSmilParser;
  54. class CSmilElementHandler;
  55. class SmilTimeValue;
  56. class CHXPtrArray;
  57. class CSmilAnchorElement;
  58. class CHXStack;
  59. class CSmilRegion;
  60. class CSmilRegPoint;
  61. #if defined(HELIX_FEATURE_SMIL2_MULTIWINDOWLAYOUT)
  62. class CSmilViewport;
  63. #endif /* #if defined(HELIX_FEATURE_SMIL2_MULTIWINDOWLAYOUT) */
  64. class CSmilTransition;
  65. class CSmilRootLayout;
  66. class CSmilMeta;
  67. class CSmilMetadata;
  68. class CSmilRendererPreFetch;
  69. class CSmilSource;
  70. class CSmilPriorityClassElement;
  71. class CSmilAAnchorElement;
  72. class CSmilSeqElement;
  73. class CSmilParElement;
  74. class CSmilExclElement;
  75. class CSmilAnimateElement;
  76. class CSmilParamElement;
  77. class CSmilCustomTest;
  78. class XMLError;
  79. class CHXMapLongToObj;
  80. class CHXMapStringToOb;
  81. #if defined(HELIX_FEATURE_SMIL2_VALIDATION)
  82. class CRNBinaryMap;
  83. #endif /* #if defined(HELIX_FEATURE_SMIL2_VALIDATION) */
  84. class CNamespaceInfo;
  85. class CSmilBodyElement;
  86. class CSmilTimelineElementManager;
  87. /* // /XXXEH- we can't do the following until the core starts notifying
  88. // us every time a repeated track begins:
  89. //#define XXXEH_REPEAT_VALUE_TIMING_SHOULD_BE_EVENT_BASED
  90. */
  91. #define NUM_SUPPORTED_SMIL_2_0_MODULE_NAMESPACES   55
  92. class SMILNamespace
  93. {
  94. public:
  95.     SMILNamespace(SMILNamespace* pNS);
  96.     SMILNamespace(const char* name, IHXBuffer* pVal);
  97.     virtual ~SMILNamespace();
  98.     char*       m_name;
  99.     IHXBuffer* m_pValue;
  100. };
  101. class SMILNode
  102. {
  103. public:
  104.     SMILNode();
  105.     virtual ~SMILNode();
  106. #if defined(XXXEH_REPEAT_VALUE_TIMING_SHOULD_BE_EVENT_BASED)
  107.     SMILNode(const SMILNode&, BOOL bKeepId=FALSE, CSmilParser* pParser = NULL);
  108. #else
  109.     SMILNode(const SMILNode&, BOOL bKeepId=FALSE, CSmilParser* pParser = NULL,
  110.              UINT32 ulRepeatNum=0);
  111. #endif
  112.     SMILNode* getFirstChild();
  113.     SMILNode* getNextChild();
  114.     CHXString      m_repeatid;
  115.     CHXString      m_id;
  116.     CHXString      m_name;
  117.     UINT32         m_num;    
  118.     SMILNodeTag    m_tag;
  119.     SMILNode*      m_pParent;
  120.     SMILNode*      m_pDependency;
  121.     SMILNodeList*  m_pNodeList;
  122.     IHXValues*    m_pValues;
  123.     CSmilElement*  m_pElement;
  124.     UINT16         m_nGroup;
  125.     RepeatTag      m_repeatTag;
  126.     CHXString      m_trackHint;
  127.     UINT32         m_ulTagStartLine;
  128.     UINT32         m_ulTagStartColumn;
  129.     UINT16         m_nPrefetchTrackNum;
  130.     double         m_fPartialPlayFactor;
  131.     UINT32         m_ulRepeatDur;
  132.     CHXSimpleList* m_pNamespaceList;
  133.     SMIL2Element   m_eElement;
  134.     // ONLY HX_BITFIELD MEMBERS SHOULD GO BELOW THIS LINE!
  135.     // ALL OTHER MEMBER TYPES SHOULD GO ABOVE THIS LINE!
  136.     HX_BITFIELD    m_bLastInGroup : 1;
  137.     HX_BITFIELD    m_bDelete : 1;
  138.     HX_BITFIELD    m_bSkipContent : 1;
  139.     HX_BITFIELD    m_bRepeatHandled : 1;
  140.     HX_BITFIELD    m_bIsSeqWrapperForRepeatElement : 1;
  141.     HX_BITFIELD    m_bIsOuterWrapperTimeContainer : 1;
  142.     HX_BITFIELD    m_bBeginHandledByWrapperParent : 1;
  143.     HX_BITFIELD    m_bEndHandledByWrapperParent : 1;
  144.     HX_BITFIELD    m_bMinHandledByWrapperParent : 1;
  145.     HX_BITFIELD    m_bMaxHandledByWrapperParent : 1;
  146.     HX_BITFIELD    m_bNeedToResolveRepeatDurVSRepeatCount : 1;
  147.     HX_BITFIELD    m_bCloseNode : 1;
  148.     HX_BITFIELD    m_bNamespacedElement : 1;
  149. private:
  150.     LISTPOSITION   m_curPosition;
  151. };
  152. class SMILNodeList: public CHXSimpleList
  153. {
  154. public:
  155.     SMILNodeList();
  156.     virtual ~SMILNodeList();
  157.     SMILNodeList* copy(SMILNode* pParent, BOOL bKeepId = FALSE, CSmilParser* pParser = NULL);
  158.     SMILNode* m_pParentNode;
  159. };
  160. class CNamespaceInfo
  161. {
  162. public:
  163.     CNamespaceInfo();
  164.     ~CNamespaceInfo();
  165.     char*              m_pszPrefix;
  166.     char*              m_pszURL;
  167.     SupportedNamespace m_eNamespace;
  168.     // ONLY HX_BITFIELD MEMBERS SHOULD GO BELOW THIS LINE!
  169.     // ALL OTHER MEMBER TYPES SHOULD GO ABOVE THIS LINE!
  170.     HX_BITFIELD        m_bImplemented : 1;
  171. };
  172. class CSmilParserResponse : public IHXXMLParserResponse,
  173.                             public ErrorNotifier
  174. {
  175. public:
  176.     CSmilParserResponse(CSmilParser* pParser);
  177.     virtual ~CSmilParserResponse();
  178.     // IUnknown methods
  179.     STDMETHOD(QueryInterface)    (THIS_ REFIID riid, void** ppvObj);
  180.     STDMETHOD_(ULONG32, AddRef)  (THIS);
  181.     STDMETHOD_(ULONG32, Release) (THIS);
  182.     // IHXXMLParserResponse methods
  183.     STDMETHOD(HandleStartElement)          (THIS_ const char* pName,
  184.                                                   IHXValues* pAttributes,
  185.                                                   UINT32      ulLineNumber,
  186.                                                   UINT32      ulColumNumber);
  187.     STDMETHOD(HandleEndElement)            (THIS_ const char* pName,
  188.                                                   UINT32      ulLineNumber,
  189.                                                   UINT32      ulColumNumber);
  190.     STDMETHOD(HandleCharacterData)         (THIS_ IHXBuffer* pBuffer,
  191.                                                   UINT32      ulLineNumber,
  192.                                                   UINT32      ulColumNumber);
  193.     STDMETHOD(HandleProcessingInstruction) (THIS_ const char* pTarget,
  194.                                                   IHXValues* pAttributes,
  195.                                                   UINT32      ulLineNumber,
  196.                                                   UINT32      ulColumNumber);
  197.     STDMETHOD(HandleUnparsedEntityDecl)    (THIS_ const char* pEntityName,
  198.                                                   const char* pSystemID,
  199.                                                   const char* pPublicID,
  200.                                                   const char* pNotationName,
  201.                                                   UINT32      ulLineNumber,
  202.                                                   UINT32      ulColumNumber);
  203.     STDMETHOD(HandleNotationDecl)          (THIS_ const char* pNotationName,
  204.                                                   const char* pSystemID,
  205.                                                   const char* pPublicID,
  206.                                                   UINT32      ulLineNumber,
  207.                                                   UINT32      ulColumNumber);
  208.     STDMETHOD(HandleComment)               (THIS_ const char* pComment,
  209.                                                   UINT32      ulLineNumber,
  210.                                                   UINT32      ulColumNumber);
  211.     STDMETHOD(HandleUnparsedDoctypeDecl)   (THIS_ const char* pName, 
  212.                                                   const char* pSystemID,
  213.                                                   const char* pPublicID, 
  214.                                                   UINT32      ulLineNumber,
  215.                                                   UINT32      ulColumNumber);
  216.     STDMETHOD(HandleDefault)               (THIS_ IHXBuffer* pBuffer,
  217.                                                   UINT32      ulLineNumber,
  218.                                                   UINT32      ulColumNumber);
  219.     // ErrorNotifer methods
  220.     HX_RESULT ErrorInLastTag(HX_RESULT   Error,
  221.                              const char* pErrorString,
  222.                              const char* pFrameString,
  223.                              UINT32      ulLineNumber,
  224.                              UINT32      ulLinePosition);
  225. private:
  226.     CSmilParser* m_pParser;
  227.     INT32        m_lRefCount;
  228.     SMILNode*    m_pCurrentNode;
  229. };
  230. struct ExternalEventInfo
  231. {
  232.     CHXString       m_EventBaseID;
  233.     CHXString       m_PrefixedEventName;
  234.     CHXString       m_EventName;
  235.     CNamespaceInfo* m_pInfo;
  236. };
  237. class CSmilParser
  238. {
  239. public:
  240.     CSmilParser(IUnknown* pContext);
  241.     virtual ~CSmilParser();
  242.     HX_RESULT            init(BOOL bStoreErrors = FALSE);
  243.     HX_RESULT            parse(IHXBuffer* pBuffer, BOOL bIsFinal);
  244.     HX_RESULT            parse(const char* pSmilText);
  245. #if defined(HELIX_FEATURE_SMIL2_VALIDATION)
  246.     HX_RESULT            validateContentModel(UINT32 ulElement, SMILNodeList* pChildren);
  247.     HX_RESULT            validateNode(SMILNode* pNode);
  248.     HX_RESULT            validateCDATA(const char* pszStr) const;
  249.     HX_RESULT            validateIDREF(const char* pszStr) const;
  250.     HX_RESULT            validateNMTOKEN(const char* pszStr) const;
  251.     HX_RESULT            validateEnumerated(UINT32 ulElem, UINT32 ulAttr, const char* pszStr);
  252.     BOOL                 isXMLLetter(char c) const;
  253.     BOOL                 isXMLDigit(char c) const;
  254.     BOOL                 isXMLNameChar(char c) const;
  255.     BOOL                 isNamespacePrefixed(const char* pszStr);
  256.     HX_RESULT            normalizeAttribute(const char* pszStr,
  257.                                             BOOL        bIsCDATA,
  258.                                             REF(char*)  rpszNormal);
  259.     HX_RESULT            validateAttribute(UINT32 ulElement, UINT32 ulAttrib,
  260.                                            const char* pszStr, REF(char*) rpszNormStr);
  261.     HX_RESULT            validateElementName(SMILNode* pNode);
  262.     HX_RESULT            setupValidationNamespaces(SMILNode* pNode);
  263.     HX_RESULT            validateAgainstDTD();
  264.     HX_RESULT            checkExtensionElementNamespace(SMIL2Element eElem,
  265.                                                         SupportedNamespace eNS);
  266.     HX_RESULT            checkExtensionAttributeNamespace(SMIL2Attribute eAttr,
  267.                                                           SupportedNamespace eNS);
  268. #endif /* #if defined(HELIX_FEATURE_SMIL2_VALIDATION) */
  269.     CNamespaceInfo*      getNamespaceInfo(const char* pszStr, REF(const char*) rpszAttr);
  270.     HX_RESULT            createElements();
  271.     HX_RESULT            durationResolved(const char* pID, UINT32 ulDuration,
  272.                                           BOOL bSetByParent=FALSE,
  273.                                           BOOL bDurationExtendingDueToPause=FALSE);
  274.     HX_RESULT            trackRemoved(const char* pID, UINT32 ulDuration);
  275.     HX_RESULT            adjustForNegativeOffset(const char* pID);
  276.     void                 insertTimelineElement(const char* pID, UINT32 ulDelay);
  277.     void                 resetTimelineElementDuration(const char* pID,
  278.                                                       UINT32 ulDuration,
  279.                                                       UINT32 ulPriorDuration);
  280.     void                 resetTimelineElementDelay(const char* pID, UINT32 ulDelay,
  281.                                                    UINT32 ulPriorDelay);
  282.     void                 resetTimeline();
  283.     HX_RESULT  prepForSeek(UINT32 ulOldTime, UINT32 ulNewTime);
  284.     HX_RESULT            handlePrefetchFinished(const char* pID, UINT32 ulTimeFinished);
  285.     UINT16               getFragmentGroup(const char* pFragment);
  286.     UINT32               getFragmentOffset(const char* pFragment,
  287.                                            BOOL& bFragFoundAndResolved,
  288.                                            BOOL bResolveBeginOfFragmentTarget=FALSE,
  289.                                            ULONG32 ulCurTime=0);
  290.     HX_RESULT            handleNextElement(CSmilElementHandler* pHandler);
  291.     HX_RESULT            setAllElementHandlers(CSmilElementHandler* pHandler);
  292.     SMILNode*            findFirstNode(SMILNodeTag tag);
  293.     SMILNode*            getFirstNodeChild(SMILNode* pNode);
  294.     SMILNode*            getPrevNode(SMILNode* pCurrentNode);
  295.     CSmilElement*        findElement(const char* pID);
  296.     SMILNode*            getNextNodeChild();
  297.     SMILNodeTag          getSyncTag(SMILNode* pNode);
  298.     void                 getPacketPending(UINT16 unStreamNumber);
  299.     HX_RESULT            addGlobalNamespace(const char* pNamespace, const char* pPrefix);
  300.     HX_RESULT            storeNamespaces(SMILNode* pNode);
  301.     HX_RESULT            addToNamespaceScope(SMILNode* pNode);
  302.     HX_RESULT            removeFromNamespaceScope(SMILNode* pNode);
  303.     BOOL                 isSupportedNonRNNamespace(const char* pNamespace);
  304.     HX_RESULT            addBeginTimeSyncElement(CSmilElement* pElement);
  305.     HX_RESULT            addEndTimeSyncElement(CSmilElement* pElement);
  306.     HX_RESULT            resolveSyncBaseElements();
  307.     HX_RESULT            handleExclDescendants();
  308.     HX_RESULT            addBeginEventElement(SmilTimeValue* pTimeVal);
  309.     HX_RESULT            tryToResolveBeginEndEvents(const char* pEventName,
  310.                                                     const char* pEventElementId,
  311.                                                     ULONG32     ulEventTime);
  312.     HX_RESULT            addEndEventElement(SmilTimeValue* pTimeVal);
  313.     HX_RESULT            addBeginMediaMarkerSyncElement(SmilTimeValue* pTmpVal);
  314.     HX_RESULT            addEndMediaMarkerSyncElement(SmilTimeValue* pTmpVal);
  315.     HX_RESULT            resolveMediaMarkerTime(const char* pszID,
  316.                                                 const char* pszMarkerName,
  317.                                                 UINT32      ulMarkerTime,
  318.                                                 REF(BOOL)   rbNeedHandleElements);
  319.     HX_RESULT            handlePendingScheduling(INT32 lCurTime,
  320.                                                  INT16 iCurrentGroupIndex,
  321.                                                  REF(BOOL) bSomeScheduleWasChanged,
  322.                                                  /*OUT*/ CHXSimpleList* pPauseDisplayElementHideList,
  323.                                                  /*OUT*/ CHXSimpleList* pPauseDisplayDisableElementList);
  324.     HX_RESULT            checkPendingBeginAndEndTimes(INT32     lCurTime,
  325.                                                       INT16 iCurrentGroupIndex,
  326.                                                       REF(BOOL) bREFSomeScheduleWasChanged,
  327.                                                       INT32     lRecursionCount,
  328.                                                       /*OUT*/ CHXSimpleList* pPauseDisplayElementHideList,
  329.                                                       /*OUT*/ CHXSimpleList* pPauseDisplayDisableElementList,
  330.                                                       BOOL bDoHandleExclBeforePlaybackStarts);
  331.     HX_RESULT            insertElementWithPendingBeginOrEnd(CSmilElement*      pElement,
  332.                                                             INT32              lCurTime,
  333.                                                             SmilTimingListType listType);
  334.     void                 handleAllXMMFReferences();
  335.     CHXMapStringToOb*    findNextPendingOnLoadURL(UINT32 lCurTime);
  336.     BOOL                 hasActivateEventListener(const char* pMediaID,
  337.                                                   INT16 iCurrentGroupIndex);
  338.     const char*          getDefaultNamespace();
  339.     // note -- the pErr array returned has the same scope as the SMILParser 
  340.     // object
  341.     HX_RESULT            getErrors(CHXPtrArray** pErrs);
  342.     SMILNode*            getSyncAncestor(SMILNode* pNode);
  343.     // /NOTE: sync base is not always begin of sync ancestor; in a seq, it's
  344.     // end of prior sibling (if any), so this calculates all that:
  345.     virtual ULONG32      getSyncBaseTimeInGroupTimeCoords(SMILNode* pNode);
  346.     // /Tells whether any node all the way up to the root has specified
  347.     // ancestor tag:
  348.     BOOL                 hasAncestor(SMILNodeTag ancestor, SMILNode* pNode);
  349.     // Added to be able to quickly lookup <anchor> or <area> tags
  350.     // by id and not by the region they map to.
  351.     CSmilAnchorElement*  getAnchorOrAreaElement(const char* pID);
  352.     // XXXMEH - moved this from private to public so that we 
  353.     // could animate the coords attribute. This method is needed
  354.     // to parse the coords attribute.
  355.     HX_RESULT            parseAnchorCoords(const char*         pCoords,
  356.                                            CSmilAnchorElement* pAnchor);
  357.     BOOL                 presentationContainsASource() {return m_bContainsSource; }
  358.     BOOL                 presentationContainsInitiallyScheduledTrack() {
  359.                     return m_bContainsInitiallyScheduledTrack; }
  360.     ULONG32              presentationDurIfNoInitialTracksScheduled() {
  361.                             return m_ulDurIfNoInitialTracksScheduled; }
  362.     BOOL                 EstablishBeginTimeList();
  363.     BOOL                 EstablishEndTimeList();
  364.     BOOL                 EstablishBeginEventList();
  365.     BOOL                 EstablishEndEventList();
  366.     CHXSimpleList*       GetPendingBeginTimeList() {return m_pPendingBeginTimeList;}
  367.     CHXSimpleList*       GetPendingEndTimeList() {return m_pPendingEndTimeList;}
  368.     CHXSimpleList*       GetBeginEventList() {return m_pBeginEventList;}
  369.     CHXSimpleList*       GetEndEventList()   {return m_pEndEventList;}
  370.     BOOL                 isDuplicateEntry(CHXSimpleList* pList,
  371.                                           SmilTimeValue* pTimeValue);
  372.     HX_RESULT            addResumeEvent(SmilTimeValue* pTimeValue,
  373.                                         REF(BOOL) bOldResumeEventWasRemoved);
  374.     HX_RESULT            addUndeferEvent(SmilTimeValue* pTimeValue,
  375.                                         REF(BOOL) bOldUndeferEventWasRemoved);
  376.     HX_RESULT            addResumeOrUndeferEvent(SmilTimeValue* pTimeValue,
  377.                                         REF(BOOL) bOldSuchEventWasRemoved,
  378. BOOL bIsResumeEvent);
  379.     HX_RESULT            computeRemoveTime(const char* pszID,
  380.                                            REF(UINT32) rulRemoveTime);
  381.     void                 InitPersistent(UINT32 ulPersistentComponentID, IHXValues* pProperties);
  382.     BOOL                 isTimelineObject(SMILNode* pNode);
  383.     static BOOL          isMediaObject(SMILNode* pNode);
  384.     BOOL                 isNonMediaPlayableObject(SMILNode* pNode);
  385.     BOOL                 isTimeContainerObject(SMILNode* pNode);
  386.     UINT16               getNumGroups() const { return m_usNumGroups; }
  387.     const char*          getEnumAttrString(SMIL2Attribute eAttr, BYTE ucVal);
  388.     void                 setParseError(HX_RESULT rv) { m_lParseError = rv;   }
  389.     HX_RESULT            getParseError() const       { return m_lParseError; }
  390.     BOOL                 isAttributeAnimated(const char* pszElementID,
  391.                                              UINT32      ulAttrName);
  392.     SMIL2Element         getSMIL2Element(const char* pszStr);
  393.     SMIL2Attribute       getSMIL2Attribute(const char* pszStr);
  394.     void                 checkForExternalEvents();
  395.     BOOL                 anyExternalEvents(const char* pszID);
  396.     ExternalEventInfo*   getFirstExternalEvent(const char* pszID);
  397.     ExternalEventInfo*   getNextExternalEvent(const char* pszID);
  398.     void                 checkForEventHandlers();
  399.     AccessErrorBehavior  getAccessErrorBehavior(SMILNode* pNode);
  400.     UINT32               GetUniqueNumber() { return m_ulNextVar++; }
  401.     // CSmilParser static public member methods
  402.     static HX_RESULT     parseRegionDimension(const char*   pszStr,
  403.                                               REF(double)   rdValue,
  404.                                               REF(CSS2Type) reType);
  405.     static HX_RESULT     parseZIndex(const char*   pszStr,
  406.                                      REF(INT32)    rlValue,
  407.                                      REF(CSS2Type) reType);
  408.     static HX_RESULT     parseColor(const char*   pszStr,
  409.                                     REF(UINT32)   rulColor,
  410.                                     REF(CSS2Type) reType);
  411.     static HX_RESULT     parseFit(const char*   pszStr,
  412.                                   REF(Fit)      reValue);
  413.     static HX_RESULT     parseRegAlign(const char*   pszStr,
  414.                                        REF(RegAlign) reValue);
  415.     static HX_RESULT     parseOpacity(const char* pszStr, REF(UINT32) rulOpacity);
  416.     static HX_RESULT     parseFill(const char* pszStr, REF(FillType) reFill);
  417.     static HX_RESULT     getFillString(FillType eFill, REF(CHXString) rcFill);
  418.     static HX_RESULT     getEraseString(EraseType eErase, REF(CHXString) rcErase);
  419.     static HX_RESULT     parseFillDefault(const char* pszStr, REF(FillDefaultType) reFillDefault);
  420.     static HX_RESULT     parseAccelDecel(const char* pszStr, REF(double) rdVal);
  421. #if defined(HELIX_FEATURE_SMIL2_TRANSITIONS)
  422.     static HX_RESULT     getDefaultTransitionSubType(const char* pszType, REF(CHXString) rcSubType);
  423.     static BOOL          isLegalTransitionType(const char* pszType);
  424.     static BOOL          isLegalTransitionSubType(const char* pszType, const char* pszSubType);
  425. #endif /* #if defined(HELIX_FEATURE_SMIL2_TRANSITIONS) */
  426.     static HX_RESULT     parseMarkerURI(const char*    pszStr,
  427.                                         REF(CHXString) rcMarker,
  428.                                         REF(BOOL)      rbExternal,
  429.                                         REF(CHXString) rcExternalFileName);
  430.     static HX_RESULT     parseHandlerForID(const char*    pszStr,
  431.                                            REF(CHXString) rcHandlerID);
  432.     static HX_RESULT     parseAccessErrorBehavior(const char* pszStr,
  433.                                                   REF(AccessErrorBehavior) reErr);
  434. #if defined(XXXMEH_SPLINE_ANIMATION)
  435.     static HX_RESULT     parseKeyTimes(const char* pszVal, CSmilAnimateElement* pAnim);
  436.     static HX_RESULT     parseKeySplines(const char* pszVal, CSmilAnimateElement* pAnim);
  437.     static HX_RESULT     parseSVGPath(const char* pszVal, CSmilAnimateElement* pAnim);
  438. #endif
  439.     static BOOL          isDataURL(const char* pszURL);
  440.     static HX_RESULT     validateDataURL(const char* pszURL);
  441.     static void          addStringProperty(IHXValues* pValues,
  442.                                            IUnknown*   pContext,
  443.                                            const char* pszName,
  444.                                            const char* pszValue);
  445.     BOOL                 allTracksNeedReflushHint() { return m_bAllTracksNeedReflushHint; }
  446.     // CSmilParser public members    
  447.     CHXStack*     m_pNodeListStack;
  448.     SMILNodeList* m_pNodeList;
  449.     UINT32        m_ulErrorLineNumber;
  450.     UINT32        m_ulErrorColumnNumber;
  451.     IHXBuffer*   m_pErrorText;
  452.     IHXBuffer*   m_pDefaultNamespace;
  453.     UINT32        m_ulPersistentComponentDelay;
  454.     UINT32        m_ulPersistentComponentDuration;
  455.     CSmilTimelineElementManager* m_pTimelineElementManager;
  456.     friend class CSmilParserResponse;
  457. private:
  458.     void                   close();
  459.     void                   initRequireTags();
  460.     void    GetSystemScreenInfo(REF(UINT32) rulScreenHeight,
  461.        REF(UINT32) rulScreenWidth,
  462.        REF(UINT32) rulScreenBitDepth);
  463.     void                   getPreferences();
  464.     HX_RESULT              createHeadElements(SMILNodeList* pNodeList);
  465.     HX_RESULT              createSeqWrapper(SMILNodeList* pNodeList, BOOL bMakeInnerPar);
  466.     HX_RESULT              createBodyElements(SMILNodeList* pNodeList);
  467.     HX_RESULT              createElementForAnchorTarget(CSmilAAnchorElement* pAnchor,
  468.                                                        SMILNodeList* pNodeList);
  469. #if 0  /*XXXEH- I wrote this and then didn't need it but it may come in
  470.          handy later so #if(0) it out: */
  471.     BOOL                   hasNoSourceChildren(SMILNode* pNode);
  472. #endif
  473.     HX_RESULT              assignGroupIndexes(SMILNodeList* pNodeList);
  474.     HX_RESULT              assignGroupIndexOnPar(SMILNode* pNode, UINT16 nGroup);
  475.     HX_RESULT              assignGroupIndexOnSeq(SMILNode* pNode, UINT16& nGroup);
  476.     HX_RESULT              constructTimelineElements(SMILNodeList* pNodeList);
  477.     HX_RESULT              setInitialDelays(SMILNodeList* pNodeList);
  478.     void                   setInitialDelay(SMILNode* pNode);
  479.     void                   setInitialDelayOnSeq(SMILNode* pNode);
  480.     HX_RESULT              expandRepeatElements(SMILNodeList* pNodeList);
  481.     HX_RESULT              printBodyElements(SMILNodeList* pNodeList);
  482.     HX_RESULT              updateEventElements(SMILNodeList* pNodeList);
  483.     HX_RESULT              insertElementByTimestamp(CSmilElement* pElement);
  484.     HX_RESULT              addGroup(SMILNode* pNode);
  485.     HX_RESULT              insertGroups();
  486.     HX_RESULT              mapID(SMILNode* pNode, BOOL bOverWrite = FALSE);
  487.     HX_RESULT              mapChildrenIDs(SMILNodeList* pNodeList, BOOL bOverWrite = FALSE);
  488.     HX_RESULT              markRepeatReplica(SMILNodeList* pNodeList, RepeatTag repeatTag);
  489.     BOOL                   testAttributeFailed(SMILNode* pNode);
  490.     BOOL                   customTestFailed(SMILNode* pNode);
  491.     BOOL                   systemComponentFailed(IHXBuffer* pRequiredValue);
  492.     HX_RESULT              markTestAttributeNodes(SMILNodeList* pNodeList);
  493.     HX_RESULT              selectSwitchNodes(SMILNode* pNode);
  494.     BOOL                   inSeq(SMILNode* pNode);
  495.     HX_RESULT              createParent(SMILNode* pChildNode, SMILNodeTag tag,
  496.                                         SMILNode*& pParent, SMILNode*& pParentEnd);
  497.     void                   resolveTimestamps();
  498.     void                   resolveTimestamps(SMILNodeList* pNodeList);
  499.     UINT32                 getStartTime(SMILNode* pNode);
  500.     CSmilRegion*           makeRegion(SMILNode* pNode);
  501.     CSmilRegPoint*         makeRegPoint(SMILNode* pNode);
  502. #if defined(HELIX_FEATURE_SMIL2_MULTIWINDOWLAYOUT)
  503.     CSmilViewport*         makeViewport(SMILNode* pNode);
  504. #endif /* #if defined(HELIX_FEATURE_SMIL2_MULTIWINDOWLAYOUT) */
  505.     CSmilTransition*       makeTransition(SMILNode* pNode, REF(HX_RESULT) retVal);
  506.     CSmilRootLayout*       makeRootLayout(SMILNode* pNode);
  507.     CSmilMeta*             makeMeta(SMILNode* pNode);
  508.     CSmilMetadata*         makeMetadata(SMILNode* pNode);
  509.     CSmilCustomTest*       makeCustomTest(SMILNode* pNode,
  510.                                     REF(HX_RESULT) retVal);
  511.     CSmilRendererPreFetch* makeRendererPreFetch(SMILNode* pNode);
  512.     CSmilSource*           makeSource(SMILNode* pNode);
  513.     CSmilPriorityClassElement* makePriorityClassElement(SMILNode* pNode);
  514.     CSmilAAnchorElement*   makeAAnchorElement(SMILNode* pNode);
  515.     CSmilAnchorElement*    makeAnchorElement(SMILNode* pNode);
  516.     CSmilSeqElement*       makeSeqElement(SMILNode* pNode);
  517.     CSmilParElement*       makeParElement(SMILNode* pNode);
  518.     CSmilExclElement*      makeExclElement(SMILNode* pNode);
  519.     CSmilParamElement*     makeParamElement(SMILNode* pNode);
  520.     CSmilBodyElement*      makeBodyElement(SMILNode* pNode);
  521. #if defined(HELIX_FEATURE_SMIL2_ANIMATION)
  522.     CSmilAnimateElement*   makeAnimateElement(SMILNode* pNode);
  523.     HX_RESULT              animSetupElement(CSmilAnimateElement* pAnim);
  524. #if defined(XXXMEH_SPLINE_ANIMATION)
  525.     HX_RESULT              checkSplineAnimation(CSmilAnimateElement* pAnim);
  526.     HX_RESULT              makeSVGPathExplicit(CSmilAnimateElement* pAnim);
  527. #endif
  528.     HX_RESULT              animCountValues(const char* pszStr, REF(char*)  rpStr,
  529.                                            REF(UINT32) rulNumValues, REF(char**) rppStr);
  530.     HX_RESULT              animParseValue(CSmilAnimateElement* pAnim,
  531.                                           const char*          pszVal,
  532.                                           UINT32               i);
  533. #endif /* #if defined(HELIX_FEATURE_SMIL2_ANIMATION) */
  534.     SMILNode*              getSpecificAncestor(SMILNodeTag ancestor, SMILNode* pNode);
  535.     SMILNode*              findAnyActiveDescendant(SMILNode* pNode,
  536.                                LONG32 lCurTime, SMILNode* pButNotThisNode);
  537.     SMILNode*              findActiveChildOfAncestorExcl(SMILNode* pNode, LONG32 lCurTime);
  538.     SMILNode*              findLastDeferredChildOfAncestorExcl(
  539.                                    SMILNode* pInterruptingNode, LONG32 lCurTime);
  540.     SMILNode*              findLastDeferredDescendant(SMILNode* pNode,
  541.                                      LONG32 lCurTime,
  542.                                      SMILNode* pButNotThisNode,
  543.                                      SMILNode* pLastDeferredChild);
  544.     BOOL                   firstDependentChild(SMILNode* pNode);
  545.     SMILNode*              findFirstNode(SMILNodeList* pNodelist, SMILNodeTag tag);
  546.     // /Finds parent's next child; doesn't have to be a timeline element:
  547.     SMILNode*              findNextSibling(SMILNode* pNode);
  548.     SMILNode*              getTimelineDescendent(SMILNode* pParentNode, SMILNode* pSiblingNode);
  549.     SMILNode*              getTimelineDescendent(SMILNode* pParentNode);
  550.     const char*            assignID(const char* pPrefix);
  551.     HX_RESULT              parseDuration(const char*          pDuration,
  552.                                          CSmilElement*        pElement,
  553.                                          SMILSyncAttributeTag nTag);
  554.     HX_RESULT              parseMarkerClipBeginEnd(const char* pszStr,
  555.                                                    REF(char*)  rpszMarkerName,
  556.                                                    REF(char*)  rpszExtFileName);
  557.     HX_RESULT              adjustDuration(CSmilElement* pElement);
  558.     HX_RESULT              parseClockValue(const char* pValue, UINT32& ulClockValue);
  559.     HX_RESULT              parseSyncBehaviorVal(const char*          pSyncBhvrBuf,
  560.                                                 CSmilElement*        pElement,
  561.                                                 SMILSyncAttributeTag nTag);
  562.     HX_RESULT              parsePeersHigherLower(const char* pBuf,
  563.                                 CSmilPriorityClassElement* pPCElement,
  564.                                 SMILPriorityClassPeersHigherLowerAttrib nAttrib);
  565.     HX_RESULT              parsePauseDisplay(const char* pBuf,
  566.                                 CSmilPriorityClassElement* pPCElement);
  567.     BOOL                   inLanguagePreference(const char* pLang);
  568.     BOOL                   isRelativeURL(const char* pURL);
  569.     UINT8                  getColorElement(const char* pColorFragment, int len);
  570.     void                   handleXMLParserError(XMLError* pError);
  571.     void                   badAttributeError(SMILNodeTag tag,
  572.                                              const char* pNodeName,
  573.                                              UINT32      ulLineNumber,
  574.                                              BOOL        bJustStore);
  575.     void                   initTagAttributes();
  576.     void                   deleteTagAttributes();
  577.     BOOL                   isLegalAttribute(SMILNodeTag tag, const char* pAttrName);
  578.     HX_RESULT              storeError(HX_RESULT   errCode, 
  579.                                       const char* pErrorString, 
  580.                                       const char* pFrameString,
  581.                                       UINT32      ulLineNumber, 
  582.                                       UINT32      ulLinePosition,
  583.                                       BOOL        bXml = TRUE);
  584.     BOOL                   isEndTagObject(SMILNode* pNode);
  585.     const char*            removeSurroundingWhitespace(const char* pValue);
  586.     HX_RESULT              parseBeginEnd(const char*          pBuffer, 
  587.                                          CSmilElement*        pElement,
  588.                                          SMILSyncAttributeTag nTag);
  589.     HX_RESULT              parseSmil1SyncbaseValue(const char*          pCh, 
  590.                                                    CSmilElement*        pElement,
  591.                                                    SMILSyncAttributeTag nTag);
  592.     HX_RESULT              parseCoord(IHXBuffer* pBuf, REF(float) f);
  593.     HX_RESULT              parseDigit(IHXBuffer* pBuf, REF(UINT32) ul);
  594.     HX_RESULT              parseRestart(const char* pBuffer, CSmilElement* pElement);
  595.     HX_RESULT              parseRestartDefault(const char* pBuffer, CSmilElement* pElement);
  596.     HX_RESULT              parseSensitivity(const char* pszValue, CSmilElement* pSource);
  597.     FillDefaultType        getFillDefault(CSmilElement* pElement);
  598.     void                   resolveFillValue(CSmilElement* pElement);
  599.     BOOL                   isAttributeSpecified(CSmilElement* pElement, const char* pszAttr);
  600. #if defined(HELIX_FEATURE_SMIL2_TRANSITIONS)
  601.     HX_RESULT              getNextTransitionEnd(CSmilElement* pElement, REF(UINT32) rulTime);
  602. #endif /* #if defined(HELIX_FEATURE_SMIL2_TRANSITIONS) */
  603.     void                   initParsingMaps();
  604. #if defined(HELIX_FEATURE_SMIL2_VALIDATION)
  605.     void                   processCollection(CRNBinaryMap* pMap,
  606.                                              UINT32        ulElement,
  607.                                              UINT32        ulCollection);
  608.     void                   deleteEnumAttrMaps();
  609.     void                   deleteReqAttrLists();
  610. #endif /* #if defined(HELIX_FEATURE_SMIL2_VALIDATION) */
  611.     void                   deleteValidationNamespaceList();
  612.     void                   checkForXMMFDependency(CSmilElement* pElement);
  613.     void                   handleBeginEndListXMMFReferences(CSmilElement*  pElement,
  614.                                                             CHXSimpleList* pList);
  615.     void                   handleClipBeginEndXMMFReference(CSmilElement*  pElement,
  616.                                                            BOOL           bIsClipBegin);
  617.     HX_RESULT              setElementHandler(SMILNode* pNode, CSmilElementHandler* pHandler);
  618.     void                   addToBeginOrEndTimeMap(SmilTimeValue*     pValue,
  619.                                                   SmilTimingListType eType);
  620.     void                   removeFromBeginOrEndTimeMap(SmilTimeValue*     pValue,
  621.                                                        SmilTimingListType eType);
  622.     BOOL                   isTimeValueListPresent(const char*         pszEventName,
  623.                                                   const char*         pszElementID,
  624.                                                   SmilTimingListType  eType,
  625.                                                   REF(CHXSimpleList*) rpList);
  626.     void                   clearTimeValueMap(SmilTimingListType eType);
  627.     void                   checkNodeForExternalEvents(SMILNode* pNode);
  628.     void                   checkNodeTimeListForExternalEvents(CHXSimpleList* pList);
  629.     void                   addExternalEventToList(const char*     pszID,
  630.                                                   const char*     pszFullName,
  631.                                                   const char*     pszName,
  632.                                                   CNamespaceInfo* pInfo);
  633.     void                   clearExternalEventList();
  634.     IUnknown*               m_pContext;
  635.     IHXCommonClassFactory* m_pClassFactory;
  636.     IHXSystemRequired*     m_pISystemRequired;
  637.     IHXXMLParser*          m_pParser;
  638.     CSmilParserResponse*    m_pResponse;
  639.     SMILNode*               m_pCurNode;
  640.     CHXStack*               m_pNodeDependencies;
  641.     SMILNode*               m_pCurrentDependentNode;
  642.     CHXStack*               m_pAnchorStack;
  643.     CSmilAAnchorElement*    m_pCurrentAnchor;
  644.     INT32                   m_lLastCheckPendingTime;
  645.     CHXSimpleList*          m_pPacketQueue;
  646.     CHXSimpleList*          m_pSourceUpdateList;
  647.     CHXMapLongToObj*        m_pAddGroupMap;
  648.     CHXMapLongToObj*        m_pTagAttributeMap;
  649.     CHXMapStringToOb*       m_pIDMap;
  650.     CHXMapStringToOb*       m_pRequireTagsMap;
  651. #if defined(HELIX_FEATURE_SMIL2_TRANSITIONS)
  652.     CHXMapStringToOb*       m_pTransitionMap;
  653. #endif /* #if defined(HELIX_FEATURE_SMIL2_TRANSITIONS) */
  654.     CHXMapStringToOb*       m_pActiveNamespaceMap;
  655.     CHXMapStringToOb*       m_pCustomTestMap;
  656.     CHXSimpleList*          m_pNSConflictList;
  657.     CHXSimpleList*          m_pBeginTimeSyncList;
  658.     CHXSimpleList*          m_pEndTimeSyncList;
  659.     CHXSimpleList*          m_pBeginEventList;
  660.     CHXSimpleList*          m_pEndEventList;
  661.     CHXSimpleList*          m_pBeginMediaMarkerList;
  662.     CHXSimpleList*          m_pEndMediaMarkerList;
  663.     CHXSimpleList*          m_pClipBeginMarkerList;
  664.     CHXSimpleList*          m_pClipEndMarkerList;
  665.     CHXSimpleList*          m_pPendingBeginTimeList;
  666.     CHXSimpleList*          m_pPendingEndTimeList;
  667.     CHXSimpleList*          m_pOnLoadURLList;
  668.     CHXSimpleList*          m_pOnLoadURLListCopyForPostSeek; 
  669.     BOOL                    m_bHandlePostSeekOnLoadURLs;
  670.     char*                   m_pBasePath;
  671.     CHXSimpleList*          m_pTrackHintList;
  672.     UINT32                  m_ulBandwidthPreference;
  673.     UINT32                  m_ulScreenHeightPreference;
  674.     UINT32                  m_ulScreenWidthPreference;
  675.     UINT32                  m_ulScreenDepthPreference;
  676.     UINT32                  m_ulDurIfNoInitialTracksScheduled;
  677.     char*                   m_pOverdubOrCaptionPreference;
  678.     char*                   m_pEncoding;
  679.     CHXSimpleList*          m_pLanguagePreferenceList;
  680.     CHXPtrArray*            m_pErrors;
  681.     time_t                  m_tRefTime;
  682.     HXVERSIONINFO           m_versionInfo;
  683.     ULONG32                 m_ulPlatformVer; // /Ret val of HXGetWinVer().
  684.     CHXMapStringToOb*       m_pElementMap;
  685.     CHXMapStringToOb*       m_pAttributeMap;
  686. #if defined(HELIX_FEATURE_SMIL2_VALIDATION)
  687.     CHXMapStringToOb*       m_pExtElementMap;
  688.     CHXMapStringToOb*       m_pExtAttributeMap;
  689.     CHXMapStringToOb*       m_pNamespaceMap;
  690.     CRNBinaryMap*           m_pLegalAttrMap;
  691.     CRNBinaryMap*           m_pContentModelMap;
  692.     XMLAttributeType*       m_pAttrType;
  693.     CHXMapStringToOb**      m_ppEnumAttrMap;
  694.     CHXSimpleList**         m_ppReqAttrList;
  695. #endif /* #if defined(HELIX_FEATURE_SMIL2_VALIDATION) */
  696.     CHXSimpleList*          m_pValNSList;
  697.     CHXSimpleList*          m_pXMMFElementList;
  698.     UINT32                  m_ulPersistentComponentID;
  699.     ElementWithinTag        m_elementWithinTag;
  700.     UINT16                  m_usNumGroups;
  701.     HX_RESULT               m_lParseError;
  702.     CHXSimpleList*          m_pAnimateElementList;
  703.     CHXMapStringToOb*       m_pBeginTimeMap;
  704.     CHXMapStringToOb*       m_pEndTimeMap;
  705.     CHXSimpleList*          m_pExternalEventList;
  706.     LISTPOSITION            m_pExternalEventListPos;
  707.     CHXSimpleList*          m_pElementsWithHandlerList;
  708.     char*                   m_pVarName;
  709.     UINT32                  m_ulNextVar;
  710.     static const char* const zm_pSupportedSMIL2ModuleNamespaces[
  711.                                NUM_SUPPORTED_SMIL_2_0_MODULE_NAMESPACES + 1];
  712.     // ONLY HX_BITFIELD MEMBERS SHOULD GO BELOW THIS LINE!
  713.     // ALL OTHER MEMBER TYPES SHOULD GO ABOVE THIS LINE!
  714.     HX_BITFIELD             m_bIgnoreUnrecognizedElements : 1;
  715.     HX_BITFIELD             m_bNoNamespaces : 1;
  716.     HX_BITFIELD             m_bRNNamespace : 1;
  717.     HX_BITFIELD             m_bSMILRootLayoutAlreadyFound : 1;
  718.     HX_BITFIELD             m_bCaptionsPreference : 1;
  719.     HX_BITFIELD             m_bSystemAudioDescPreference : 1;
  720.     HX_BITFIELD             m_bUseSystemCPU : 1;
  721.     HX_BITFIELD             m_bUseSystemOS : 1;
  722.     HX_BITFIELD             m_bContainsSource : 1;
  723.     HX_BITFIELD             m_bContainsInitiallyScheduledTrack: 1;
  724.     HX_BITFIELD             m_bStoreErrors : 1;
  725.     HX_BITFIELD             m_bFirstPacket : 1;
  726.     HX_BITFIELD             m_bTimestampsResolved : 1;
  727.     HX_BITFIELD             m_bAllowPlaylistBehavior : 1;
  728.     HX_BITFIELD             m_bAllTracksNeedReflushHint : 1;
  729. };
  730. #if defined(HELIX_FEATURE_SMIL2_VALIDATION)
  731. inline BOOL CSmilParser::isXMLLetter(char ch) const
  732. {
  733.     BOOL bRet = FALSE;
  734.     // /Fixes some gcc compiler warnings that might actually be bugs in our
  735.     // UNIX player; need to compare unsigneds with the 0x..'s which are unsigned:
  736.     const unsigned char c = (unsigned char)ch;
  737.     if ((c >= 0x41 && c <= 0x5A) ||
  738.         (c >= 0x61 && c <= 0x7A) ||
  739.         (c >= 0xC0 && c <= 0xD6) ||
  740.         (c >= 0xD8 && c <= 0xF6) ||
  741.         (c >= 0xF8 && c <= 0xFF))
  742.     {
  743.         bRet = TRUE;
  744.     }
  745.     return bRet;
  746. }
  747. inline BOOL CSmilParser::isXMLDigit(char c) const
  748. {
  749.     return ((c >= 0x30 && c <= 0x39) ? TRUE : FALSE);
  750. }
  751. inline BOOL CSmilParser::isXMLNameChar(char ch) const
  752. {
  753.     BOOL bRet = FALSE;
  754.     // /Fixes some gcc compiler warnings that might actually be bugs in our
  755.     // UNIX player; need to compare unsigneds with the 0x..'s which are unsigned:
  756.     const unsigned char c = (unsigned char)ch;
  757.     if (isXMLLetter(c) ||
  758.         isXMLDigit(c)  ||
  759.         c == '.'       ||
  760.         c == '-'       ||
  761.         c == '_'       ||
  762.         c == ':'       ||
  763.         c == 0xB7)
  764.     {
  765.         bRet = TRUE;
  766.     }
  767.     return bRet;
  768. }
  769. #endif /* #if defined(HELIX_FEATURE_SMIL2_VALIDATION) */
  770. #endif  /* _SMLPARSE_H_ */