Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions
Draw_Interpretor Class Reference

Provides an encapsulation of the TCL interpreter 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 int(* CommandFunction) (Draw_Interpretor &theDI, int theArgNb, const char **theArgVec)
 Global callback function definition.
 

Public Member Functions

 Draw_Interpretor ()
 Empty constructor.
 
void Init ()
 Initialize TCL interpreter.
 
void Add (const char *theCommandName, const char *theHelp, CommandFunction theFunction, const char *theGroup="User Commands")
 Creates a new command with name <theCommandName>, help string <theHelp> in group <theGroup>.
 
void Add (const char *theCommandName, const char *theHelp, const char *theFileName, CommandFunction theFunction, const char *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 (const char *theCommandName, const char *theHelp, const char *theFileName, const theHandleType &theObjPtr, typename Draw_Interpretor::CallBackDataMethod< theHandleType >::methodType theMethod, const char *theGroup)
 Creates a new command with name <theCommandName>, help string <theHelp> in group <theGroup>.
 
bool Remove (const char *const theCommandName)
 Removes <theCommandName>, returns true if success (the command existed).
 
const charResult () const
 
void Reset ()
 Resets the result to empty string.
 
Draw_InterpretorAppend (const char *const theResult)
 Appends to the result.
 
Draw_Interpretoroperator<< (const char *const theResult)
 
Draw_InterpretorAppend (const TCollection_AsciiString &theResult)
 Appends to the result.
 
Draw_Interpretoroperator<< (const TCollection_AsciiString &theResult)
 
Draw_InterpretorAppend (const TCollection_ExtendedString &theResult)
 Appends to the result.
 
Draw_Interpretoroperator<< (const TCollection_ExtendedString &theResult)
 
Draw_InterpretorAppend (const int theResult)
 Appends to the result.
 
Draw_Interpretoroperator<< (const int theResult)
 
Draw_InterpretorAppend (const size_t theResult)
 Appends to the result.
 
Draw_Interpretoroperator<< (const size_t theResult)
 
Draw_InterpretorAppend (const double theResult)
 Appends to the result.
 
Draw_Interpretoroperator<< (const double theResult)
 
Draw_InterpretorAppend (const Standard_SStream &theResult)
 Appends to the result.
 
Draw_Interpretoroperator<< (const Standard_SStream &theResult)
 
void AppendElement (const char *const theResult)
 Appends to the result the string as a list element.
 
int Eval (const char *const theScript)
 Eval the script and returns OK = 0, ERROR = 1.
 
int RecordAndEval (const char *const theScript, const int theFlags=0)
 Eval the script and returns OK = 0, ERROR = 1 Store the script in the history record.
 
int EvalFile (const char *const theFileName)
 Eval the content on the file and returns status.
 
int PrintHelp (const char *const 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 bool theDoLog)
 Enables or disables logging of all commands and their results.
 
void SetDoEcho (const bool theDoEcho)
 Enables or disables eachoing of all commands and their results to cout.
 
bool GetDoLog () const
 Returns true if logging of commands is enabled.
 
bool GetDoEcho () const
 Returns true if echoing of commands is enabled.
 
void ResetLog ()
 Resets log (if opened) to zero size.
 
void AddLog (const char *const 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.
 
int GetLogFileDescriptor ()
 Returns current value of the log file descriptor.
 
bool ToColorize () const
 Return TRUE if console output should be colorized; TRUE by default.
 
void SetToColorize (bool theToColorize)
 Set if console output should be colorized.
 

Static Public Member Functions

static bool Complete (const char *const theScript)
 Returns True if the script is complete, no pending closing braces. (})
 

Protected Member Functions

void add (const char *const theCommandName, const char *const theHelp, const char *const theFileName, CallBackData *theCallback, const char *const theGroup)
 

Detailed Description

Provides an encapsulation of the TCL interpreter to define Draw commands.

Member Typedef Documentation

◆ CommandFunction

typedef int(* Draw_Interpretor::CommandFunction) (Draw_Interpretor &theDI, int theArgNb, const char **theArgVec)

Global callback function definition.

Constructor & Destructor Documentation

◆ Draw_Interpretor() [1/2]

Draw_Interpretor::Draw_Interpretor ( )

Empty constructor.

◆ ~Draw_Interpretor()

Draw_Interpretor::~Draw_Interpretor ( )

Destructor.

◆ Draw_Interpretor() [2/2]

Draw_Interpretor::Draw_Interpretor ( const Draw_PInterp & theInterp)

Member Function Documentation

◆ add()

void Draw_Interpretor::add ( const char *const theCommandName,
const char *const theHelp,
const char *const theFileName,
CallBackData * theCallback,
const char *const theGroup )
protected

◆ Add() [1/3]

void Draw_Interpretor::Add ( const char * theCommandName,
const char * theHelp,
CommandFunction theFunction,
const char * theGroup = "User Commands" )
inline

Creates a new command with name <theCommandName>, help string <theHelp> in group <theGroup>.

Parameters
theFunctioncallback implementation

◆ Add() [2/3]

void Draw_Interpretor::Add ( const char * theCommandName,
const char * theHelp,
const char * theFileName,
CommandFunction theFunction,
const char * theGroup = "User Commands" )
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.

◆ Add() [3/3]

template<typename theHandleType >
void Draw_Interpretor::Add ( const char * theCommandName,
const char * theHelp,
const char * theFileName,
const theHandleType & theObjPtr,
typename Draw_Interpretor::CallBackDataMethod< theHandleType >::methodType theMethod,
const char * theGroup )
inline

Creates a new command with name <theCommandName>, help string <theHelp> in group <theGroup>.

Parameters
theObjPtrcallback class instance
theMethodcallback implementation
theFileNamethe name of the file that contains the implementation of the command

◆ AddLog()

void Draw_Interpretor::AddLog ( const char *const theStr)

Writes a text string to the log (if opened); end of line is not appended.

◆ Append() [1/7]

Draw_Interpretor & Draw_Interpretor::Append ( const char *const theResult)

Appends to the result.

◆ Append() [2/7]

Draw_Interpretor & Draw_Interpretor::Append ( const double theResult)

Appends to the result.

◆ Append() [3/7]

Draw_Interpretor & Draw_Interpretor::Append ( const int theResult)

Appends to the result.

◆ Append() [4/7]

Draw_Interpretor & Draw_Interpretor::Append ( const size_t theResult)

Appends to the result.

◆ Append() [5/7]

Draw_Interpretor & Draw_Interpretor::Append ( const Standard_SStream & theResult)

Appends to the result.

◆ Append() [6/7]

Draw_Interpretor & Draw_Interpretor::Append ( const TCollection_AsciiString & theResult)

Appends to the result.

◆ Append() [7/7]

Draw_Interpretor & Draw_Interpretor::Append ( const TCollection_ExtendedString & theResult)

Appends to the result.

◆ AppendElement()

void Draw_Interpretor::AppendElement ( const char *const theResult)

Appends to the result the string as a list element.

◆ Complete()

static bool Draw_Interpretor::Complete ( const char *const theScript)
static

Returns True if the script is complete, no pending closing braces. (})

