Changeset 2111 for code/branches/objecthierarchy/src/util/ExprParser.h
- Timestamp:
- Nov 2, 2008, 12:38:26 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/util/ExprParser.h
r1894 r2111 38 38 #include <string> 39 39 40 class _UtilExport ExprParser 40 namespace orxonox 41 41 { 42 public: 43 enum binary_operator 42 class _UtilExport ExprParser 44 43 { 45 b_plus, 46 b_minus, 47 mal, 48 durch, 49 modulo, 50 hoch, 51 undef, 52 oder, 53 und, 54 gleich, 55 b_nicht, 56 kleiner, 57 groesser, 58 ungleich, 59 kleinergleich, 60 groessergleich 44 public: 45 enum binary_operator 46 { 47 b_plus, 48 b_minus, 49 mal, 50 durch, 51 modulo, 52 hoch, 53 undef, 54 oder, 55 und, 56 gleich, 57 b_nicht, 58 kleiner, 59 groesser, 60 ungleich, 61 kleinergleich, 62 groessergleich 63 }; 64 65 enum unary_operator 66 { 67 u_plus, 68 u_minus, 69 u_nicht 70 }; 71 72 73 ExprParser(const std::string& str); 74 std::string& getRemains() { return this->remains_; } 75 double getResult() { return this->result_; } 76 bool getSuccess() { return !this->failed_; } 77 78 private: 79 double parse_expr_1(); 80 double parse_expr_2(); 81 double parse_expr_3(); 82 double parse_expr_4(); 83 double parse_expr_5(); 84 double parse_expr_6(); 85 double parse_expr_7(); 86 double parse_expr_8(); 87 char* parse_word(char* str); 88 binary_operator parse_binary_operator(); 89 unary_operator parse_unary_operator(); 90 91 double parse_argument(); 92 double parse_last_argument(); 93 94 binary_operator op; 95 const char* reading_stream; 96 bool failed_; 97 double result_; 98 std::string remains_; 99 61 100 }; 62 101 63 enum unary_operator 64 { 65 u_plus, 66 u_minus, 67 u_nicht 68 }; 69 70 71 ExprParser(const std::string& str); 72 std::string& getRemains() { return this->remains_; } 73 double getResult() { return this->result_; } 74 bool getSuccess() { return !this->failed_; } 75 76 private: 77 double parse_expr_1(); 78 double parse_expr_2(); 79 double parse_expr_3(); 80 double parse_expr_4(); 81 double parse_expr_5(); 82 double parse_expr_6(); 83 double parse_expr_7(); 84 double parse_expr_8(); 85 char* parse_word(char* str); 86 binary_operator parse_binary_operator(); 87 unary_operator parse_unary_operator(); 88 89 double parse_argument(); 90 double parse_last_argument(); 91 92 binary_operator op; 93 const char* reading_stream; 94 bool failed_; 95 double result_; 96 std::string remains_; 97 98 }; 99 100 //Endzeichen für float expression: ')', '}', ']', ',', ';' 101 _UtilExport bool parse_float(char* const, char**, double*); 102 //Endzeichen angegeben 103 _UtilExport bool parse_float(char* const, char**, char, double*); 104 //Letzter Teil-float eines Vektors parsen (keine Vergleichs- und Logikoperationen) 105 _UtilExport bool parse_vector_float(char* const, char**, bool, double*); 102 //Endzeichen für float expression: ')', '}', ']', ',', ';' 103 _UtilExport bool parse_float(char* const, char**, double*); 104 //Endzeichen angegeben 105 _UtilExport bool parse_float(char* const, char**, char, double*); 106 //Letzter Teil-float eines Vektors parsen (keine Vergleichs- und Logikoperationen) 107 _UtilExport bool parse_vector_float(char* const, char**, bool, double*); 108 } 106 109 107 110 #endif /* _FloatParser_H__ */
Note: See TracChangeset
for help on using the changeset viewer.