Open CASCADE Technology  7.1.0.beta
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...
 
Standard_SStreamLog ()
 Returns log stream. 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

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

Global callback function definition.

Constructor & Destructor Documentation

Draw_Interpretor::Draw_Interpretor ( )

Empty constructor.

Draw_Interpretor::~Draw_Interpretor ( )

Destructor.

Draw_Interpretor::Draw_Interpretor ( const Draw_PInterp theInterp)

Member Function Documentation

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
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.

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
void Draw_Interpretor::add ( Standard_CString  theCommandName,
Standard_CString  theHelp,
Standard_CString  theFileName,
CallBackData theCallback,
Standard_CString  theGroup 
)
protected
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 Standard_Boolean Draw_Interpretor::Complete ( const Standard_CString  theScript)
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.

void Draw_Interpretor::Init ( )

Initialize TCL interpretor.

Draw_PInterp Draw_Interpretor::Interp ( ) const
Standard_SStream& Draw_Interpretor::Log ( )

Returns log stream.

Draw_Interpretor& Draw_Interpretor::operator<< ( const Standard_CString  theResult)
inline
Draw_Interpretor& Draw_Interpretor::operator<< ( const TCollection_AsciiString theResult)
inline
Draw_Interpretor& Draw_Interpretor::operator<< ( const TCollection_ExtendedString theResult)
inline
Draw_Interpretor& Draw_Interpretor::operator<< ( const Standard_Integer  theResult)
inline
Draw_Interpretor& Draw_Interpretor::operator<< ( const Standard_Real  theResult)
inline
Draw_Interpretor& Draw_Interpretor::operator<< ( const Standard_SStream theResult)
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.

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.


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