X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkInterpreter.h;h=b87846854bf2fb5bcacc780dfe832870e3d9f53c;hb=372f03317f05d4a436b0f9c39b98558ec4810b78;hp=0cd00f3fc237960b3a2628ac6ea39704a1273d99;hpb=01f46ce7ba8fe9067dff0688706986475aaec73e;p=bbtk.git diff --git a/kernel/src/bbtkInterpreter.h b/kernel/src/bbtkInterpreter.h index 0cd00f3..b878468 100644 --- a/kernel/src/bbtkInterpreter.h +++ b/kernel/src/bbtkInterpreter.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkInterpreter.h,v $ $ Language: C++ - Date: $Date: 2008/02/12 12:55:16 $ - Version: $Revision: 1.11 $ + Date: $Date: 2008/03/18 12:51:26 $ + Version: $Revision: 1.15 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -37,7 +37,10 @@ namespace bbtk { - +#ifdef _USE_WXWIDGETS_ + class WxConsole; +#endif + class BBTK_EXPORT Interpreter { @@ -94,8 +97,6 @@ namespace bbtk /// Destructor ~Interpreter(); - static Interpreter* mGlobalInterpreter; - /// Launches a command line interpreter (with a prompt) void CommandLineInterpreter(); @@ -115,8 +116,10 @@ namespace bbtk void SetDialogMode(DialogModeType t) { mExecuter->SetDialogMode(t); } /// Runs the interpretation of a file - void InterpretFile( const std::string& filename, - bool use_configuration_file=true); + void InterpretFile( const std::string& filename); + + /// Runs the interpretation of a buffer and deletes it ! + void InterpretBuffer( std::stringstream* buffer ); /// Interprets a line (either from a file or typed interactively) void InterpretLine( const std::string& line, bool &insideComment ); @@ -133,8 +136,10 @@ namespace bbtk CommandInfoType& info ); /// Switch to the interpretation of a file - void SwitchToFile( const std::string& filename, - bool use_configuration_file=true); + void SwitchToFile( const std::string& filename ); + + /// Switch to the interpretation of a stringstream + void SwitchToStream( std::stringstream* stream ); /// Closes the currently open file void CloseCurrentFile(); @@ -169,6 +174,19 @@ namespace bbtk /// Sets the bool that indicates wether we are in command line context void SetCommandLine(bool v = true) { mCommandLine = v; } +#ifdef _USE_WXWIDGETS_ + /// Sets the WxConsole that created the interpreter (if any) + void SetWxConsole(WxConsole* c) { mWxConsole = c; } + /// Gets the WxConsole that created the interpreter (if any) + WxConsole* GetWxConsole() { return mWxConsole; } + /// Gets the WxConsole that created the interpreter (if any) - const + const WxConsole* GetWxConsole() const { return mWxConsole; } +#endif + + /// Gets the Executer + VirtualExec* GetExecuter() { return mExecuter; } + /// Gets the Executer (const) + const VirtualExec* GetExecuter() const { return mExecuter; } private: @@ -182,14 +200,16 @@ namespace bbtk //================================================================== // ATTRIBUTES - /// The factory - // bbtk::Factory* mFactory; - - /// The command executer + /// The command executer used bbtk::VirtualExec* mExecuter; - /// Vector of open files - std::vector mFile; +#ifdef _USE_WXWIDGETS_ + /// The WxConsole which uses the interpreter (0 if none) + bbtk::WxConsole* mWxConsole; +#endif + + /// Vector of open files / buffers (can be stringstream) + std::vector mFile; /// Vector of names of open files with full path (as open) std::vector mFileName; @@ -209,7 +229,9 @@ namespace bbtk /// The history of commands std::deque< char* > mHistory; + int bufferNb; }; + // EO class Interpreter // The "Quit" exception