◆ Eval()

int Draw_Interpretor::Eval ( const char *const theScript)

Eval the script and returns OK = 0, ERROR = 1.

◆ EvalFile()

int Draw_Interpretor::EvalFile ( const char *const theFileName)

Eval the content on the file and returns status.

◆ GetDoEcho()

bool Draw_Interpretor::GetDoEcho ( ) const

Returns true if echoing of commands is enabled.

◆ GetDoLog()

bool Draw_Interpretor::GetDoLog ( ) const

Returns true if logging of commands is enabled.

◆ GetLog()

TCollection_AsciiString Draw_Interpretor::GetLog ( )

Returns current content of the log file as a text string.

◆ GetLogFileDescriptor()

int Draw_Interpretor::GetLogFileDescriptor ( )
inline

Returns current value of the log file descriptor.

◆ Init()

void Draw_Interpretor::Init ( )

Initialize TCL interpreter.

◆ Interp()

Draw_PInterp Draw_Interpretor::Interp ( ) const

◆ operator<<() [1/7]

Draw_Interpretor & Draw_Interpretor::operator<< ( const char *const theResult)
inline

◆ operator<<() [2/7]

Draw_Interpretor & Draw_Interpretor::operator<< ( const double theResult)
inline

◆ operator<<() [3/7]

Draw_Interpretor & Draw_Interpretor::operator<< ( const int theResult)
inline

◆ operator<<() [4/7]

Draw_Interpretor & Draw_Interpretor::operator<< ( const size_t theResult)
inline

◆ operator<<() [5/7]

Draw_Interpretor & Draw_Interpretor::operator<< ( const Standard_SStream & theResult)
inline

◆ operator<<() [6/7]

Draw_Interpretor & Draw_Interpretor::operator<< ( const TCollection_AsciiString & theResult)
inline

◆ operator<<() [7/7]

Draw_Interpretor & Draw_Interpretor::operator<< ( const TCollection_ExtendedString & theResult)
inline

◆ PrintHelp()

int Draw_Interpretor::PrintHelp ( const char *const theCommandName)

Eval the script "help command_name".

◆ RecordAndEval()

int Draw_Interpretor::RecordAndEval ( const char *const theScript,
const int theFlags = 0 )

Eval the script and returns OK = 0, ERROR = 1 Store the script in the history record.

◆ Remove()

bool Draw_Interpretor::Remove ( const char *const theCommandName)

Removes <theCommandName>, returns true if success (the command existed).

◆ Reset()

void Draw_Interpretor::Reset ( )

Resets the result to empty string.

◆ ResetLog()

void Draw_Interpretor::ResetLog ( )

Resets log (if opened) to zero size.

◆ Result()

const char * Draw_Interpretor::Result ( ) const

◆ Set()

void Draw_Interpretor::Set ( const Draw_PInterp & theInterp)

◆ SetDoEcho()

void Draw_Interpretor::SetDoEcho ( const bool theDoEcho)

Enables or disables eachoing of all commands and their results to cout.

◆ SetDoLog()

void Draw_Interpretor::SetDoLog ( const bool theDoLog)

Enables or disables logging of all commands and their results.

◆ SetToColorize()

void Draw_Interpretor::SetToColorize ( bool theToColorize)

Set if console output should be colorized.

◆ ToColorize()

bool Draw_Interpretor::ToColorize ( ) const
inline

Return TRUE if console output should be colorized; TRUE by default.


The documentation for this class was generated from the following file: