NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
This class implements the procedure plugin system. It will be a parent class of the procedure class. More...
#include <plugin.hpp>
Public Member Functions | |
PackageManager () | |
PluginManager default constructor. More... | |
PackageManager (const PackageManager &_manager) | |
PluginManager copy constructor. More... | |
~PackageManager () | |
PluginManager destructor. Will close the internal file stream if it is still open. More... | |
PackageManager & | operator= (const PackageManager &_manager) |
This is the overload for the assignment operator. More... | |
bool | loadPlugins () |
This member function will read the plugin definitions from the definitions file and create the internal representations. More... | |
bool | evalPluginCmd (std::string &sCmd) |
This member function converts the call to a plugin in the passed command line into a call to the corresponding plugin main procedure. More... | |
bool | declareNewPackage (const std::string &sInstallInfoString) |
This member function declares a new plugin from the passed install information string. More... | |
bool | isPluginCmd (const std::string &sCmd) const |
This member function determines, whether the passed command line contains a plugin command. More... | |
std::string | deletePackage (const std::string &sPackage) |
This member function deletes the plugin with the passed name from the internal set of definitions and returns the stored documentation index IDs. More... | |
std::map< std::string, std::string > | getMenuMap () const |
Returns the menu map connecting menu entry names with their corresponding procedure, which shall be called. More... | |
unsigned int | getPackageCount () const |
Returns the number of installed plugins. More... | |
std::string | getPluginInfoPath () |
This member function simply returns the plugin definition file path. More... | |
void | addHelpIndex (const std::string &_sPluginName, std::string _sHelpId) |
This member function adds the passed documentation index ID to the plugin definition. More... | |
const std::vector< Package > & | getPackages () const |
Returns a const reference to the currently installed packages. More... | |
std::string | getPluginNames () const |
Returns the names of the installed plugins. More... | |
std::string | getPluginProcName () const |
Returns the current plugin's procedure name. More... | |
std::string | getPluginVarList () const |
Returns the current plugin's procedure argument list. More... | |
std::string | getPluginCommand (unsigned int i=0) const |
Returns the plugin command of the ith plugin. More... | |
std::string | getPluginCommandSignature (unsigned int i=0) const |
Returns the plugin command signature of the ith plugin. More... | |
std::string | getPackageName (unsigned int i=0) const |
Returns the plugin name of the ith plugin. More... | |
std::string | getPackageVersion (unsigned int i=0) const |
Returns the version number string of the ith plugin. More... | |
std::string | getPackageAuthor (unsigned int i=0) const |
Returns the author of the ith plugin. More... | |
std::string | getPackageDescription (unsigned int i=0) const |
Returns the description of the ith plugin. More... | |
std::string | getPackageLicense (unsigned int i=0) const |
Returns the license information of the ith plugin. More... | |
std::string | getPluginMenuEntry (unsigned int i=0) const |
Returns the menu entry of the ith plugin. More... | |
Public Member Functions inherited from FileSystem | |
FileSystem () | |
Default constructor. More... | |
FileSystem & | assign (const FileSystem &_fSys) |
Assignment member function to copy the settings from another FileSystem instance. More... | |
std::string | ValidFileName (std::string _sFileName, const std::string sExtension=".dat", bool checkExtension=true, bool doCleanPath=true) const |
This member function evaluates, whether the passed filename is a valid filename. One may supply a preferred filename extension. More... | |
std::string | ValidFolderName (std::string _sFileName, bool doCleanPath=true, bool appendTrailingSeparator=true) const |
This member function evaluates, whether the passed foldername is a valid foldername. More... | |
std::string | ValidizeAndPrepareName (const std::string &_sFileName, const std::string &sExtension=".dat") const |
This member function validizes the passed file name and creates the needed folders on-the-fly. More... | |
int | setPath (std::string _sPath, bool bMkDir, std::string _sExePath) |
This member function may be used to set the preferred file path of the current FileSystem instance. More... | |
void | createRevisionsFolder () |
This member function creates the hidden revisions folders for the version control system. More... | |
std::string | getPath () const |
Returns the default path of this FileSystem instance. More... | |
std::vector< std::string > | getFileParts (const std::string &sFilePath) const |
This member function separates all path parts into single strings: the drive letter, the path, the name and the extension. This function may also handle folder paths and network paths. More... | |
FileInfo | getFileInfo (const std::string &sFilePath) const |
Return the file information about the passed file path. More... | |
void | setTokens (std::string _sTokens) |
This member function may be used to update the path placeholders of the current FileSystem instance. More... | |
bool | isFile (const std::string &_sPath) const |
This function determines, whether a path name indicates a file or a folder. More... | |
void | initializeFromKernel () |
Member function to remote-initialize the class from the kernel. Cannot be used during kernel start-up. More... | |
void | setProgramPath (std::string _sExePath) |
std::string | getProgramPath () const |
void | declareFileType (const std::string &sFileType) |
Private Member Functions | |
void | assign (const PackageManager &_manager) |
This private member function handles the actual copy process. More... | |
void | updatePluginFile () |
This member function will update the plugin definition file with the internal plugin definitions. More... | |
Private Attributes | |
std::fstream | fPlugins |
std::vector< Package > | vPackageInfo |
std::string | sPluginDefinitionFile |
std::string | sPluginProcName |
std::string | sPluginVarList |
Additional Inherited Members | |
Protected Member Functions inherited from FileSystem | |
int | createFolders (const std::string &_sPath) const |
This member function creates all missing directories in the passed path. More... | |
Protected Attributes inherited from FileSystem | |
std::string | sPath |
std::string | sExecutablePath |
std::string | sTokens [7][2] |
std::string | sValidExtensions |
This class implements the procedure plugin system. It will be a parent class of the procedure class.
The plugin system is represented by dedicated NumeRe procedures, which one has to declare during plugin installation. This class will redirect the control to this dedicated "main" procedure once the plugin keyword has been found.
Definition at line 114 of file plugin.hpp.
PackageManager::PackageManager | ( | ) |
PluginManager default constructor.
Definition at line 404 of file plugin.cpp.
References sPluginDefinitionFile, sPluginProcName, and sPluginVarList.
PackageManager::PackageManager | ( | const PackageManager & | _manager | ) |
PluginManager copy constructor.
_manager | const PluginManager& |
Definition at line 418 of file plugin.cpp.
References assign().
PackageManager::~PackageManager | ( | ) |
PluginManager destructor. Will close the internal file stream if it is still open.
Definition at line 442 of file plugin.cpp.
References fPlugins.
void PackageManager::addHelpIndex | ( | const std::string & | _sPluginName, |
std::string | _sHelpId | ||
) |
This member function adds the passed documentation index ID to the plugin definition.
_sPluginName | const std::string& |
_sHelpId | std::string |
Definition at line 770 of file plugin.cpp.
References StripSpaces(), updatePluginFile(), and vPackageInfo.
Referenced by Script::writeDocumentationArticle().
|
private |
This private member function handles the actual copy process.
_manager | const PluginManager& |
Definition at line 432 of file plugin.cpp.
References vPackageInfo.
Referenced by operator=(), and PackageManager().
bool PackageManager::declareNewPackage | ( | const std::string & | sInstallInfoString | ) |
This member function declares a new plugin from the passed install information string.
sInstallInfoString | const std::string& |
Definition at line 664 of file plugin.cpp.
References findParameter(), getArgAtPos(), NumeReKernel::getInstance(), Package::getName(), SyntaxError::invalid_position, Package::isPlugin(), SyntaxError::PLUGIN_HAS_NO_CMD, SyntaxError::PLUGIN_HAS_NO_MAIN, SyntaxError::PLUGIN_MAY_NOT_OVERRIDE, SyntaxError::PLUGINCMD_ALREADY_EXISTS, SyntaxError::PLUGINNAME_ALREADY_EXISTS, NumeReKernel::refreshFunctionTree(), Package::sCommand, Package::sMainProcedure, Package::sName, updatePluginFile(), and vPackageInfo.
Referenced by Script::handleInstallInformation(), and NumeReTerminal::updatePackage().
std::string PackageManager::deletePackage | ( | const std::string & | sPackage | ) |
This member function deletes the plugin with the passed name from the internal set of definitions and returns the stored documentation index IDs.
sPackage | const std::string& |
Definition at line 857 of file plugin.cpp.
References NumeReKernel::getInstance(), NumeReKernel::refreshFunctionTree(), updatePluginFile(), and vPackageInfo.
Referenced by NumeReKernel::uninstallPlugin().
bool PackageManager::evalPluginCmd | ( | std::string & | sCmd | ) |
This member function converts the call to a plugin in the passed command line into a call to the corresponding plugin main procedure.
sCmd | std::string& |
Definition at line 544 of file plugin.cpp.
References extractCommandString(), findCommand(), Match::nPos, Package::sArgumentList, Package::sCommand, Package::sMainProcedure, sPluginProcName, sPluginVarList, StripSpaces(), Package::sType, and vPackageInfo.
Referenced by NumeReKernel::executePlugins().
std::map< std::string, std::string > PackageManager::getMenuMap | ( | ) | const |
Returns the menu map connecting menu entry names with their corresponding procedure, which shall be called.
Definition at line 892 of file plugin.cpp.
References vPackageInfo.
Referenced by NumeReKernel::getMenuMap().
|
inline |
Returns the author of the ith plugin.
i | unsigned int |
Definition at line 272 of file plugin.hpp.
References vPackageInfo.
Referenced by listInstalledPlugins().
|
inline |
Returns the number of installed plugins.
Definition at line 146 of file plugin.hpp.
References vPackageInfo.
Referenced by NumeReKernel::getPluginCommands(), NumeReKernel::getPluginLanguageStrings(), and listInstalledPlugins().
|
inline |
Returns the description of the ith plugin.
unsigned | int i = 0 |
Definition at line 288 of file plugin.hpp.
References vPackageInfo.
Referenced by NumeReKernel::getPluginLanguageStrings(), and listInstalledPlugins().
|
inline |
Returns the license information of the ith plugin.
unsigned | int i = 0 |
Definition at line 304 of file plugin.hpp.
References vPackageInfo.
Referenced by listInstalledPlugins().
|
inline |
Returns the plugin name of the ith plugin.
i | unsigned int |
Definition at line 241 of file plugin.hpp.
References vPackageInfo.
Referenced by listInstalledPlugins().
|
inline |
Returns a const reference to the currently installed packages.
Definition at line 159 of file plugin.hpp.
References vPackageInfo.
Referenced by NumeReKernel::getInstalledPackages().
|
inline |
Returns the version number string of the ith plugin.
i | unsigned int |
Definition at line 257 of file plugin.hpp.
References vPackageInfo.
Referenced by listInstalledPlugins().
|
inline |
Returns the plugin command of the ith plugin.
i | unsigned int i |
Definition at line 209 of file plugin.hpp.
References vPackageInfo.
Referenced by NumeReKernel::getPluginCommands(), NumeReKernel::getPluginLanguageStrings(), and listInstalledPlugins().
|
inline |
Returns the plugin command signature of the ith plugin.
i | unsigned int i |
Definition at line 225 of file plugin.hpp.
References vPackageInfo.
Referenced by NumeReKernel::getPluginLanguageStrings(), and listInstalledPlugins().
std::string PackageManager::getPluginInfoPath | ( | ) |
This member function simply returns the plugin definition file path.
Definition at line 913 of file plugin.cpp.
References sPluginDefinitionFile, and FileSystem::ValidFileName().
Referenced by NumeReKernel::StartUp().
|
inline |
Returns the menu entry of the ith plugin.
unsigned | int i = 0 |
Definition at line 320 of file plugin.hpp.
References vPackageInfo.
|
inline |
Returns the names of the installed plugins.
Definition at line 171 of file plugin.hpp.
References vPackageInfo.
Referenced by NumeReKernel::evaluateStrings(), NumeReKernel::handleFlowControls(), NumeReKernel::MainLoop(), and NumeReKernel::StartUp().
|
inline |
Returns the current plugin's procedure name.
Definition at line 188 of file plugin.hpp.
References sPluginProcName.
Referenced by NumeReKernel::executePlugins().
|
inline |
Returns the current plugin's procedure argument list.
Definition at line 198 of file plugin.hpp.
References sPluginVarList.
Referenced by NumeReKernel::executePlugins().
bool PackageManager::isPluginCmd | ( | const std::string & | sCmd | ) | const |
This member function determines, whether the passed command line contains a plugin command.
sCmd | const std::string& |
Definition at line 829 of file plugin.cpp.
References findCommand(), and vPackageInfo.
Referenced by NumeReKernel::executePlugins().
bool PackageManager::loadPlugins | ( | ) |
This member function will read the plugin definitions from the definitions file and create the internal representations.
Definition at line 501 of file plugin.cpp.
References SyntaxError::CANNOT_READ_FILE, fPlugins, SyntaxError::invalid_position, sPluginDefinitionFile, StripSpaces(), FileSystem::ValidFileName(), and vPackageInfo.
Referenced by NumeReKernel::StartUp().
PackageManager & PackageManager::operator= | ( | const PackageManager & | _manager | ) |
This is the overload for the assignment operator.
_manager | const PluginManager& |
Definition at line 457 of file plugin.cpp.
References assign().
|
private |
This member function will update the plugin definition file with the internal plugin definitions.
Definition at line 472 of file plugin.cpp.
References SyntaxError::CANNOT_READ_FILE, fPlugins, SyntaxError::invalid_position, sPluginDefinitionFile, date::detail::trunc(), FileSystem::ValidFileName(), and vPackageInfo.
Referenced by addHelpIndex(), declareNewPackage(), and deletePackage().
|
private |
Definition at line 117 of file plugin.hpp.
Referenced by loadPlugins(), updatePluginFile(), and ~PackageManager().
|
private |
Definition at line 119 of file plugin.hpp.
Referenced by getPluginInfoPath(), loadPlugins(), PackageManager(), and updatePluginFile().
|
private |
Definition at line 121 of file plugin.hpp.
Referenced by evalPluginCmd(), getPluginProcName(), and PackageManager().
|
private |
Definition at line 122 of file plugin.hpp.
Referenced by evalPluginCmd(), getPluginVarList(), and PackageManager().
|
private |
Definition at line 118 of file plugin.hpp.
Referenced by addHelpIndex(), assign(), declareNewPackage(), deletePackage(), evalPluginCmd(), getMenuMap(), getPackageAuthor(), getPackageCount(), getPackageDescription(), getPackageLicense(), getPackageName(), getPackages(), getPackageVersion(), getPluginCommand(), getPluginCommandSignature(), getPluginMenuEntry(), getPluginNames(), isPluginCmd(), loadPlugins(), and updatePluginFile().