1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is TransforMiiX XSLT processor code.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * Keith Visco.
19 : * Portions created by the Initial Developer are Copyright (C) 1999
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : *
24 : * Alternatively, the contents of this file may be used under the terms of
25 : * either the GNU General Public License Version 2 or later (the "GPL"), or
26 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 : * in which case the provisions of the GPL or the LGPL are applicable instead
28 : * of those above. If you wish to allow use of your version of this file only
29 : * under the terms of either the GPL or the LGPL, and not to allow others to
30 : * use your version of this file under the terms of the MPL, indicate your
31 : * decision by deleting the provisions above and replace them with the notice
32 : * and other provisions required by the GPL or the LGPL. If you do not delete
33 : * the provisions above, a recipient may use your version of this file under
34 : * the terms of any one of the MPL, the GPL or the LGPL.
35 : *
36 : * ***** END LICENSE BLOCK ***** */
37 :
38 : #ifndef TRANSFRMX_XSLT_FUNCTIONS_H
39 : #define TRANSFRMX_XSLT_FUNCTIONS_H
40 :
41 : #include "txExpr.h"
42 : #include "txXMLUtils.h"
43 : #include "nsAutoPtr.h"
44 : #include "txNamespaceMap.h"
45 :
46 : class txPattern;
47 : class txStylesheet;
48 : class txKeyValueHashKey;
49 : class txExecutionState;
50 :
51 : /**
52 : * The definition for the XSLT document() function
53 : **/
54 0 : class DocumentFunctionCall : public FunctionCall {
55 :
56 : public:
57 :
58 : /**
59 : * Creates a new document() function call
60 : **/
61 : DocumentFunctionCall(const nsAString& aBaseURI);
62 :
63 : TX_DECL_FUNCTION
64 :
65 : private:
66 : nsString mBaseURI;
67 : };
68 :
69 : /*
70 : * The definition for the XSLT key() function
71 : */
72 0 : class txKeyFunctionCall : public FunctionCall {
73 :
74 : public:
75 :
76 : /*
77 : * Creates a new key() function call
78 : */
79 : txKeyFunctionCall(txNamespaceMap* aMappings);
80 :
81 : TX_DECL_FUNCTION
82 :
83 : private:
84 : nsRefPtr<txNamespaceMap> mMappings;
85 : };
86 :
87 : /**
88 : * The definition for the XSLT format-number() function
89 : **/
90 0 : class txFormatNumberFunctionCall : public FunctionCall {
91 :
92 : public:
93 :
94 : /**
95 : * Creates a new format-number() function call
96 : **/
97 : txFormatNumberFunctionCall(txStylesheet* aStylesheet, txNamespaceMap* aMappings);
98 :
99 : TX_DECL_FUNCTION
100 :
101 : private:
102 : static const PRUnichar FORMAT_QUOTE;
103 :
104 : enum FormatParseState {
105 : Prefix,
106 : IntDigit,
107 : IntZero,
108 : FracZero,
109 : FracDigit,
110 : Suffix,
111 : Finished
112 : };
113 :
114 : txStylesheet* mStylesheet;
115 : nsRefPtr<txNamespaceMap> mMappings;
116 : };
117 :
118 : /**
119 : * DecimalFormat
120 : * A representation of the XSLT element <xsl:decimal-format>
121 : */
122 0 : class txDecimalFormat {
123 :
124 : public:
125 : /*
126 : * Creates a new decimal format and initilizes all properties with
127 : * default values
128 : */
129 : txDecimalFormat();
130 : bool isEqual(txDecimalFormat* other);
131 :
132 : PRUnichar mDecimalSeparator;
133 : PRUnichar mGroupingSeparator;
134 : nsString mInfinity;
135 : PRUnichar mMinusSign;
136 : nsString mNaN;
137 : PRUnichar mPercent;
138 : PRUnichar mPerMille;
139 : PRUnichar mZeroDigit;
140 : PRUnichar mDigit;
141 : PRUnichar mPatternSeparator;
142 : };
143 :
144 : /**
145 : * The definition for the XSLT current() function
146 : **/
147 0 : class CurrentFunctionCall : public FunctionCall {
148 :
149 : public:
150 :
151 : /**
152 : * Creates a new current() function call
153 : **/
154 : CurrentFunctionCall();
155 :
156 : TX_DECL_FUNCTION
157 : };
158 :
159 : /**
160 : * The definition for the XSLT generate-id() function
161 : **/
162 0 : class GenerateIdFunctionCall : public FunctionCall {
163 :
164 : public:
165 :
166 : /**
167 : * Creates a new generate-id() function call
168 : **/
169 : GenerateIdFunctionCall();
170 :
171 : TX_DECL_FUNCTION
172 : };
173 :
174 :
175 : /**
176 : * A system-property(), element-available() or function-available() function.
177 : */
178 : class txXSLTEnvironmentFunctionCall : public FunctionCall
179 0 : {
180 : public:
181 : enum eType { SYSTEM_PROPERTY, ELEMENT_AVAILABLE, FUNCTION_AVAILABLE };
182 :
183 0 : txXSLTEnvironmentFunctionCall(eType aType, txNamespaceMap* aMappings)
184 : : mType(aType),
185 0 : mMappings(aMappings)
186 : {
187 0 : }
188 :
189 : TX_DECL_FUNCTION
190 :
191 : private:
192 : eType mType;
193 : nsRefPtr<txNamespaceMap> mMappings; // Used to resolve prefixes
194 : };
195 :
196 : #endif
|