TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
StringTokenizer.h
1/****************************************************************************
2* Copyright (c) 2024, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15#ifndef StringTokenizer_included
16#define StringTokenizer_included
17
18#include <string>
19
20
22{
23
24public :
25
26 // Les differents operateurs et separateurs
27 static const int ADD;
28 static const int SUBTRACT;
29 static const int DIVIDE;
30 static const int MULTIPLY;
31 static const int POWER;
32 static const int GRP;
33 static const int ENDGRP;
34 static const int LT;
35 static const int GT;
36 static const int LE;
37 static const int GE;
38 static const int MOD;
39 static const int MAX;
40 static const int MIN;
41 static const int AND;
42 static const int OR;
43 static const int EQ;
44 static const int NEQ;
45
46 //nb de separateur
47private:
48 static const int nb_op;
49 static const int nb_op_bis;
50 static const char keyword_op[][10];
51 static const char keyword_op_bis[][10];
52
53public:
54
55 // Le type d'un element detecte : nb, chaine, fin de chaine
56 static const int NUMBER;
57 static const int STRING;
58 static const int EOS;
59
60 int type;
61
63 StringTokenizer(std::string& );
64 StringTokenizer(std::string,std::string);
66
67 int nextToken();
68
69 int check_GRP();
70
71
72 inline double getNValue()
73 {
74 return nval;
75 }
76 inline const std::string& getSValue()
77 {
78 return sval;
79 }
80
81
82
83private :
84
85 double nval;
86 std::string sval;
87 std::string str;
88 char *reste;
89
90
91 char* find_sep(char* ch, int& type_sep, int& type_keyword);
92 void init_keyword_op();
93 char ** op_sep;
94
95};
96
97
98
99#endif
static const int AND
const std::string & getSValue()
static const int NUMBER
static const int EOS
static const int STRING
static const int MULTIPLY
static const int MIN
static const int GT
static const int POWER
static const int GRP
static const int GE
static const int LT
static const int LE
static const int MOD
static const int DIVIDE
static const int EQ
static const int ENDGRP
static const int SUBTRACT
static const int ADD
static const int OR
static const int MAX
static const int NEQ