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 : * Jonas Sicking.
19 : * Portions created by the Initial Developer are Copyright (C) 2002
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : * Jonas Sicking <jonas@sicking.cc>
24 : *
25 : * Alternatively, the contents of this file may be used under the terms of
26 : * either the GNU General Public License Version 2 or later (the "GPL"), or
27 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 : * in which case the provisions of the GPL or the LGPL are applicable instead
29 : * of those above. If you wish to allow use of your version of this file only
30 : * under the terms of either the GPL or the LGPL, and not to allow others to
31 : * use your version of this file under the terms of the MPL, indicate your
32 : * decision by deleting the provisions above and replace them with the notice
33 : * and other provisions required by the GPL or the LGPL. If you do not delete
34 : * the provisions above, a recipient may use your version of this file under
35 : * the terms of any one of the MPL, the GPL or the LGPL.
36 : *
37 : * ***** END LICENSE BLOCK ***** */
38 :
39 : #ifndef TRANSFRMX_TXTOPLEVELITEMS_H
40 : #define TRANSFRMX_TXTOPLEVELITEMS_H
41 :
42 : #include "txError.h"
43 : #include "txOutputFormat.h"
44 : #include "txXMLUtils.h"
45 : #include "txStylesheet.h"
46 : #include "txInstructions.h"
47 :
48 : class txPattern;
49 : class Expr;
50 :
51 : class txToplevelItem
52 : {
53 : public:
54 0 : txToplevelItem()
55 0 : {
56 0 : MOZ_COUNT_CTOR(txToplevelItem);
57 0 : }
58 0 : virtual ~txToplevelItem()
59 0 : {
60 0 : MOZ_COUNT_DTOR(txToplevelItem);
61 0 : }
62 :
63 : enum type {
64 : attributeSet,
65 : dummy,
66 : import,
67 : //namespaceAlias,
68 : output,
69 : stripSpace, //also used for preserve-space
70 : templ,
71 : variable
72 : };
73 :
74 : virtual type getType() = 0;
75 : };
76 :
77 : #define TX_DECL_TOPLEVELITEM virtual type getType();
78 : #define TX_IMPL_GETTYPE(_class, _type) \
79 : txToplevelItem::type \
80 : _class::getType() { return _type;}
81 :
82 : class txInstructionContainer : public txToplevelItem
83 0 : {
84 : public:
85 : nsAutoPtr<txInstruction> mFirstInstruction;
86 : };
87 :
88 : // xsl:attribute-set
89 : class txAttributeSetItem : public txInstructionContainer
90 0 : {
91 : public:
92 0 : txAttributeSetItem(const txExpandedName aName) : mName(aName)
93 : {
94 0 : }
95 :
96 : TX_DECL_TOPLEVELITEM
97 :
98 : txExpandedName mName;
99 : };
100 :
101 : // xsl:import
102 : class txImportItem : public txToplevelItem
103 0 : {
104 : public:
105 : TX_DECL_TOPLEVELITEM
106 :
107 : nsAutoPtr<txStylesheet::ImportFrame> mFrame;
108 : };
109 :
110 : // xsl:output
111 : class txOutputItem : public txToplevelItem
112 0 : {
113 : public:
114 : TX_DECL_TOPLEVELITEM
115 :
116 : txOutputFormat mFormat;
117 : };
118 :
119 : // insertionpoint for xsl:include
120 : class txDummyItem : public txToplevelItem
121 0 : {
122 : public:
123 : TX_DECL_TOPLEVELITEM
124 : };
125 :
126 : // xsl:strip-space and xsl:preserve-space
127 : class txStripSpaceItem : public txToplevelItem
128 0 : {
129 : public:
130 : ~txStripSpaceItem();
131 :
132 : TX_DECL_TOPLEVELITEM
133 :
134 : nsresult addStripSpaceTest(txStripSpaceTest* aStripSpaceTest);
135 :
136 : nsTArray<txStripSpaceTest*> mStripSpaceTests;
137 : };
138 :
139 : // xsl:template
140 : class txTemplateItem : public txInstructionContainer
141 0 : {
142 : public:
143 : txTemplateItem(nsAutoPtr<txPattern> aMatch, const txExpandedName& aName,
144 : const txExpandedName& aMode, double aPrio);
145 :
146 : TX_DECL_TOPLEVELITEM
147 :
148 : nsAutoPtr<txPattern> mMatch;
149 : txExpandedName mName;
150 : txExpandedName mMode;
151 : double mPrio;
152 : };
153 :
154 : // xsl:variable at top level
155 : class txVariableItem : public txInstructionContainer
156 0 : {
157 : public:
158 : txVariableItem(const txExpandedName& aName, nsAutoPtr<Expr> aValue,
159 : bool aIsParam);
160 :
161 : TX_DECL_TOPLEVELITEM
162 :
163 : txExpandedName mName;
164 : nsAutoPtr<Expr> mValue;
165 : bool mIsParam;
166 : };
167 :
168 : #endif //TRANSFRMX_TXTOPLEVELITEMS_H
|