2b51e1e51ce9ded14616c2b5b54f4d94ef73dab1
[occt.git] / src / Units / Units_Sentence.hxx
1 // Created on: 1992-06-22
2 // Created by: Gilles DEBARBOUILLE
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _Units_Sentence_HeaderFile
18 #define _Units_Sentence_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Units_TokensSequence.hxx>
25 #include <Standard_CString.hxx>
26 #include <Standard_Boolean.hxx>
27 class Units_Lexicon;
28 class Units_Token;
29
30
31 //! This class describes all the methods to create and
32 //! compute an expression contained in a string.
33 class Units_Sentence 
34 {
35 public:
36
37   DEFINE_STANDARD_ALLOC
38
39   
40   //! Creates and  returns  a   Sentence, by  analyzing  the
41   //! string <astring> with the lexicon <alexicon>.
42   Standard_EXPORT Units_Sentence(const Handle(Units_Lexicon)& alexicon, const Standard_CString astring);
43   
44   //! For each constant encountered, sets the value.
45   Standard_EXPORT void SetConstants();
46   
47   //! Returns <thesequenceoftokens>.
48     Handle(Units_TokensSequence) Sequence() const;
49   
50   //! Sets the field <thesequenceoftokens> to <asequenceoftokens>.
51     void Sequence (const Handle(Units_TokensSequence)& asequenceoftokens);
52   
53   //! Computes and  returns in a   token the result  of  the
54   //! expression.
55   Standard_EXPORT Handle(Units_Token) Evaluate();
56   
57   //! Return True if number of created tokens > 0
58   //! (i.e creation of sentence is succesfull)
59     Standard_Boolean IsDone() const;
60   
61   //! Useful for debugging.
62     void Dump() const;
63
64
65
66
67 protected:
68
69
70
71
72
73 private:
74
75
76
77   Handle(Units_TokensSequence) thesequenceoftokens;
78
79
80 };
81
82
83 #include <Units_Sentence.lxx>
84
85
86
87
88
89 #endif // _Units_Sentence_HeaderFile