Open CASCADE Technology
7.4.0
|
Provides an encapsulation of the TCL interpretor to define Draw commands. More...
#include <Draw_Interpretor.hxx>
Data Structures | |
struct | CallBackData |
Callback for TCL (interface) More... | |
struct | CallBackDataFunc |
Callback implementation for global function definition. More... | |
struct | CallBackDataMethod |
Callback implementation for class's method definition. More... | |
Public Types | |
typedef Standard_Integer(* | CommandFunction) (Draw_Interpretor &theDI, Standard_Integer theArgNb, const char **theArgVec) |
Global callback function definition. More... | |
Public Member Functions | |
Draw_Interpretor () | |
Empty constructor. More... | |
void | Init () |
Initialize TCL interpretor. More... | |
void | Add (Standard_CString theCommandName, Standard_CString theHelp, CommandFunction theFunction, Standard_CString theGroup="User Commands") |
Creates a new command with name <theCommandName>, help string <theHelp> in group <theGroup>. More... | |
void | Add (Standard_CString theCommandName, Standard_CString theHelp, Standard_CString theFileName, CommandFunction theFunction, Standard_CString theGroup="User Commands") |
Creates a new command with name <theCommandName>, help string <theHelp> in group <theGroup>. callback implementation the name of the file that contains the implementation of the command. More... | |
template<typename theHandleType > | |
void | Add (Standard_CString theCommandName, Standard_CString theHelp, Standard_CString theFileName, const theHandleType &theObjPtr, typename Draw_Interpretor::CallBackDataMethod< theHandleType >::methodType theMethod, Standard_CString theGroup) |
Creates a new command with name <theCommandName>, help string <theHelp> in group <theGroup>. More... | |
Standard_Boolean | Remove (const Standard_CString theCommandName) |
Removes <theCommandName>, returns true if success (the command existed). More... | |
Standard_CString | Result () const |
void | Reset () |
Resets the result to empty string. More... | |
Draw_Interpretor & | Append (const Standard_CString theResult) |
Appends to the result. More... | |
Draw_Interpretor & | operator<< (const Standard_CString theResult) |
Draw_Interpretor & | Append (const TCollection_AsciiString &theResult) |
Appends to the result. More... | |
Draw_Interpretor & | operator<< (const TCollection_AsciiString &theResult) |
Draw_Interpretor & | Append (const TCollection_ExtendedString &theResult) |
Appends to the result. More... | |
Draw_Interpretor & | operator<< (const TCollection_ExtendedString &theResult) |
Draw_Interpretor & | Append (const Standard_Integer theResult) |
Appends to the result. More... | |
Draw_Interpretor & | operator<< (const Standard_Integer theResult) |
Draw_Interpretor & | Append (const Standard_Real theResult) |
Appends to the result. More... | |
Draw_Interpretor & | operator<< (const Standard_Real theResult) |
Draw_Interpretor & | Append (const Standard_SStream &theResult) |
Appends to the result. More... | |
Draw_Interpretor & | operator<< (const Standard_SStream &theResult) |
void | AppendElement (const Standard_CString theResult) |
Appends to the result the string as a list element. More... | |
Standard_Integer | Eval (const Standard_CString theScript) |
Eval the script and returns OK = 0, ERROR = 1. More... | |
Standard_Integer | RecordAndEval (const Standard_CString theScript, const Standard_Integer theFlags=0) |
Eval the script and returns OK = 0, ERROR = 1 Store the script in the history record. More... | |
Standard_Integer | EvalFile (const Standard_CString theFileName) |
Eval the content on the file and returns status. More... | |
Standard_Integer | PrintHelp (const Standard_CString theCommandName) |
Eval the script "help command_name". More... | |
~Draw_Interpretor () | |
Destructor. More... | |
Draw_Interpretor (const Draw_PInterp &theInterp) | |
void | Set (const Draw_PInterp &theInterp) |
Draw_PInterp | Interp () const |
void | SetDoLog (const Standard_Boolean theDoLog) |
Enables or disables logging of all commands and their results. More... | |
void | SetDoEcho (const Standard_Boolean theDoEcho) |
Enables or disables eachoing of all commands and their results to cout. More... | |
Standard_Boolean | GetDoLog () const |
Returns true if logging of commands is enabled. More... | |
Standard_Boolean | GetDoEcho () const |
Returns true if echoing of commands is enabled. More... | |
void | ResetLog () |
Resets log (if opened) to zero size. More... | |
void | AddLog (const Standard_CString theStr) |
Writes a text string to the log (if opened); end of line is not appended. More... | |
TCollection_AsciiString | GetLog () |
Returns current content of the log file as a text string. More... | |
Standard_Integer | GetLogFileDescriptor () |
Returns current value of the log file descriptor. More... | |
Static Public Member Functions | |
static Standard_Boolean | Complete (const Standard_CString theScript) |
Returns True if the script is complete, no pending closing braces. (}) More... | |
Protected Member Functions | |
void | add (Standard_CString theCommandName, Standard_CString theHelp, Standard_CString theFileName, CallBackData *theCallback, Standard_CString theGroup) |
Provides an encapsulation of the TCL interpretor to define Draw commands.
typedef Standard_Integer(* Draw_Interpretor::CommandFunction) (Draw_Interpretor &theDI, Standard_Integer theArgNb, const char **theArgVec) |
Global callback function definition.
Draw_Interpretor::Draw_Interpretor | ( | ) |
Empty constructor.
Draw_Interpretor::~Draw_Interpretor | ( | ) |
Destructor.
Draw_Interpretor::Draw_Interpretor | ( | const Draw_PInterp & | theInterp | ) |
|
inline |
Creates a new command with name <theCommandName>, help string <theHelp> in group <theGroup>.
theFunction | callback implementation |
|
inline |
Creates a new command with name <theCommandName>, help string <theHelp> in group <theGroup>. callback implementation the name of the file that contains the implementation of the command.
|
inline |
Creates a new command with name <theCommandName>, help string <theHelp> in group <theGroup>.
theObjPtr | callback class instance |
theMethod | callback implementation |
theFileName | the name of the file that contains the implementation of the command |
|
protected |
void Draw_Interpretor::AddLog | ( | const Standard_CString | theStr | ) |
Writes a text string to the log (if opened); end of line is not appended.
Draw_Interpretor& Draw_Interpretor::Append | ( | const Standard_CString | theResult | ) |
Appends to the result.
Draw_Interpretor& Draw_Interpretor::Append | ( | const TCollection_AsciiString & | theResult | ) |
Appends to the result.
Draw_Interpretor& Draw_Interpretor::Append | ( | const TCollection_ExtendedString & | theResult | ) |
Appends to the result.
Draw_Interpretor& Draw_Interpretor::Append | ( | const Standard_Integer | theResult | ) |
Appends to the result.
Draw_Interpretor& Draw_Interpretor::Append | ( | const Standard_Real | theResult | ) |
Appends to the result.
Draw_Interpretor& Draw_Interpretor::Append | ( | const Standard_SStream & | theResult | ) |
Appends to the result.
void Draw_Interpretor::AppendElement | ( | const Standard_CString | theResult | ) |
Appends to the result the string as a list element.
|
static |
Returns True if the script is complete, no pending closing braces. (})
Standard_Integer Draw_Interpretor::Eval | ( | const Standard_CString | theScript | ) |
Eval the script and returns OK = 0, ERROR = 1.
Standard_Integer Draw_Interpretor::EvalFile | ( | const Standard_CString | theFileName | ) |
Eval the content on the file and returns status.
Standard_Boolean Draw_Interpretor::GetDoEcho | ( | ) | const |
Returns true if echoing of commands is enabled.
Standard_Boolean Draw_Interpretor::GetDoLog | ( | ) | const |
Returns true if logging of commands is enabled.
TCollection_AsciiString Draw_Interpretor::GetLog | ( | ) |
Returns current content of the log file as a text string.
|
inline |
Returns current value of the log file descriptor.
void Draw_Interpretor::Init | ( | ) |
Initialize TCL interpretor.
Draw_PInterp Draw_Interpretor::Interp | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Standard_Integer Draw_Interpretor::PrintHelp | ( | const Standard_CString | theCommandName | ) |
Eval the script "help command_name".
Standard_Integer Draw_Interpretor::RecordAndEval | ( | const Standard_CString | theScript, |
const Standard_Integer | theFlags = 0 |
||
) |
Eval the script and returns OK = 0, ERROR = 1 Store the script in the history record.
Standard_Boolean Draw_Interpretor::Remove | ( | const Standard_CString | theCommandName | ) |
Removes <theCommandName>, returns true if success (the command existed).
void Draw_Interpretor::Reset | ( | ) |
Resets the result to empty string.
void Draw_Interpretor::ResetLog | ( | ) |
Resets log (if opened) to zero size.
Standard_CString Draw_Interpretor::Result | ( | ) | const |
void Draw_Interpretor::Set | ( | const Draw_PInterp & | theInterp | ) |
void Draw_Interpretor::SetDoEcho | ( | const Standard_Boolean | theDoEcho | ) |
Enables or disables eachoing of all commands and their results to cout.
void Draw_Interpretor::SetDoLog | ( | const Standard_Boolean | theDoLog | ) |
Enables or disables logging of all commands and their results.