📄 smlparse.h
字号:
/* ***** BEGIN LICENSE BLOCK *****
* Version: RCSL 1.0/RPSL 1.0
*
* Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
*
* The contents of this file, and the files included with this file, are
* subject to the current version of the RealNetworks Public Source License
* Version 1.0 (the "RPSL") available at
* http://www.helixcommunity.org/content/rpsl unless you have licensed
* the file under the RealNetworks Community Source License Version 1.0
* (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
* in which case the RCSL will apply. You may also obtain the license terms
* directly from RealNetworks. You may not use this file except in
* compliance with the RPSL or, if you have a valid RCSL with RealNetworks
* applicable to this file, the RCSL. Please see the applicable RPSL or
* RCSL for the rights, obligations and limitations governing use of the
* contents of the file.
*
* This file is part of the Helix DNA Technology. RealNetworks is the
* developer of the Original Code and owns the copyrights in the portions
* it created.
*
* This file, and the files included with this file, is distributed and made
* available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
*
* Technology Compatibility Kit Test Suite(s) Location:
* http://www.helixcommunity.org/content/tck
*
* Contributor(s):
*
* ***** END LICENSE BLOCK ***** */
#ifndef _SMLPARSE_H_
#define _SMLPARSE_H_
#define MAX_PENDING_CHECK_CALLDEPTH 20
/* <body dur="20s">[no sources]</body> is valid; we need to handle it: */
#define DEFAULT_DUR_IF_NO_SOURCES_SCHEDULED SMILTIME_INVALID
// forward declarations
typedef _INTERFACE IHXSystemRequired IHXSystemRequired;
typedef _INTERFACE IHXBuffer IHXBuffer;
typedef _INTERFACE IHXValues IHXValues;
typedef _INTERFACE IHXXMLParserResponse IHXXMLParserResponse;
typedef _INTERFACE IHXCommonClassFactory IHXCommonClassFactory;
typedef _INTERFACE IHXXMLParser IHXXMLParser;
typedef void* LISTPOSITION;
class CHXString;
class SMILNodeList;
class CSmilElement;
class CHXSimpleList;
class ErrorNotifier;
class CSmilParser;
class CSmilElementHandler;
class SmilTimeValue;
class CHXPtrArray;
class CSmilAnchorElement;
class CHXStack;
class CSmilRegion;
class CSmilRegPoint;
#if defined(HELIX_FEATURE_SMIL2_MULTIWINDOWLAYOUT)
class CSmilViewport;
#endif /* #if defined(HELIX_FEATURE_SMIL2_MULTIWINDOWLAYOUT) */
class CSmilTransition;
class CSmilRootLayout;
class CSmilMeta;
class CSmilMetadata;
class CSmilRendererPreFetch;
class CSmilSource;
class CSmilPriorityClassElement;
class CSmilAAnchorElement;
class CSmilSeqElement;
class CSmilParElement;
class CSmilExclElement;
class CSmilAnimateElement;
class CSmilParamElement;
class CSmilCustomTest;
class XMLError;
class CHXMapLongToObj;
class CHXMapStringToOb;
#if defined(HELIX_FEATURE_SMIL2_VALIDATION)
class CRNBinaryMap;
#endif /* #if defined(HELIX_FEATURE_SMIL2_VALIDATION) */
class CNamespaceInfo;
class CSmilBodyElement;
class CSmilTimelineElementManager;
/* // /XXXEH- we can't do the following until the core starts notifying
// us every time a repeated track begins:
//#define XXXEH_REPEAT_VALUE_TIMING_SHOULD_BE_EVENT_BASED
*/
#define NUM_SUPPORTED_SMIL_2_0_MODULE_NAMESPACES 55
class SMILNamespace
{
public:
SMILNamespace(SMILNamespace* pNS);
SMILNamespace(const char* name, IHXBuffer* pVal);
virtual ~SMILNamespace();
char* m_name;
IHXBuffer* m_pValue;
};
class SMILNode
{
public:
SMILNode();
virtual ~SMILNode();
#if defined(XXXEH_REPEAT_VALUE_TIMING_SHOULD_BE_EVENT_BASED)
SMILNode(const SMILNode&, BOOL bKeepId=FALSE, CSmilParser* pParser = NULL);
#else
SMILNode(const SMILNode&, BOOL bKeepId=FALSE, CSmilParser* pParser = NULL,
UINT32 ulRepeatNum=0);
#endif
SMILNode* getFirstChild();
SMILNode* getNextChild();
CHXString m_repeatid;
CHXString m_id;
CHXString m_name;
UINT32 m_num;
SMILNodeTag m_tag;
SMILNode* m_pParent;
SMILNode* m_pDependency;
SMILNodeList* m_pNodeList;
IHXValues* m_pValues;
CSmilElement* m_pElement;
UINT16 m_nGroup;
RepeatTag m_repeatTag;
CHXString m_trackHint;
UINT32 m_ulTagStartLine;
UINT32 m_ulTagStartColumn;
UINT16 m_nPrefetchTrackNum;
double m_fPartialPlayFactor;
UINT32 m_ulRepeatDur;
CHXSimpleList* m_pNamespaceList;
SMIL2Element m_eElement;
// ONLY HX_BITFIELD MEMBERS SHOULD GO BELOW THIS LINE!
// ALL OTHER MEMBER TYPES SHOULD GO ABOVE THIS LINE!
HX_BITFIELD m_bLastInGroup : 1;
HX_BITFIELD m_bDelete : 1;
HX_BITFIELD m_bSkipContent : 1;
HX_BITFIELD m_bRepeatHandled : 1;
HX_BITFIELD m_bIsSeqWrapperForRepeatElement : 1;
HX_BITFIELD m_bIsOuterWrapperTimeContainer : 1;
HX_BITFIELD m_bBeginHandledByWrapperParent : 1;
HX_BITFIELD m_bEndHandledByWrapperParent : 1;
HX_BITFIELD m_bMinHandledByWrapperParent : 1;
HX_BITFIELD m_bMaxHandledByWrapperParent : 1;
HX_BITFIELD m_bNeedToResolveRepeatDurVSRepeatCount : 1;
HX_BITFIELD m_bCloseNode : 1;
HX_BITFIELD m_bNamespacedElement : 1;
private:
LISTPOSITION m_curPosition;
};
class SMILNodeList: public CHXSimpleList
{
public:
SMILNodeList();
virtual ~SMILNodeList();
SMILNodeList* copy(SMILNode* pParent, BOOL bKeepId = FALSE, CSmilParser* pParser = NULL);
SMILNode* m_pParentNode;
};
class CNamespaceInfo
{
public:
CNamespaceInfo();
~CNamespaceInfo();
char* m_pszPrefix;
char* m_pszURL;
SupportedNamespace m_eNamespace;
// ONLY HX_BITFIELD MEMBERS SHOULD GO BELOW THIS LINE!
// ALL OTHER MEMBER TYPES SHOULD GO ABOVE THIS LINE!
HX_BITFIELD m_bImplemented : 1;
};
class CSmilParserResponse : public IHXXMLParserResponse,
public ErrorNotifier
{
public:
CSmilParserResponse(CSmilParser* pParser);
virtual ~CSmilParserResponse();
// IUnknown methods
STDMETHOD(QueryInterface) (THIS_ REFIID riid, void** ppvObj);
STDMETHOD_(ULONG32, AddRef) (THIS);
STDMETHOD_(ULONG32, Release) (THIS);
// IHXXMLParserResponse methods
STDMETHOD(HandleStartElement) (THIS_ const char* pName,
IHXValues* pAttributes,
UINT32 ulLineNumber,
UINT32 ulColumNumber);
STDMETHOD(HandleEndElement) (THIS_ const char* pName,
UINT32 ulLineNumber,
UINT32 ulColumNumber);
STDMETHOD(HandleCharacterData) (THIS_ IHXBuffer* pBuffer,
UINT32 ulLineNumber,
UINT32 ulColumNumber);
STDMETHOD(HandleProcessingInstruction) (THIS_ const char* pTarget,
IHXValues* pAttributes,
UINT32 ulLineNumber,
UINT32 ulColumNumber);
STDMETHOD(HandleUnparsedEntityDecl) (THIS_ const char* pEntityName,
const char* pSystemID,
const char* pPublicID,
const char* pNotationName,
UINT32 ulLineNumber,
UINT32 ulColumNumber);
STDMETHOD(HandleNotationDecl) (THIS_ const char* pNotationName,
const char* pSystemID,
const char* pPublicID,
UINT32 ulLineNumber,
UINT32 ulColumNumber);
STDMETHOD(HandleComment) (THIS_ const char* pComment,
UINT32 ulLineNumber,
UINT32 ulColumNumber);
STDMETHOD(HandleUnparsedDoctypeDecl) (THIS_ const char* pName,
const char* pSystemID,
const char* pPublicID,
UINT32 ulLineNumber,
UINT32 ulColumNumber);
STDMETHOD(HandleDefault) (THIS_ IHXBuffer* pBuffer,
UINT32 ulLineNumber,
UINT32 ulColumNumber);
// ErrorNotifer methods
HX_RESULT ErrorInLastTag(HX_RESULT Error,
const char* pErrorString,
const char* pFrameString,
UINT32 ulLineNumber,
UINT32 ulLinePosition);
private:
CSmilParser* m_pParser;
INT32 m_lRefCount;
SMILNode* m_pCurrentNode;
};
struct ExternalEventInfo
{
CHXString m_EventBaseID;
CHXString m_PrefixedEventName;
CHXString m_EventName;
CNamespaceInfo* m_pInfo;
};
class CSmilParser
{
public:
CSmilParser(IUnknown* pContext);
virtual ~CSmilParser();
HX_RESULT init(BOOL bStoreErrors = FALSE);
HX_RESULT parse(IHXBuffer* pBuffer, BOOL bIsFinal);
HX_RESULT parse(const char* pSmilText);
#if defined(HELIX_FEATURE_SMIL2_VALIDATION)
HX_RESULT validateContentModel(UINT32 ulElement, SMILNodeList* pChildren);
HX_RESULT validateNode(SMILNode* pNode);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -