Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/libraries/util/ExprParser.h @ 7305

Last change on this file since 7305 was 6417, checked in by rgrieder, 15 years ago

Merged presentation2 branch back to trunk.
Major new features:

  • Actual GUI with settings, etc.
  • Improved space ship steering (human interaction)
  • Rocket fire and more particle effects
  • Advanced sound framework
  • Property svn:eol-style set to native
File size: 3.0 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Reto Grieder
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30  @file
31  @brief Declaration of FloatParser
32*/
33
34#ifndef _FloatParser_H__
35#define _FloatParser_H__
36
37#include "UtilPrereqs.h"
38
39#include <map>
40#include <string>
41
42namespace orxonox
43{
44    class _UtilExport ExprParser
45    {
46    public:
47        enum binary_operator
48        {
49            b_plus,
50            b_minus,
51            mal,
52            durch,
53            modulo,
54            hoch,
55            undef,
56            oder,
57            und,
58            gleich,
59            b_nicht,
60            kleiner,
61            groesser,
62            ungleich,
63            kleinergleich,
64            groessergleich
65        };
66
67        enum unary_operator
68        {
69            u_plus,
70            u_minus,
71            u_nicht
72        };
73
74
75        ExprParser();
76        void parse(const std::string& str);
77        const std::string& getRemains() { return  this->remains_; }
78        double             getResult()  { return  this->result_; }
79        bool               getSuccess() { return !this->failed_; }
80
81        void setVariable(const std::string& varname, double value);
82
83    private:
84        double parse_expr_1();
85        double parse_expr_2();
86        double parse_expr_3();
87        double parse_expr_4();
88        double parse_expr_5();
89        double parse_expr_6();
90        double parse_expr_7();
91        double parse_expr_8();
92        char* parse_word(char* str);
93        binary_operator parse_binary_operator();
94        unary_operator parse_unary_operator();
95
96        double parse_argument();
97        double parse_last_argument();
98
99        binary_operator op;
100        const char* reading_stream;
101        bool failed_;
102        double result_;
103        std::string remains_;
104        std::map<std::string, double> variables_;
105    };
106
107    //Endzeichen für float expression: ')', '}', ']', ',', ';'
108    _UtilExport bool parse_float(char* const, char**, double*);
109    //Endzeichen angegeben
110    _UtilExport bool parse_float(char* const, char**, char, double*);
111    //Letzter Teil-float eines Vektors parsen (keine Vergleichs- und Logikoperationen)
112    _UtilExport bool parse_vector_float(char* const, char**, bool, double*);
113}
114
115#endif /* _FloatParser_H__ */
Note: See TracBrowser for help on using the repository browser.