Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 20, 2008, 4:31:03 PM (16 years ago)
Author:
rgrieder
Message:
  • classed FloatParser to ExprParser class
File:
1 moved

Legend:

Unmodified
Added
Removed
  • code/branches/input/src/util/ExprParser.h

    r1113 r1118  
    1 //FloatParser.h
     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*/
    233
    334#ifndef _FloatParser_H__
     
    536
    637#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(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};
    799
    8100//Endzeichen für float expression: ')', '}', ']', ',', ';'
Note: See TracChangeset for help on using the changeset viewer.