Bug 1874684 - Part 4: Prefer const references instead of copying Instant values....
[gecko.git] / dom / xslt / xslt / txXSLTFunctions.h
blob4b7401eb8369467418b0aa10801d36b0237797dd
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_XSLT_FUNCTIONS_H
7 #define TRANSFRMX_XSLT_FUNCTIONS_H
9 #include "mozilla/UniquePtr.h"
10 #include "txExpr.h"
11 #include "txXMLUtils.h"
12 #include "txNamespaceMap.h"
14 class txStylesheet;
16 /**
17 * The definition for the XSLT document() function
18 **/
19 class DocumentFunctionCall : public FunctionCall {
20 public:
21 /**
22 * Creates a new document() function call
23 **/
24 explicit DocumentFunctionCall(const nsAString& aBaseURI);
26 TX_DECL_FUNCTION
28 private:
29 nsString mBaseURI;
33 * The definition for the XSLT key() function
35 class txKeyFunctionCall : public FunctionCall {
36 public:
38 * Creates a new key() function call
40 explicit txKeyFunctionCall(txNamespaceMap* aMappings);
42 TX_DECL_FUNCTION
44 private:
45 RefPtr<txNamespaceMap> mMappings;
48 /**
49 * The definition for the XSLT format-number() function
50 **/
51 class txFormatNumberFunctionCall : public FunctionCall {
52 public:
53 /**
54 * Creates a new format-number() function call
55 **/
56 txFormatNumberFunctionCall(txStylesheet* aStylesheet,
57 txNamespaceMap* aMappings);
59 TX_DECL_FUNCTION
61 private:
62 static const char16_t FORMAT_QUOTE;
64 enum FormatParseState {
65 Prefix,
66 IntDigit,
67 IntZero,
68 FracZero,
69 FracDigit,
70 Suffix,
71 Finished
74 // Helper that reports and invalid arg to the provided context.
75 void ReportInvalidArg(txIEvalContext* aContext);
77 txStylesheet* mStylesheet;
78 RefPtr<txNamespaceMap> mMappings;
81 /**
82 * DecimalFormat
83 * A representation of the XSLT element <xsl:decimal-format>
85 class txDecimalFormat {
86 public:
88 * Creates a new decimal format and initilizes all properties with
89 * default values
91 txDecimalFormat();
92 bool isEqual(txDecimalFormat* other);
94 char16_t mDecimalSeparator;
95 char16_t mGroupingSeparator;
96 nsString mInfinity;
97 char16_t mMinusSign;
98 nsString mNaN;
99 char16_t mPercent;
100 char16_t mPerMille;
101 char16_t mZeroDigit;
102 char16_t mDigit;
103 char16_t mPatternSeparator;
107 * The definition for the XSLT current() function
109 class CurrentFunctionCall : public FunctionCall {
110 public:
112 * Creates a new current() function call
114 CurrentFunctionCall();
116 TX_DECL_FUNCTION
120 * The definition for the XSLT generate-id() function
122 class GenerateIdFunctionCall : public FunctionCall {
123 public:
125 * Creates a new generate-id() function call
127 GenerateIdFunctionCall();
129 TX_DECL_FUNCTION
133 * A system-property(), element-available() or function-available() function.
135 class txXSLTEnvironmentFunctionCall : public FunctionCall {
136 public:
137 enum eType { SYSTEM_PROPERTY, ELEMENT_AVAILABLE, FUNCTION_AVAILABLE };
139 txXSLTEnvironmentFunctionCall(eType aType, txNamespaceMap* aMappings)
140 : mType(aType), mMappings(aMappings) {}
142 TX_DECL_FUNCTION
144 private:
145 eType mType;
146 RefPtr<txNamespaceMap> mMappings; // Used to resolve prefixes
149 #endif