headers/bsd: Add sys/queue.h.
[haiku.git] / src / tests / add-ons / print / ppd / model / StatementListVisitor.cpp
blobd833eeca8081ded63fb1a5675130c67dab2d75f0
1 /*
2 * Copyright 2008, Haiku.
3 * Distributed under the terms of the MIT license.
5 * Authors:
6 * Michael Pfeiffer <laplace@users.sourceforge.net>
7 */
9 #include "StatementListVisitor.h"
11 void StatementListVisitor::Visit(StatementList* list)
13 if (list == NULL) return;
15 const int32 n = list->Size();
16 for (int32 i = 0; i < n; i ++) {
17 Statement* statement = list->StatementAt(i);
18 GroupStatement group(statement);
19 if (group.IsOpenGroup()) {
20 BeginGroup(&group);
21 fLevel ++;
22 } else if (statement->IsValueStatement()) {
23 DoValue(statement);
24 } else if (statement->IsDefaultStatement()) {
25 DoDefault(statement);
26 } else if (statement->IsQueryStatement()) {
27 DoQuery(statement);
28 } else if (statement->IsParamStatement()) {
29 DoParam(statement);
32 StatementList* children = statement->GetChildren();
33 if (children != NULL) {
34 Visit(children);
37 // Close statements have been removed
38 if (group.IsOpenGroup()) {
39 fLevel --;
40 EndGroup(&group);