1 /* 2 * Copyright 2008, Haiku. 3 * Distributed under the terms of the MIT license. 4 * 5 * Authors: 6 * Michael Pfeiffer <laplace@users.sourceforge.net> 7 */ 8 9 #ifndef _STATEMENT_WRAPPER_H 10 #define _STATEMENT_WRAPPER_H 11 12 #include "Statement.h" 13 14 // wrapper classes to provide specific access to 15 // statement members 16 17 class StatementWrapper 18 { 19 private: 20 Statement* fStatement; 21 22 public: 23 StatementWrapper(Statement* statement); 24 GetStatement()25 Statement* GetStatement() { return fStatement; } GetKeyword()26 const char* GetKeyword() { return fStatement->GetKeyword()->String(); } 27 }; 28 29 class GroupStatement : public StatementWrapper 30 { 31 private: 32 Value* GetValue(); 33 34 public: 35 GroupStatement(Statement* statement); 36 37 // test methods if the wrapped statement is a group statement 38 bool IsUIGroup(); 39 bool IsGroup(); 40 bool IsSubGroup(); 41 42 bool IsOpenGroup(); 43 bool IsCloseGroup(); 44 45 bool IsJCL(); 46 47 // accessors 48 const char* GetGroupName(); 49 const char* GetGroupTranslation(); 50 51 enum Type { 52 kPickOne, 53 kPickMany, 54 kBoolean, 55 kUnknown 56 }; 57 58 Type GetType(); 59 }; 60 61 class ConstraintsStatement : public StatementWrapper 62 { 63 public: 64 ConstraintsStatement(Statement* statement); 65 66 // is this realy a constraints statement 67 bool IsConstraints(); 68 69 const char* GetFirstKeyword(); 70 const char* GetFirstOption(); 71 const char* GetSecondKeyword(); 72 const char* GetSecondOption(); 73 }; 74 75 class OrderDependencyStatement : public StatementWrapper 76 { 77 public: 78 OrderDependencyStatement(Statement* statement); 79 80 // is this realy a order dependency statement 81 bool IsOrderDependency(); 82 83 // is this a NonUIOrderDependencyStatement 84 bool IsNonUI(); 85 86 float GetOrder(); 87 const char* GetSection(); 88 const char* GetKeyword(); 89 const char* GetOption(); 90 }; 91 92 #endif 93