1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef TRANSFRMX_TXSTYLESHEETCOMPILEHANDLERS_H
7 #define TRANSFRMX_TXSTYLESHEETCOMPILEHANDLERS_H
10 #include "txNamespaceMap.h"
11 #include "txExpandedNameMap.h"
13 struct txStylesheetAttr
;
14 class txStylesheetCompilerState
;
16 using HandleStartFn
= nsresult (*)(int32_t aNamespaceID
, nsAtom
* aLocalName
,
18 txStylesheetAttr
* aAttributes
,
20 txStylesheetCompilerState
& aState
);
21 using HandleEndFn
= void (*)(txStylesheetCompilerState
& aState
);
22 using HandleTextFn
= nsresult (*)(const nsAString
& aStr
,
23 txStylesheetCompilerState
& aState
);
25 struct txElementHandler
{
27 const char* mLocalName
;
28 HandleStartFn mStartFunction
;
29 HandleEndFn mEndFunction
;
32 class txHandlerTable
{
34 txHandlerTable(const HandleTextFn aTextHandler
,
35 const txElementHandler
* aLREHandler
,
36 const txElementHandler
* aOtherHandler
);
37 nsresult
init(const txElementHandler
* aHandlers
, uint32_t aCount
);
38 const txElementHandler
* find(int32_t aNamespaceID
, nsAtom
* aLocalName
);
40 const HandleTextFn mTextHandler
;
41 const txElementHandler
* const mLREHandler
;
44 static void shutdown();
47 const txElementHandler
* const mOtherHandler
;
48 txExpandedNameMap
<const txElementHandler
> mHandlers
;
51 extern txHandlerTable
* gTxRootHandler
;
52 extern txHandlerTable
* gTxEmbedHandler
;
54 #endif // TRANSFRMX_TXSTYLESHEETCOMPILEHANDLERS_H