summaryrefslogtreecommitdiff
path: root/inc/Draw_Interpretor.hxx
blob: 67c23fd78184714a7c98745c4c0f2e2c42fe9385 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to 
// this header file considered to be the "object code" form of the original source.

#ifndef _Draw_Interpretor_HeaderFile
#define _Draw_Interpretor_HeaderFile

#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif

#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Draw_PInterp_HeaderFile
#include <Draw_PInterp.hxx>
#endif
#ifndef _Standard_CString_HeaderFile
#include <Standard_CString.hxx>
#endif
#ifndef _Draw_CommandFunction_HeaderFile
#include <Draw_CommandFunction.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _Standard_SStream_HeaderFile
#include <Standard_SStream.hxx>
#endif
class TCollection_AsciiString;
class TCollection_ExtendedString;


//! Provides  an  encapsulation of the TCL interpretor <br>
//!          to define Draw commands. <br>
class Draw_Interpretor  {
public:

  void* operator new(size_t,void* anAddress) 
  {
    return anAddress;
  }
  void* operator new(size_t size) 
  {
    return Standard::Allocate(size); 
  }
  void  operator delete(void *anAddress) 
  {
    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
  }

  
  Standard_EXPORT   Draw_Interpretor();
  
  Standard_EXPORT     void Init() ;
  //! Creates a  new command  with name <Command>,  help <br>
//!          string <Help> in group <Group>. <br>
//!          <Function> implement the function. <br>
  Standard_EXPORT     void Add(const Standard_CString Command,const Standard_CString Help,const Draw_CommandFunction Function,const Standard_CString Group = "User Commands") ;
  //! Creates a  new command  with name  <Command>, help <br>
//!          string   <Help>   in   group  <Group>.  <Function> <br>
//!          implement the function. <br>
//!           <FileName> is the name of the file that contains <br>
//!           the implementation of the command <br>
  Standard_EXPORT     void Add(const Standard_CString Command,const Standard_CString Help,const Standard_CString FileName,const Draw_CommandFunction Function,const Standard_CString Group = "User Commands") ;
  //! Removes   <Command>, returns true  if success (the <br>
//!          command existed). <br>
  Standard_EXPORT     Standard_Boolean Remove(const Standard_CString Command) ;
  
  Standard_EXPORT     Standard_CString Result() const;
  //! Resets the result to empty string <br>
  Standard_EXPORT     void Reset() ;
  //! Appends to the result <br>
  Standard_EXPORT     Draw_Interpretor& Append(const Standard_CString Result) ;
    Draw_Interpretor& operator<<(const Standard_CString Result) 
{
  return Append(Result);
}
  //! Appends to the result <br>
  Standard_EXPORT     Draw_Interpretor& Append(const TCollection_AsciiString& Result) ;
    Draw_Interpretor& operator<<(const TCollection_AsciiString& Result) 
{
  return Append(Result);
}
  //! Appends to the result <br>
  Standard_EXPORT     Draw_Interpretor& Append(const TCollection_ExtendedString& Result) ;
    Draw_Interpretor& operator<<(const TCollection_ExtendedString& Result) 
{
  return Append(Result);
}
  //! Appends  to the result <br>
  Standard_EXPORT     Draw_Interpretor& Append(const Standard_Integer Result) ;
    Draw_Interpretor& operator<<(const Standard_Integer Result) 
{
  return Append(Result);
}
  //! Appends  to the result <br>
  Standard_EXPORT     Draw_Interpretor& Append(const Standard_Real Result) ;
    Draw_Interpretor& operator<<(const Standard_Real Result) 
{
  return Append(Result);
}
  //! Appends  to the result <br>
  Standard_EXPORT     Draw_Interpretor& Append(const Standard_SStream& Result) ;
    Draw_Interpretor& operator<<(const Standard_SStream& Result) 
{
  return Append(Result);
}
  //! Appends to the result the string as a list element <br>
  Standard_EXPORT     void AppendElement(const Standard_CString Result) ;
  //! Eval the script and returns OK = 0, ERROR = 1 <br>
  Standard_EXPORT     Standard_Integer Eval(const Standard_CString Script) ;
  //! Eval the script and returns OK = 0, ERROR = 1 <br>
//!          Store the script in the history record. <br>
  Standard_EXPORT     Standard_Integer RecordAndEval(const Standard_CString Script,const Standard_Integer Flags = 0) ;
  //! Eval the content on the file and returns status <br>
  Standard_EXPORT     Standard_Integer EvalFile(const Standard_CString FileName) ;
  //! Returns True if the script is complete, no pending <br>
//!          closing braces. (}) <br>
  Standard_EXPORT   static  Standard_Boolean Complete(const Standard_CString Script) ;
  
  Standard_EXPORT     void Destroy() ;
~Draw_Interpretor()
{
  Destroy();
}
  
  Standard_EXPORT   Draw_Interpretor(const Draw_PInterp& anInterp);
  
  Standard_EXPORT     void Set(const Draw_PInterp& anInterp) ;
  
  Standard_EXPORT     Draw_PInterp Interp() const;





protected:





private:



Standard_Boolean isAllocated;
Draw_PInterp myInterp;


};





// other Inline functions and methods (like "C++: function call" methods)


#endif