NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
PackageManager Class Reference

This class implements the procedure plugin system. It will be a parent class of the procedure class. More...

#include <plugin.hpp>

Inheritance diagram for PackageManager:
Collaboration diagram for PackageManager:

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...
 
PackageManageroperator= (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...
 
FileSystemassign (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< PackagevPackageInfo
 
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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ PackageManager() [1/2]

PackageManager::PackageManager ( )

PluginManager default constructor.

Definition at line 404 of file plugin.cpp.

References sPluginDefinitionFile, sPluginProcName, and sPluginVarList.

◆ PackageManager() [2/2]

PackageManager::PackageManager ( const PackageManager _manager)

PluginManager copy constructor.

Parameters
_managerconst PluginManager&

Definition at line 418 of file plugin.cpp.

References assign().

Here is the call graph for this function:

◆ ~PackageManager()

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.

Member Function Documentation

◆ addHelpIndex()

void PackageManager::addHelpIndex ( const std::string &  _sPluginName,
std::string  _sHelpId 
)

This member function adds the passed documentation index ID to the plugin definition.

Parameters
_sPluginNameconst std::string&
_sHelpIdstd::string
Returns
void

Definition at line 770 of file plugin.cpp.

References StripSpaces(), updatePluginFile(), and vPackageInfo.

Referenced by Script::writeDocumentationArticle().

Here is the call graph for this function:

◆ assign()

void PackageManager::assign ( const PackageManager _manager)
private

This private member function handles the actual copy process.

Parameters
_managerconst PluginManager&
Returns
void

Definition at line 432 of file plugin.cpp.

References vPackageInfo.

Referenced by operator=(), and PackageManager().

◆ declareNewPackage()

bool PackageManager::declareNewPackage ( const std::string &  sInstallInfoString)

This member function declares a new plugin from the passed install information string.

Parameters
sInstallInfoStringconst std::string&
Returns
bool

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

Here is the call graph for this function:

◆ deletePackage()

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.

Parameters
sPackageconst std::string&
Returns
std::string

Definition at line 857 of file plugin.cpp.

References NumeReKernel::getInstance(), NumeReKernel::refreshFunctionTree(), updatePluginFile(), and vPackageInfo.

Referenced by NumeReKernel::uninstallPlugin().

Here is the call graph for this function:

◆ evalPluginCmd()

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.

Parameters
sCmdstd::string&
Returns
bool

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

Here is the call graph for this function:

◆ getMenuMap()

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.

Returns
std::map<std::string, std::string>

Definition at line 892 of file plugin.cpp.

References vPackageInfo.

Referenced by NumeReKernel::getMenuMap().

◆ getPackageAuthor()

std::string PackageManager::getPackageAuthor ( unsigned int  i = 0) const
inline

Returns the author of the ith plugin.

Parameters
iunsigned int
Returns
std::string

Definition at line 272 of file plugin.hpp.

References vPackageInfo.

Referenced by listInstalledPlugins().

◆ getPackageCount()

unsigned int PackageManager::getPackageCount ( ) const
inline

Returns the number of installed plugins.

Returns
unsigned int

Definition at line 146 of file plugin.hpp.

References vPackageInfo.

Referenced by NumeReKernel::getPluginCommands(), NumeReKernel::getPluginLanguageStrings(), and listInstalledPlugins().

◆ getPackageDescription()

std::string PackageManager::getPackageDescription ( unsigned int  i = 0) const
inline

Returns the description of the ith plugin.

Parameters
unsignedint i = 0
Returns
std::string

Definition at line 288 of file plugin.hpp.

References vPackageInfo.

Referenced by NumeReKernel::getPluginLanguageStrings(), and listInstalledPlugins().

◆ getPackageLicense()

std::string PackageManager::getPackageLicense ( unsigned int  i = 0) const
inline

Returns the license information of the ith plugin.

Parameters
unsignedint i = 0
Returns
std::string

Definition at line 304 of file plugin.hpp.

References vPackageInfo.

Referenced by listInstalledPlugins().

◆ getPackageName()

std::string PackageManager::getPackageName ( unsigned int  i = 0) const
inline

Returns the plugin name of the ith plugin.

Parameters
iunsigned int
Returns
std::string

Definition at line 241 of file plugin.hpp.

References vPackageInfo.

Referenced by listInstalledPlugins().

◆ getPackages()

const std::vector< Package > & PackageManager::getPackages ( ) const
inline

Returns a const reference to the currently installed packages.

Returns
const std::vector<Package>&

Definition at line 159 of file plugin.hpp.

References vPackageInfo.

Referenced by NumeReKernel::getInstalledPackages().

◆ getPackageVersion()

std::string PackageManager::getPackageVersion ( unsigned int  i = 0) const
inline

Returns the version number string of the ith plugin.

Parameters
iunsigned int
Returns
std::string

Definition at line 257 of file plugin.hpp.

References vPackageInfo.

Referenced by listInstalledPlugins().

◆ getPluginCommand()

std::string PackageManager::getPluginCommand ( unsigned int  i = 0) const
inline

Returns the plugin command of the ith plugin.

Parameters
iunsigned int i
Returns
std::string

Definition at line 209 of file plugin.hpp.

References vPackageInfo.

Referenced by NumeReKernel::getPluginCommands(), NumeReKernel::getPluginLanguageStrings(), and listInstalledPlugins().

◆ getPluginCommandSignature()

std::string PackageManager::getPluginCommandSignature ( unsigned int  i = 0) const
inline

Returns the plugin command signature of the ith plugin.

Parameters
iunsigned int i
Returns
std::string

Definition at line 225 of file plugin.hpp.

References vPackageInfo.

Referenced by NumeReKernel::getPluginLanguageStrings(), and listInstalledPlugins().

◆ getPluginInfoPath()

std::string PackageManager::getPluginInfoPath ( )

This member function simply returns the plugin definition file path.

Returns
std::string

Definition at line 913 of file plugin.cpp.

References sPluginDefinitionFile, and FileSystem::ValidFileName().

Referenced by NumeReKernel::StartUp().

Here is the call graph for this function:

◆ getPluginMenuEntry()

std::string PackageManager::getPluginMenuEntry ( unsigned int  i = 0) const
inline

Returns the menu entry of the ith plugin.

Parameters
unsignedint i = 0
Returns
std::string

Definition at line 320 of file plugin.hpp.

References vPackageInfo.

◆ getPluginNames()

std::string PackageManager::getPluginNames ( ) const
inline

Returns the names of the installed plugins.

Returns
std::string

Definition at line 171 of file plugin.hpp.

References vPackageInfo.

Referenced by NumeReKernel::evaluateStrings(), NumeReKernel::handleFlowControls(), NumeReKernel::MainLoop(), and NumeReKernel::StartUp().

◆ getPluginProcName()

std::string PackageManager::getPluginProcName ( ) const
inline

Returns the current plugin's procedure name.

Returns
std::string

Definition at line 188 of file plugin.hpp.

References sPluginProcName.

Referenced by NumeReKernel::executePlugins().

◆ getPluginVarList()

std::string PackageManager::getPluginVarList ( ) const
inline

Returns the current plugin's procedure argument list.

Returns
std::string

Definition at line 198 of file plugin.hpp.

References sPluginVarList.

Referenced by NumeReKernel::executePlugins().

◆ isPluginCmd()

bool PackageManager::isPluginCmd ( const std::string &  sCmd) const

This member function determines, whether the passed command line contains a plugin command.

Parameters
sCmdconst std::string&
Returns
bool

Definition at line 829 of file plugin.cpp.

References findCommand(), and vPackageInfo.

Referenced by NumeReKernel::executePlugins().

Here is the call graph for this function:

◆ loadPlugins()

bool PackageManager::loadPlugins ( )

This member function will read the plugin definitions from the definitions file and create the internal representations.

Returns
bool

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

Here is the call graph for this function:

◆ operator=()

PackageManager & PackageManager::operator= ( const PackageManager _manager)

This is the overload for the assignment operator.

Parameters
_managerconst PluginManager&
Returns
PluginManager&

Definition at line 457 of file plugin.cpp.

References assign().

Here is the call graph for this function:

◆ updatePluginFile()

void PackageManager::updatePluginFile ( )
private

This member function will update the plugin definition file with the internal plugin definitions.

Returns
void

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

Here is the call graph for this function:

Member Data Documentation

◆ fPlugins

std::fstream PackageManager::fPlugins
private

Definition at line 117 of file plugin.hpp.

Referenced by loadPlugins(), updatePluginFile(), and ~PackageManager().

◆ sPluginDefinitionFile

std::string PackageManager::sPluginDefinitionFile
private

Definition at line 119 of file plugin.hpp.

Referenced by getPluginInfoPath(), loadPlugins(), PackageManager(), and updatePluginFile().

◆ sPluginProcName

std::string PackageManager::sPluginProcName
private

Definition at line 121 of file plugin.hpp.

Referenced by evalPluginCmd(), getPluginProcName(), and PackageManager().

◆ sPluginVarList

std::string PackageManager::sPluginVarList
private

Definition at line 122 of file plugin.hpp.

Referenced by evalPluginCmd(), getPluginVarList(), and PackageManager().

◆ vPackageInfo


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