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"
11 #include "txXMLUtils.h"
12 #include "txNamespaceMap.h"
17 * The definition for the XSLT document() function
19 class DocumentFunctionCall
: public FunctionCall
{
22 * Creates a new document() function call
24 explicit DocumentFunctionCall(const nsAString
& aBaseURI
);
33 * The definition for the XSLT key() function
35 class txKeyFunctionCall
: public FunctionCall
{
38 * Creates a new key() function call
40 explicit txKeyFunctionCall(txNamespaceMap
* aMappings
);
45 RefPtr
<txNamespaceMap
> mMappings
;
49 * The definition for the XSLT format-number() function
51 class txFormatNumberFunctionCall
: public FunctionCall
{
54 * Creates a new format-number() function call
56 txFormatNumberFunctionCall(txStylesheet
* aStylesheet
,
57 txNamespaceMap
* aMappings
);
62 static const char16_t FORMAT_QUOTE
;
64 enum FormatParseState
{
74 // Helper that reports and invalid arg to the provided context.
75 void ReportInvalidArg(txIEvalContext
* aContext
);
77 txStylesheet
* mStylesheet
;
78 RefPtr
<txNamespaceMap
> mMappings
;
83 * A representation of the XSLT element <xsl:decimal-format>
85 class txDecimalFormat
{
88 * Creates a new decimal format and initilizes all properties with
92 bool isEqual(txDecimalFormat
* other
);
94 char16_t mDecimalSeparator
;
95 char16_t mGroupingSeparator
;
103 char16_t mPatternSeparator
;
107 * The definition for the XSLT current() function
109 class CurrentFunctionCall
: public FunctionCall
{
112 * Creates a new current() function call
114 CurrentFunctionCall();
120 * The definition for the XSLT generate-id() function
122 class GenerateIdFunctionCall
: public FunctionCall
{
125 * Creates a new generate-id() function call
127 GenerateIdFunctionCall();
133 * A system-property(), element-available() or function-available() function.
135 class txXSLTEnvironmentFunctionCall
: public FunctionCall
{
137 enum eType
{ SYSTEM_PROPERTY
, ELEMENT_AVAILABLE
, FUNCTION_AVAILABLE
};
139 txXSLTEnvironmentFunctionCall(eType aType
, txNamespaceMap
* aMappings
)
140 : mType(aType
), mMappings(aMappings
) {}
146 RefPtr
<txNamespaceMap
> mMappings
; // Used to resolve prefixes