openMSX
Public Member Functions | List of all members
openmsx::TclObject Class Reference

#include <TclObject.hh>

Public Member Functions

 TclObject (Tcl_Interp *interp, Tcl_Obj *object)
 TclObject (Tcl_Interp *interp, string_ref value)
 TclObject (string_ref value)
 TclObject (Tcl_Interp *interp)
 TclObject (Interpreter &interp)
 TclObject (const TclObject &object)
 TclObject ()
 ~TclObject ()
TclObjectoperator= (const TclObject &other)
Tcl_Interp * getInterpreter () const
Tcl_Obj * getTclObject ()
void setString (string_ref value)
void setInt (int value)
void setBoolean (bool value)
void setDouble (double value)
void setBinary (byte *buf, unsigned length)
void addListElement (string_ref element)
void addListElement (int value)
void addListElement (double value)
void addListElement (const TclObject &element)
template<typename ITER >
void addListElements (ITER begin, ITER end)
template<typename CONT >
void addListElements (const CONT &container)
string_ref getString () const
int getInt () const
bool getBoolean () const
double getDouble () const
const bytegetBinary (unsigned &length) const
unsigned getListLength () const
TclObject getListIndex (unsigned index) const
bool evalBool () const
void checkExpression () const
 Interpret the content of this TclObject as an expression and check for syntax errors.
void checkCommand () const
std::string executeCommand (bool compile=false)
 Interpret this TclObject as a command and execute it.

Detailed Description

Definition at line 15 of file TclObject.hh.

Constructor & Destructor Documentation

openmsx::TclObject::TclObject ( Tcl_Interp *  interp,
Tcl_Obj *  object 
)

Definition at line 14 of file TclObject.cc.

openmsx::TclObject::TclObject ( Tcl_Interp *  interp,
string_ref  value 
)

Definition at line 20 of file TclObject.cc.

References string_ref::data(), and string_ref::size().

openmsx::TclObject::TclObject ( string_ref  value)
explicit

Definition at line 26 of file TclObject.cc.

References string_ref::data(), and string_ref::size().

openmsx::TclObject::TclObject ( Tcl_Interp *  interp)
explicit

Definition at line 32 of file TclObject.cc.

openmsx::TclObject::TclObject ( Interpreter interp)
explicit

Definition at line 38 of file TclObject.cc.

openmsx::TclObject::TclObject ( const TclObject object)

Definition at line 44 of file TclObject.cc.

openmsx::TclObject::TclObject ( )

Definition at line 50 of file TclObject.cc.

Referenced by getListIndex().

openmsx::TclObject::~TclObject ( )

Definition at line 62 of file TclObject.cc.

Member Function Documentation

void openmsx::TclObject::addListElement ( string_ref  element)

Definition at line 149 of file TclObject.cc.

References string_ref::data(), and string_ref::size().

Referenced by openmsx::SettingRangePolicy< int >::additionalInfo(), openmsx::EnumSettingPolicyBase::additionalInfoBase(), addListElement(), addListElements(), openmsx::CPUCore< CPU_POLICY >::disasmCommand(), openmsx::RomInfoTopic::execute(), openmsx::HDCommand::execute(), openmsx::SettingInfo::execute(), openmsx::TclCallback::execute(), openmsx::CartCmd::execute(), openmsx::CDXCommand::execute(), openmsx::SoftwareInfoTopic::execute(), openmsx::SoundDeviceInfoTopic::execute(), openmsx::HelpCmd::execute(), openmsx::DiskCommand::execute(), openmsx::LaserdiscCommand::execute(), openmsx::BindCmd::execute(), openmsx::CartridgeSlotInfo::execute(), openmsx::PluggableInfo::execute(), openmsx::ConnectorInfo::execute(), openmsx::TapeCommand::execute(), openmsx::LSXCommand::execute(), openmsx::ConfigInfo::execute(), openmsx::ListExtCmd::execute(), openmsx::DeviceInfo::execute(), openmsx::MSXDevice::getDeviceInfo(), openmsx::MSXRom::getExtraDeviceInfo(), openmsx::MSXMultiIODevice::getNameList(), openmsx::MSXMultiMemDevice::getNameList(), openmsx::MSXDevice::getNameList(), openmsx::OSDText::getProperty(), openmsx::OSDWidget::getProperty(), openmsx::Setting::info(), openmsx::CassettePlayerCLI::parseFileType(), openmsx::ReplayCLI::parseFileType(), openmsx::SaveStateCLI::parseFileType(), openmsx::LaserdiscPlayerCLI::parseFileType(), openmsx::HDImageCLI::parseOption(), openmsx::CDImageCLI::parseOption(), openmsx::MouseButtonEvent::toStringHelper(), openmsx::JoystickEvent::toStringHelper(), openmsx::JoystickButtonEvent::toStringHelper(), openmsx::OsdControlEvent::toStringHelper(), openmsx::FinishFrameEvent::toStringImpl(), openmsx::CliCommandEvent::toStringImpl(), and openmsx::SimpleEvent::toStringImpl().

