Bug 1874684 - Part 4: Prefer const references instead of copying Instant values....
[gecko.git] / dom / xslt / xslt / txStylesheetCompileHandlers.h
bloba1913110efdb2a1870662a589b86ccefaef0e136
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
9 #include "nsError.h"
10 #include "txNamespaceMap.h"
11 #include "txExpandedNameMap.h"
13 struct txStylesheetAttr;
14 class txStylesheetCompilerState;
16 using HandleStartFn = nsresult (*)(int32_t aNamespaceID, nsAtom* aLocalName,
17 nsAtom* aPrefix,
18 txStylesheetAttr* aAttributes,
19 int32_t aAttrCount,
20 txStylesheetCompilerState& aState);
21 using HandleEndFn = void (*)(txStylesheetCompilerState& aState);
22 using HandleTextFn = nsresult (*)(const nsAString& aStr,
23 txStylesheetCompilerState& aState);
25 struct txElementHandler {
26 int32_t mNamespaceID;
27 const char* mLocalName;
28 HandleStartFn mStartFunction;
29 HandleEndFn mEndFunction;
32 class txHandlerTable {
33 public:
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;
43 static bool init();
44 static void shutdown();
46 private:
47 const txElementHandler* const mOtherHandler;
48 txExpandedNameMap<const txElementHandler> mHandlers;
51 extern txHandlerTable* gTxRootHandler;
52 extern txHandlerTable* gTxEmbedHandler;
54 #endif // TRANSFRMX_TXSTYLESHEETCOMPILEHANDLERS_H