Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/archive/toonshader/src/util/ExprParser.h @ 11183

Last change on this file since 11183 was 2171, checked in by landauf, 16 years ago

merged revisions 2111-2170 from objecthierarchy branch back to trunk.

  • Property svn:eol-style set to native
File size: 2.9 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#include <string>
39
40namespace orxonox
41{
42    class _UtilExport ExprParser
43    {
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
100    };
101
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}
109
110#endif /* _FloatParser_H__ */
Note: See TracBrowser for help on using the repository browser.