KVIrc  4.9.2
DeveloperAPIs
KviKvsTreeNode.h
Go to the documentation of this file.
1 #ifndef _KVI_KVS_TREENODE_H_
2 #define _KVI_KVS_TREENODE_H_
3 //=============================================================================
4 //
5 // File : KviKvsTreeNode.h
6 // Creation date : Thu 25 Sep 2003 05.12 CEST by Szymon Stefanek
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 2003-2010 Szymon Stefanek (pragma at kvirc dot net)
10 //
11 // This program is FREE software. You can redistribute it and/or
12 // modify it under the terms of the GNU General Public License
13 // as published by the Free Software Foundation; either version 2
14 // of the License, or (at your option) any later version.
15 //
16 // This program is distributed in the HOPE that it will be USEFUL,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 // See the GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, write to the Free Software Foundation,
23 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 //
25 //=============================================================================
26 
27 #include "KviKvsTreeNodeBase.h"
28 
37 #include "KviKvsTreeNodeCommand.h"
45 #include "KviKvsTreeNodeData.h"
46 #include "KviKvsTreeNodeDataList.h"
87 #include "KviKvsTreeNodeVariable.h"
89 
90 //
91 // Hierarchy (the nodes that have some missing implementation have the leading '?' char)
92 //
93 //
94 // TreeNode(OK) (never instantiated)
95 // |
96 // +--Instruction(OK) (never instantiated) (used as interface by InstructionBlock) : instruction has bool execute() = 0;
97 // | |
98 // | +--InstructionBlock(OK)
99 // | |
100 // | +--ExpressionReturn(OK)
101 // | |
102 // | +--ParameterReturn(OK)
103 // | |
104 // | |--Command(OK) (never instantiated)
105 // | | |
106 // | | +--RebindingSwitch(OK)
107 // | | |
108 // | | +--CommandWithParameters(OK) (never instantiated)
109 // | | | |
110 // | | | +--SimpleCommand(OK) (never instantiated)
111 // | | | | |
112 // | | | | +--CoreSimpleCommand(OK)
113 // | | | | |
114 // | | | | +--ModuleSimpleCommand(OK)
115 // | | | | |
116 // | | | | +--AliasSimpleCommand(OK)
117 // | | | |
118 // | | | +--CallbackCommand(OK) (never instantiated)
119 // | | | |
120 // | | | +--CoreCallbackCommand(OK)
121 // | | | |
122 // | | | +--ModuleCallbackCommand(OK)
123 // | | |
124 // | | +--SpecialCommand(OK) (never instantiated)
125 // | | |
126 // | | +--SpecialCommandIf(OK)
127 // | | |
128 // | | +--SpecialCommandWhile(OK)
129 // | | |
130 // | | +--SpecialCommandDo(OK)
131 // | | |
132 // | | +--SpecialCommandForeach(OK)
133 // | | |
134 // | | +--SpecialCommandFor(OK)
135 // | | |
136 // | | +--SpecialCommandBreak(OK)
137 // | | |
138 // | | +--SpecialCommandContinue(OK)
139 // | | |
140 // | | +--SpecialCommandSwitch(OK)
141 // | | |
142 // | | +--SpecialCommandDefpopup(OK)
143 // | | |
144 // | | +--SpecialCommandClass(OK)
145 // | |
146 // | +--VoidFunctionCall(OK)
147 // | |
148 // | +--Operation(OK) : has a m_pTargetData pointer (never instantiated)
149 // | |
150 // | +--OperationAssignment(OK)
151 // | |
152 // | +--OperationIncrement(OK)
153 // | |
154 // | +--OperationDecrement(OK)
155 // | |
156 // | +--OperationSelfSum(OK)
157 // | |
158 // | +--OperationSelfSubtraction(OK)
159 // | |
160 // | +--OperationSelfDivision(OK)
161 // | |
162 // | +--OperationSelfMultiplication(OK)
163 // | |
164 // | +--OperationSelfModulus(OK)
165 // | |
166 // | +--OperationSelfOr(OK)
167 // | |
168 // | +--OperationSelfAnd(OK)
169 // | |
170 // | +--OperationSelfXor(OK)
171 // | |
172 // | +--OperationSelfShl(OK)
173 // | |
174 // | +--OperationSelfShr(OK)
175 // | |
176 // | +--OperationStringAppend(OK)
177 // | |
178 // | +--OperationStringAppendWithComma(OK)
179 // | |
180 // | +--OperationStringAppendWithSpace(OK)
181 // | |
182 // | +--OperationStringTransliteration(OK)
183 // | |
184 // | +--OperationStringSubstitution(OK)
185 // |
186 // +--Data(OK) data has
187 // | | bool evaluateReadOnly(KviKvsRunTimeContext * c,KviKvsVariant * pBuffer) <-- this MUST be implemented
188 // | | KviKvsVariant * evaluateReadWrite(KviKvsRunTimeContext * c) <-- this MUST be implemented if isReadOnly returns false
189 // | |
190 // | | This class is NEVER instantiated directly
191 // | |
192 // | | isReadOnly(); true by default
193 // | | canEvaluateToObjectReference(); false by default
194 // | | isFunctionCall(); false by default
195 // | | canEvaluateInObjectScope(); false by default
196 // | | (DEAD)canReleaseResult(); false by default (can the result be simply "taken" ?)
197 // | |
198 // | +--StringCast(OK) has some kind of data inside that is converted to string "on the fly"
199 // | |
200 // | +--ConstantData(OK) have real constant data
201 // | | everything inherited from data
202 // | | only evaluateReadOnly is implemented and it never fails
203 // | |
204 // | +--CompositeData(OK) have real data composed of constants, it is an implicit StringCast too (it isn't inherited from StringCast since it operates in a different way)
205 // | | everything inherited from data
206 // | | only evaluateReadOnly is implemented and it never fails
207 // | |
208 // | +--ScopeOperator( ) Has a left side that must evaluate to ob reference
209 // | | Has a right side that must be a variable reference or function call
210 // | | isReadOnly() depends on the right child
211 // | | canEvaluateToObjectReference() depends on last child
212 // | | isFunctionCall() depends on last child
213 // | | canEvaluateInObjectScope() depends on last child
214 // | | (DEAD)canReleaseResult() depends on last child
215 // | |
216 // | +--SingleParameterIdentifier(OK) this is $n
217 // | | canEvaluateToObjectReference() = true
218 // | |
219 // | +--MultipleParameterIdentifier(OK) this is $n-[n]
220 // | |
221 // | +--CommandEvaluation(OK) this is ${ ... }
222 // | | canEvaluateToObjectReference() = true
223 // | |
224 // | +--Variable(OK) this is something related to %xxx (never instantiated)
225 // | | | canEvaluateInObjectScope() = true
226 // | | | isReadOnly() = false
227 // | | | canEvaluateToObjectReference() = true
228 // | | |
229 // | | +--LocalVariable(OK)
230 // | | |
231 // | | +--GlobalVariable(OK)
232 // | | |
233 // | | +--ExtendedScopeVariable(OK)
234 // | | |
235 // | | +--ObjectField(OK)
236 // | |
237 // | +--IndirectData(OK) takes a Data as source (never instantiated)
238 // | | | canEvaluateInObjectScope() depends on the parameter data
239 // | | |
240 // | | +--ArrayOrHashElement(OK) isReadOnly() depends on the source data (never instantiated)
241 // | | | | canEvaluateToObjectReference() = true
242 // | | | |
243 // | | | +--ArrayElement(OK) the source Data must evaluate to an array or be writable in order to convert it
244 // | | | | and an index that must evaluate to an integer (evaluate ok, result inherited ok)
245 // | | | |
246 // | | | +--HashElement(OK) the source Data must evaluate to a hash or be writable in order to convert it
247 // | | | and an index that must evaluate to a non-empty hash key (evaluate ok, result inherited ok)
248 // | | |
249 // | | +--HashCount(OK) the source Data must evaluate to a hash or be writable in order to convert it
250 // | | |
251 // | | +--ArrayCount(OK) the source Data must evaluate to an array or be writable in order to convert it
252 // | | |
253 // | | +--HashReferenceAssert(OK) the source Data must evaluate to a hash or be writable in order to convert it (otherwise asserts)
254 // | | | isReadOnly() depends on the parameter data
255 // | | |
256 // | | +--ArrayReferenceAssert(OK) the source Data must evaluate to an array or be writable in order to convert it (otherwise asserts)
257 // | | isReadOnly() depends on the parameter data
258 // | |
259 // | +--Expression(OK) (never instantiated)
260 // | | |
261 // | | +--ExpressionVariableOperand(OK) (evaluate and result ok)
262 // | | |
263 // | | +--ExpressionConstantOperand(OK) (evaluate and result ok)
264 // | | |
265 // | | +--ExpressionOperator(OK) (never instantiated)
266 // | | |
267 // | | +--ExpressionBinaryOperator(OK) (never instantiated)
268 // | | | |
269 // | | | +--ExpressionBinaryOperatorSum(OK) (evaluate and result ok)
270 // | | | |
271 // | | | +--ExpressionBinaryOperatorSubtraction(OK) (evaluate and result ok)
272 // | | | |
273 // | | | +--ExpressionBinaryOperatorMultiplication(OK) (evaluate and result ok)
274 // | | | |
275 // | | | +--ExpressionBinaryOperatorDivision(OK) (evaluate and result ok)
276 // | | | |
277 // | | | +--ExpressionBinaryOperatorBitwiseAnd(OK) (evaluate and result ok)
278 // | | | |
279 // | | | +--ExpressionBinaryOperatorBitwiseOr(OK) (evaluate and result ok)
280 // | | | |
281 // | | | +--ExpressionBinaryOperatorBitwiseXor(OK) (evaluate and result ok)
282 // | | | |
283 // | | | +--ExpressionBinaryOperatorShiftLeft(OK) (evaluate and result ok)
284 // | | | |
285 // | | | +--ExpressionBinaryOperatorShiftRight(OK) (evaluate and result ok)
286 // | | | |
287 // | | | +--ExpressionBinaryOperatorAnd(OK) (evaluate and result ok)
288 // | | | |
289 // | | | +--ExpressionBinaryOperatorOr(OK) (evaluate and result ok)
290 // | | | |
291 // | | | +--ExpressionBinaryOperatorXor(OK) (evaluate and result ok)
292 // | | | |
293 // | | | +--ExpressionBinaryOperatorLowerThan(OK) (evaluate and result ok)
294 // | | | |
295 // | | | +--ExpressionBinaryOperatorGreaterThan(OK) (evaluate and result ok)
296 // | | | |
297 // | | | +--ExpressionBinaryOperatorLowerOrEqualTo(OK) (evaluate and result ok)
298 // | | | |
299 // | | | +--ExpressionBinaryOperatorGreaterOrEqualTo(OK) (evaluate and result ok)
300 // | | | |
301 // | | | +--ExpressionBinaryOperatorEqualTo(OK) (evaluate and result ok)
302 // | | | |
303 // | | | +--ExpressionBinaryOperatorNotEqualTo(OK) (evaluate and result ok)
304 // | | |
305 // | | +--ExpressionUnaryOperator(OK) (never instantiated)
306 // | | |
307 // | | +--ExpressionUnaryOperatorNegate(OK) (evaluate and result ok)
308 // | | |
309 // | | +--ExpressionUnaryOperatorBitwiseNot(OK) (evaluate and result ok)
310 // | | |
311 // | | +--ExpressionUnaryOperatorLogicalNot(OK) (evaluate and result ok)
312 // | |
313 // | +--FunctionCall(OK) this is something like $xxx and has a name. Can be called as a void instruction
314 // | | canEvaluateToObjectReference() = true
315 // | | isFunctionCall() = true
316 // | |
317 // | +--ModuleFunctionCall(OK)
318 // | |
319 // | +--AliasFunctionCall(OK)
320 // | |
321 // | +--CoreFunctionCall(OK)
322 // | |
323 // | +--ObjectFunctionCall( ) this is the only function call type appended to a scope operator
324 // | | canEvaluateInObjectScope() = true (never instantiated)
325 // | |
326 // | +--ThisObjectFunctionCall( )
327 // | |
328 // | +--BaseObjectFunctionCall( )
329 // |
330 // +--DataList(OK)
331 // |
332 // +--SwitchList(OK)
333 // |
334 // +--SpecialCommandSwitchLabel(Never instantiated)
335 // | |
336 // | +--SpecialCommandSwitchLabelCase(OK)
337 // | |
338 // | +--SpecialCommandSwitchLabelMatch(OK)
339 // | |
340 // | +--SpecialCommandSwitchLabelRegexp(OK)
341 // | |
342 // | +--SpecialCommandSwitchLabelDefault(OK)
343 // |
344 // +--SpecialCommandDefpopupLabel(Never instantiated)
345 // |
346 // +--SpecialCommandDefpopupLabelPrologue(OK)
347 // |
348 // +--SpecialCommandDefpopupLabelEpilogue(OK)
349 // |
350 // +--SpecialCommandDefpopupConditionalLabel(Never instantiated)
351 // |
352 // +--SpecialCommandDefpopupLabelSeparator(OK)
353 // |
354 // +--SpecialCommandDefpopupConditionalLabelWithTextAndIcon (Never instantiated)
355 // |
356 // +--SpecialCommandDefpopupLabelPopup(OK)
357 // |
358 // +--SpecialCommandDefpopupLabelExtpopup(OK)
359 // |
360 // +--SpecialCommandDefpopupLabelItem(OK)
361 // |
362 // +--SpecialCommandDefpopupLabelLabel(OK)
363 //
364 //
365 //
366 
367 //
368 // Tree morphology
369 //
370 // InstructionBlock
371 // [Instruction]
372 //
373 // ScopeOperator
374 // [Data]->[Data]
375 //
376 
377 #endif
Treenode handling.
Treenode alias simple command call handling.
Treenode array count handling.
Treenode array element handling.
Treenode alias function call handling.
Treenode array reference assert handling.