Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/. */
5 :
6 : #ifndef TRANSFRMX_TXSTYLESHEETCOMPILEHANDLERS_H
7 : #define TRANSFRMX_TXSTYLESHEETCOMPILEHANDLERS_H
8 :
9 : #include "nsError.h"
10 : #include "txNamespaceMap.h"
11 : #include "txExpandedNameMap.h"
12 :
13 : struct txStylesheetAttr;
14 : class txStylesheetCompilerState;
15 :
16 : typedef nsresult (*HandleStartFn) (int32_t aNamespaceID,
17 : nsIAtom* aLocalName,
18 : nsIAtom* aPrefix,
19 : txStylesheetAttr* aAttributes,
20 : int32_t aAttrCount,
21 : txStylesheetCompilerState& aState);
22 : typedef nsresult (*HandleEndFn) (txStylesheetCompilerState& aState);
23 : typedef nsresult (*HandleTextFn) (const nsAString& aStr,
24 : txStylesheetCompilerState& aState);
25 :
26 : struct txElementHandler {
27 : int32_t mNamespaceID;
28 : const char* mLocalName;
29 : HandleStartFn mStartFunction;
30 : HandleEndFn mEndFunction;
31 : };
32 :
33 0 : class txHandlerTable
34 : {
35 : public:
36 : txHandlerTable(const HandleTextFn aTextHandler,
37 : const txElementHandler* aLREHandler,
38 : const txElementHandler* aOtherHandler);
39 : nsresult init(const txElementHandler* aHandlers, uint32_t aCount);
40 : const txElementHandler* find(int32_t aNamespaceID, nsIAtom* aLocalName);
41 :
42 : const HandleTextFn mTextHandler;
43 : const txElementHandler* const mLREHandler;
44 :
45 : static bool init();
46 : static void shutdown();
47 :
48 : private:
49 : const txElementHandler* const mOtherHandler;
50 : txExpandedNameMap<const txElementHandler> mHandlers;
51 : };
52 :
53 : extern txHandlerTable* gTxRootHandler;
54 : extern txHandlerTable* gTxEmbedHandler;
55 :
56 : #endif //TRANSFRMX_TXSTYLESHEETCOMPILEHANDLERS_H
|