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_XSLT_FUNCTIONS_H
7 : #define TRANSFRMX_XSLT_FUNCTIONS_H
8 :
9 : #include "txExpr.h"
10 : #include "txXMLUtils.h"
11 : #include "nsAutoPtr.h"
12 : #include "txNamespaceMap.h"
13 :
14 : class txStylesheet;
15 :
16 : /**
17 : * The definition for the XSLT document() function
18 : **/
19 0 : class DocumentFunctionCall : public FunctionCall {
20 :
21 : public:
22 :
23 : /**
24 : * Creates a new document() function call
25 : **/
26 : explicit DocumentFunctionCall(const nsAString& aBaseURI);
27 :
28 : TX_DECL_FUNCTION
29 :
30 : private:
31 : nsString mBaseURI;
32 : };
33 :
34 : /*
35 : * The definition for the XSLT key() function
36 : */
37 0 : class txKeyFunctionCall : public FunctionCall {
38 :
39 : public:
40 :
41 : /*
42 : * Creates a new key() function call
43 : */
44 : explicit txKeyFunctionCall(txNamespaceMap* aMappings);
45 :
46 : TX_DECL_FUNCTION
47 :
48 : private:
49 : RefPtr<txNamespaceMap> mMappings;
50 : };
51 :
52 : /**
53 : * The definition for the XSLT format-number() function
54 : **/
55 0 : class txFormatNumberFunctionCall : public FunctionCall {
56 :
57 : public:
58 :
59 : /**
60 : * Creates a new format-number() function call
61 : **/
62 : txFormatNumberFunctionCall(txStylesheet* aStylesheet, txNamespaceMap* aMappings);
63 :
64 : TX_DECL_FUNCTION
65 :
66 : private:
67 : static const char16_t FORMAT_QUOTE;
68 :
69 : enum FormatParseState {
70 : Prefix,
71 : IntDigit,
72 : IntZero,
73 : FracZero,
74 : FracDigit,
75 : Suffix,
76 : Finished
77 : };
78 :
79 : txStylesheet* mStylesheet;
80 : RefPtr<txNamespaceMap> mMappings;
81 : };
82 :
83 : /**
84 : * DecimalFormat
85 : * A representation of the XSLT element <xsl:decimal-format>
86 : */
87 0 : class txDecimalFormat {
88 :
89 : public:
90 : /*
91 : * Creates a new decimal format and initilizes all properties with
92 : * default values
93 : */
94 : txDecimalFormat();
95 : bool isEqual(txDecimalFormat* other);
96 :
97 : char16_t mDecimalSeparator;
98 : char16_t mGroupingSeparator;
99 : nsString mInfinity;
100 : char16_t mMinusSign;
101 : nsString mNaN;
102 : char16_t mPercent;
103 : char16_t mPerMille;
104 : char16_t mZeroDigit;
105 : char16_t mDigit;
106 : char16_t mPatternSeparator;
107 : };
108 :
109 : /**
110 : * The definition for the XSLT current() function
111 : **/
112 0 : class CurrentFunctionCall : public FunctionCall {
113 :
114 : public:
115 :
116 : /**
117 : * Creates a new current() function call
118 : **/
119 : CurrentFunctionCall();
120 :
121 : TX_DECL_FUNCTION
122 : };
123 :
124 : /**
125 : * The definition for the XSLT generate-id() function
126 : **/
127 0 : class GenerateIdFunctionCall : public FunctionCall {
128 :
129 : public:
130 :
131 : /**
132 : * Creates a new generate-id() function call
133 : **/
134 : GenerateIdFunctionCall();
135 :
136 : TX_DECL_FUNCTION
137 : };
138 :
139 :
140 : /**
141 : * A system-property(), element-available() or function-available() function.
142 : */
143 0 : class txXSLTEnvironmentFunctionCall : public FunctionCall
144 : {
145 : public:
146 : enum eType { SYSTEM_PROPERTY, ELEMENT_AVAILABLE, FUNCTION_AVAILABLE };
147 :
148 0 : txXSLTEnvironmentFunctionCall(eType aType, txNamespaceMap* aMappings)
149 0 : : mType(aType),
150 0 : mMappings(aMappings)
151 : {
152 0 : }
153 :
154 : TX_DECL_FUNCTION
155 :
156 : private:
157 : eType mType;
158 : RefPtr<txNamespaceMap> mMappings; // Used to resolve prefixes
159 : };
160 :
161 : #endif
|