00001 /* 00002 * The information in this file is 00003 * Copyright(c) 2010 Ball Aerospace & Technologies Corporation 00004 * and is subject to the terms and conditions of the 00005 * GNU Lesser General Public License Version 2.1 00006 * The license text is available from 00007 * http://www.gnu.org/licenses/lgpl.html 00008 */ 00009 00010 #ifndef INTERPRETERMANAGERSHELL_H 00011 #define INTERPRETERMANAGERSHELL_H 00012 00013 #include "ExecutableShell.h" 00014 #include "InterpreterManager.h" 00015 #include "SubjectImp.h" 00016 00017 #include <string> 00018 00019 /** 00020 * \ingroup ShellModule 00021 * %Interpreter Manager Shell 00022 * 00023 * This class represents the shell for an interpreter plug-in. %Interpreter 00024 * developers would take this class and extend it to support their 00025 * interpreter specific code. 00026 * 00027 * An implementation must provide the following additional methods: 00028 * - InterpreterManager::isStarted() 00029 * - InterpreterManager::start() 00030 * - InterpreterManager::getStartupMessage() 00031 * - InterpreterManager::getInterpreter() 00032 * - Executable::execute() 00033 * Your implementation of this method should attempt 00034 * to start the interpreter as part of application start-up 00035 * - All methods on Subject and its base classes 00036 * 00037 * @see ExecutableShell, InterpreterManager 00038 */ 00039 class InterpreterManagerShell : public ExecutableShell, public InterpreterManager 00040 { 00041 public: 00042 /** 00043 * Creates the interpreter plug-in. 00044 * 00045 * The constructor initializes the plug-in as follows: 00046 * - getType() returns PlugInManagerServices::InterpreterManagerType() 00047 * - getSubtype() returns an empty std::string. 00048 * - isExecutedOnStartup() returns \c true. 00049 * - isDestroyedAfterExecute() returns \c false. 00050 * - hasAbort() returns \c false. 00051 * - hasWizardSupport() returns \c false. 00052 * - areMultipleInstancesAllowed() returns \c false 00053 * - isInteractiveEnabled() returns \c true 00054 */ 00055 InterpreterManagerShell(); 00056 00057 /** 00058 * Destroys the interpreter plug-in. 00059 */ 00060 virtual ~InterpreterManagerShell(); 00061 00062 /** 00063 * @copydoc Executable::getInputSpecification() 00064 * 00065 * @default Initializes the pArgList to NULL, indicating no input arguments. 00066 */ 00067 virtual bool getInputSpecification(PlugInArgList*& pArgList); 00068 00069 /** 00070 * @copydoc Executable::getOutputSpecification() 00071 * 00072 * @default Initializes the pArgList to NULL, indicating no output arguments. 00073 */ 00074 virtual bool getOutputSpecification(PlugInArgList*& pArgList); 00075 00076 /** 00077 * @copydoc InterpreterManager::isInteractiveEnabled() 00078 * 00079 * @default Returns the last value passed into setInteractiveEnabled(). If 00080 * setInteractiveEnabled() has not yet been called, \c true will 00081 * be returned. 00082 */ 00083 virtual bool isInteractiveEnabled() const; 00084 00085 /** 00086 * @copydoc InterpreterManager::getFileExtensions() 00087 * 00088 * @default The default implementation returns the extension string that 00089 * was passed into setFileExtensions(). If setFileExtensions() 00090 * has not yet been called, an empty string is returned. 00091 */ 00092 virtual std::string getFileExtensions() const; 00093 00094 protected: 00095 /** 00096 * Sets the default scripting file extensions recognized by the interpreter. 00097 * 00098 * @param extensions 00099 * The file extensions recognized by the interpreter. The string 00100 * should consist of a description followed by one or more 00101 * extensions separated by a space. Multiple file types may 00102 * be specified with a double semicolon. Examples include 00103 * "ENVI Header Files (*.hdr)", "TIFF Files (*.tif *.tiff)", 00104 * and "Source Files (*.c*);;Header Files (*.h)". 00105 */ 00106 void setFileExtensions(const std::string& extensions); 00107 00108 /** 00109 * Sets the default interactive support for the interpreter. 00110 * 00111 * @param enabled 00112 * \c True will enable interactive support and \c false 00113 * will disable interactive support. 00114 * 00115 * @see InterpreterManager::isInteractiveEnabled() 00116 */ 00117 void setInteractiveEnabled(bool enabled); 00118 00119 private: 00120 std::string mExtensions; 00121 bool mInteractiveEnabled; 00122 }; 00123 00124 #endif