Open CASCADE Technology  7.3.1.dev
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions
Draw_Interpretor Class Reference

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_InterpretorAppend (const Standard_CString theResult)
 Appends to the result. More...
 
Draw_Interpretoroperator<< (const Standard_CString theResult)
 
Draw_InterpretorAppend (const TCollection_AsciiString &theResult)
 Appends to the result. More...
 
Draw_Interpretoroperator<< (const TCollection_AsciiString &theResult)
 
Draw_InterpretorAppend (const TCollection_ExtendedString &theResult)
 Appends to the result. More...
 
Draw_Interpretoroperator<< (const TCollection_ExtendedString &theResult)
 
Draw_InterpretorAppend (const Standard_Integer theResult)
 Appends to the result. More...
 
Draw_Interpretoroperator<< (const Standard_Integer theResult)
 
Draw_InterpretorAppend (const Standard_Real theResult)
 Appends to the result. More...
 
Draw_Interpretoroperator<< (const Standard_Real theResult)
 
Draw_InterpretorAppend (const Standard_SStream &theResult)
 Appends to the result. More...
 
Draw_Interpretoroperator<< (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)
 

Detailed Description

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

Member Typedef Documentation

◆ CommandFunction

typedef Standard_Integer(* Draw_Interpretor::CommandFunction) (Draw_Interpretor &theDI, Standard_Integer 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() [1/3]

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

◆ Add() [3/3]

template<typename theHandleType >
void Draw_Interpretor::Add ( Standard_CString  theCommandName,
Standard_CString  theHelp,
Standard_CString  theFileName,
const theHandleType &  theObjPtr,
typename Draw_Interpretor::CallBackDataMethod< theHandleType >::methodType  theMethod,
Standard_CString  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

◆ add()

void Draw_Interpretor::add ( Standard_CString  theCommandName,
Standard_CString  theHelp,
Standard_CString  theFileName,
CallBackData theCallback,
Standard_CString  theGroup 
)
protected

◆ AddLog()

void Draw_Interpretor::AddLog ( const Standard_CString  theStr)

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

◆ Append() [1/6]

Draw_Interpretor& Draw_Interpretor::Append ( const Standard_CString  theResult)

Appends to the result.

◆ Append() [2/6]

Draw_Interpretor& Draw_Interpretor::Append ( const TCollection_AsciiString theResult)

Appends to the result.

◆ Append() [3/6]

Draw_Interpretor& Draw_Interpretor::Append ( const TCollection_ExtendedString theResult)

Appends to the result.

◆ Append() [4/6]

Draw_Interpretor& Draw_Interpretor::Append ( const Standard_Integer  theResult)

Appends to the result.

◆ Append() [5/6]

Draw_Interpretor& Draw_Interpretor::Append ( const Standard_Real  theResult)

Appends to the result.

◆ Append() [6/6]

Draw_Interpretor& Draw_Interpretor::Append ( const Standard_SStream theResult)

Appends to the result.

◆ AppendElement()

void Draw_Interpretor::AppendElement ( const Standard_CString  theResult)

Appends to the result the string as a list element.

◆ Complete()

static Standard_Boolean Draw_Interpretor::Complete ( const Standard_CString  theScript)
static

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

◆ Eval()

Standard_Integer Draw_Interpretor::Eval ( const Standard_CString  theScript)

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

◆ EvalFile()

Standard_Integer Draw_Interpretor::EvalFile ( const Standard_CString  theFileName)

Eval the content on the file and returns status.

◆ GetDoEcho()

Standard_Boolean Draw_Interpretor::GetDoEcho ( ) const

Returns true if echoing of commands is enabled.

◆ GetDoLog()

Standard_Boolean 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()

Standard_Integer Draw_Interpretor::GetLogFileDescriptor ( )
inline

Returns current value of the log file descriptor.

◆ Init()

void Draw_Interpretor::Init ( )

Initialize TCL interpretor.

◆ Interp()

Draw_PInterp Draw_Interpretor::Interp ( ) const

◆ operator<<() [1/6]

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

◆ operator<<() [2/6]

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

◆ operator<<() [3/6]

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

◆ operator<<() [4/6]

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

◆ operator<<() [5/6]

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

◆ operator<<() [6/6]

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

◆ PrintHelp()

Standard_Integer Draw_Interpretor::PrintHelp ( const Standard_CString  theCommandName)

Eval the script "help command_name".

◆ RecordAndEval()

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.

◆ Remove()

Standard_Boolean Draw_Interpretor::Remove ( const Standard_CString  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()

Standard_CString Draw_Interpretor::Result ( ) const

◆ Set()

void Draw_Interpretor::Set ( const Draw_PInterp theInterp)

◆ SetDoEcho()

void Draw_Interpretor::SetDoEcho ( const Standard_Boolean  theDoEcho)

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

◆ SetDoLog()

void Draw_Interpretor::SetDoLog ( const Standard_Boolean  theDoLog)

Enables or disables logging of all commands and their results.


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