vfs: check userland buffers before reading them.
[haiku.git] / src / tests / add-ons / print / ppd / model / StatementWrapper.h
blob5ff55ba0a74473c40195caed600f65086a7c1cec
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 #ifndef _STATEMENT_WRAPPER_H
10 #define _STATEMENT_WRAPPER_H
12 #include "Statement.h"
14 // wrapper classes to provide specific access to
15 // statement members
17 class StatementWrapper
19 private:
20 Statement* fStatement;
22 public:
23 StatementWrapper(Statement* statement);
25 Statement* GetStatement() { return fStatement; }
26 const char* GetKeyword() { return fStatement->GetKeyword()->String(); }
29 class GroupStatement : public StatementWrapper
31 private:
32 Value* GetValue();
34 public:
35 GroupStatement(Statement* statement);
37 // test methods if the wrapped statement is a group statement
38 bool IsUIGroup();
39 bool IsGroup();
40 bool IsSubGroup();
42 bool IsOpenGroup();
43 bool IsCloseGroup();
45 bool IsJCL();
47 // accessors
48 const char* GetGroupName();
49 const char* GetGroupTranslation();
51 enum Type {
52 kPickOne,
53 kPickMany,
54 kBoolean,
55 kUnknown
58 Type GetType();
61 class ConstraintsStatement : public StatementWrapper
63 public:
64 ConstraintsStatement(Statement* statement);
66 // is this realy a constraints statement
67 bool IsConstraints();
69 const char* GetFirstKeyword();
70 const char* GetFirstOption();
71 const char* GetSecondKeyword();
72 const char* GetSecondOption();
75 class OrderDependencyStatement : public StatementWrapper
77 public:
78 OrderDependencyStatement(Statement* statement);
80 // is this realy a order dependency statement
81 bool IsOrderDependency();
83 // is this a NonUIOrderDependencyStatement
84 bool IsNonUI();
86 float GetOrder();
87 const char* GetSection();
88 const char* GetKeyword();
89 const char* GetOption();
92 #endif