Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/questsystem2/src/util/ExprParser.h @ 2466

Last change on this file since 2466 was 1894, checked in by rgrieder, 16 years ago
  • Converted ExprParser to 4 spaces/tab
  • Tiny little bug in String.cc
  • Property svn:eol-style set to native
File size: 2.6 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
40class _UtilExport ExprParser
41{
42public:
43    enum binary_operator
44    {
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
61    };
62
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
76private:
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*);
106
107#endif /* _FloatParser_H__ */
Note: See TracBrowser for help on using the repository browser.