Open CASCADE Technology 7.8.2.dev
|
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. | |
Public Member Functions | |
Draw_Interpretor () | |
Empty constructor. | |
void | Init () |
Initialize TCL interpretor. | |
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>. | |
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>. @theFunction callback implementation @theFileName the name of the file that contains the implementation of the command. | |
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>. | |
Standard_Boolean | Remove (const Standard_CString theCommandName) |
Removes <theCommandName>, returns true if success (the command existed). | |
Standard_CString | Result () const |
void | Reset () |
Resets the result to empty string. | |
Draw_Interpretor & | Append (const Standard_CString theResult) |
Appends to the result. | |
Draw_Interpretor & | operator<< (const Standard_CString theResult) |
Draw_Interpretor & | Append (const TCollection_AsciiString &theResult) |
Appends to the result. | |
Draw_Interpretor & | operator<< (const TCollection_AsciiString &theResult) |
Draw_Interpretor & | Append (const TCollection_ExtendedString &theResult) |
Appends to the result. | |
Draw_Interpretor & | operator<< (const TCollection_ExtendedString &theResult) |
Draw_Interpretor & | Append (const Standard_Integer theResult) |
Appends to the result. | |
Draw_Interpretor & | operator<< (const Standard_Integer theResult) |
Draw_Interpretor & | Append (const Standard_Real theResult) |
Appends to the result. | |
Draw_Interpretor & | operator<< (const Standard_Real theResult) |
Draw_Interpretor & | Append (const Standard_SStream &theResult) |
Appends to the result. | |
Draw_Interpretor & | operator<< (const Standard_SStream &theResult) |
void | AppendElement (const Standard_CString theResult) |
Appends to the result the string as a list element. | |
Standard_Integer | Eval (const Standard_CString theScript) |
Eval the script and returns OK = 0, ERROR = 1. | |
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. | |
Standard_Integer | EvalFile (const Standard_CString theFileName) |
Eval the content on the file and returns status. | |
Standard_Integer | PrintHelp (const Standard_CString theCommandName) |
Eval the script "help command_name". | |
~Draw_Interpretor () | |
Destructor. | |
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. | |
void | SetDoEcho (const Standard_Boolean theDoEcho) |
Enables or disables eachoing of all commands and their results to cout. | |
Standard_Boolean | GetDoLog () const |
Returns true if logging of commands is enabled. | |
Standard_Boolean | GetDoEcho () const |
Returns true if echoing of commands is enabled. | |
void | ResetLog () |
Resets log (if opened) to zero size. | |
void | AddLog (const Standard_CString theStr) |
Writes a text string to the log (if opened); end of line is not appended. | |
TCollection_AsciiString | GetLog () |
Returns current content of the log file as a text string. | |
Standard_Integer | GetLogFileDescriptor () |
Returns current value of the log file descriptor. | |
Standard_Boolean | ToColorize () const |
Return TRUE if console output should be colorized; TRUE by default. | |
void | SetToColorize (Standard_Boolean theToColorize) |
Set if console output should be colorized. | |
Static Public Member Functions | |
static Standard_Boolean | Complete (const Standard_CString theScript) |
Returns True if the script is complete, no pending closing braces. (}) | |
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.
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>. @theFunction callback implementation @theFileName 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 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.
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.
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.
void Draw_Interpretor::SetToColorize | ( | Standard_Boolean | theToColorize | ) |
Set if console output should be colorized.
|
inline |
Return TRUE if console output should be colorized; TRUE by default.