void openmsx::TclObject::addListElement ( int  value)

Definition at line 154 of file TclObject.cc.

References addListElement().

void openmsx::TclObject::addListElement ( double  value)

Definition at line 159 of file TclObject.cc.

References addListElement().

void openmsx::TclObject::addListElement ( const TclObject element)

Definition at line 164 of file TclObject.cc.

References addListElement().

template<typename ITER >
void openmsx::TclObject::addListElements ( ITER  begin,
ITER  end 
)
template<typename CONT >
void openmsx::TclObject::addListElements ( const CONT &  container)

Definition at line 98 of file TclObject.hh.

References addListElements().

void openmsx::TclObject::checkCommand ( ) const

Definition at line 255 of file TclObject.cc.

References string_ref::data(), getString(), and string_ref::size().

void openmsx::TclObject::checkExpression ( ) const

Interpret the content of this TclObject as an expression and check for syntax errors.

Throws CommandException in case of an error. Note: this method does not catch all errors (some are only found while evaluating the expression) but it's nice as a quick check for typos.

Definition at line 249 of file TclObject.cc.

References string_ref::data(), getString(), and string_ref::size().

bool openmsx::TclObject::evalBool ( ) const

Definition at line 240 of file TclObject.cc.

string openmsx::TclObject::executeCommand ( bool  compile = false)

Interpret this TclObject as a command and execute it.

Parameters
compileShould the command be compiled to bytecode? The bytecode is stored inside the TclObject can speed up future invocations of the same command. Only set this flag when the command will be executed more than once. TODO return TclObject instead of string?

Definition at line 303 of file TclObject.cc.

Referenced by openmsx::BreakPointBase::checkAndExecute().

const byte * openmsx::TclObject::getBinary ( unsigned &  length) const

Definition at line 215 of file TclObject.cc.

bool openmsx::TclObject::getBoolean ( ) const

Definition at line 190 of file TclObject.cc.

Referenced by openmsx::OSDWidget::setProperty().

double openmsx::TclObject::getDouble ( ) const
int openmsx::TclObject::getInt ( ) const
Tcl_Interp * openmsx::TclObject::getInterpreter ( ) const
TclObject openmsx::TclObject::getListIndex ( unsigned  index) const

Definition at line 230 of file TclObject.cc.

References TclObject().

unsigned openmsx::TclObject::getListLength ( ) const

Definition at line 221 of file TclObject.cc.

Referenced by openmsx::CartCmd::execute().

string_ref openmsx::TclObject::getString ( ) const
Tcl_Obj * openmsx::TclObject::getTclObject ( )

Definition at line 82 of file TclObject.cc.

TclObject & openmsx::TclObject::operator= ( const TclObject other)

Definition at line 67 of file TclObject.cc.

void openmsx::TclObject::setBinary ( byte buf,
unsigned  length 
)

Definition at line 138 of file TclObject.cc.

void openmsx::TclObject::setBoolean ( bool  value)

Definition at line 116 of file TclObject.cc.

Referenced by openmsx::OSDWidget::getProperty().

void openmsx::TclObject::setDouble ( double  value)
void openmsx::TclObject::setInt ( int  value)
void openmsx::TclObject::setString ( string_ref  value)

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