C++ mpi module for stochmagnet_main Package
EXPR_Tokenizer.h
1 #ifndef EXPR_Tokenizer_H
2 #define EXPR_Tokenizer_H
3 
4 
5 #include "EXPR_Object.h"
6 
7 #include <vector>
8 
16 class EXPR_Tokenizer : public virtual EXPR_Object {
17 private:
18  //attributes
19  std::stringstream mTokens;
20 
21 private:
22  //associations
23 protected:
24  //builders
25 
29 
30  //deleters
33  virtual ~EXPR_Tokenizer();
34 
35 public:
36  //methods
40  static inline CORE_UniquePointer<EXPR_Tokenizer> New() {
41  CORE_UniquePointer<EXPR_Tokenizer> p(new EXPR_Tokenizer(),
43  return p;
44  }
45 
48  inline void setTokens(const tString& tokens) {
49  mTokens.str(tokens);
50  }
54  void returnToPosition(const tInt& pos);
55 
59  tInt getCurrentPosition();
63  tBoolean isAtEnd() const;
66  void skipWhiteSpace();
70  tBoolean readUntil(const tChar& expected);
71  /* \brief read the next token
72  * @param token: the token read
73  * @param return true if the token has been read
74  */
75  tBoolean readToken(tString& token);
76 
81  tBoolean readRealValue(tReal& x);
82 
94  tBoolean readArguments(std::vector<tString>& args);
95 
99  virtual tString toString() const override;
100 
101 };
102 
103 
104 
105 
106 #endif
107 
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:113
This class is the base class of all the parser package.
Definition: EXPR_Object.h:27
This class manages the string manipulation.
Definition: EXPR_Tokenizer.h:16
tBoolean readUntil(const tChar &expected)
read the tokens utile the char expected is found ]return tre if the expected char has been found
Definition: EXPR_Tokenizer.cpp:43
virtual tString toString() const override
return the string representation of the class
Definition: EXPR_Tokenizer.cpp:143
EXPR_Tokenizer()
create the class
Definition: EXPR_Tokenizer.cpp:3
virtual ~EXPR_Tokenizer()
delete the class
Definition: EXPR_Tokenizer.cpp:6
void returnToPosition(const tInt &pos)
rreturn the position of the cursor to pos
Definition: EXPR_Tokenizer.cpp:9
void skipWhiteSpace()
read all the white characters
Definition: EXPR_Tokenizer.cpp:32
tInt getCurrentPosition()
get the current position of the token
Definition: EXPR_Tokenizer.cpp:18
tBoolean isAtEnd() const
test if all the tokens has been reads
Definition: EXPR_Tokenizer.cpp:26
tBoolean readArguments(std::vector< tString > &args)
read the arguement of the form "[x,y,z,t]"
Definition: EXPR_Tokenizer.cpp:68
void setTokens(const tString &tokens)
set the tokens
Definition: EXPR_Tokenizer.h:48
tBoolean readRealValue(tReal &x)
read the next value
Definition: EXPR_Tokenizer.cpp:132
static CORE_UniquePointer< EXPR_Tokenizer > New()
crete the new instance of this
Definition: EXPR_Tokenizer.h:40