![]() |
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/sys/Plugger.h>
Inheritance diagram for Plugger:Classes | |
| class | Iter |
| class | PathIterator |
Public Types | |
| enum | error_t { OK = 0 , NO_PLUGIN , NO_HOOK , BAD_VERSION , NO_MAGIC , BAD_PLUGIN , MISSING_DEP } |
| typedef enum elm::sys::Plugger::error_t | error_t |
Public Member Functions | |
| Plugger (CString hook, const Version &plugger_version, String paths="*") | |
| virtual | ~Plugger (void) |
| void | addPath (String path) |
| void | removePath (String path) |
| void | resetPaths (void) |
| Plugin * | plug (const string &path) |
| Plugin * | plugFile (sys::Path path) |
| String | hook (void) const |
| string | getLastError (void) |
| bool | quiet (void) const |
| void | setQuiet (bool quiet) |
| bool | isPlugged (string name) const |
| virtual void | onError (String message) |
| virtual void | onWarning (String message) |
| error_t | lastError (void) |
| String | lastErrorMessage (void) |
| const Vector< string > & | paths () const |
| Range< Iter > | available () |
| const Vector< Plugin * > & | plugged () const |
Public Member Functions inherited from ErrorBase | |
| ErrorBase (ErrorHandler *error_handler=&ErrorHandler::DEFAULT) | |
| void | setErrorHandler (ErrorHandler *error_handler) |
| ErrorHandler * | getErrorHandler (void) const |
Additional Inherited Members | |
Protected Member Functions inherited from ErrorBase | |
| void | onError (error_level_t level, const string &message) |
This class is used for connecting Plugin object from dynamic loaded code unit. The Plugin object is retrieved as a global data matching the hook name passed to the plugger creation. The dynamic loaded code units are retrieved from the paths given to the plugger object. See Plugin.
| typedef enum elm::sys::Plugger::error_t error_t |
| enum error_t |
Build a new plugger.
| hook | Hook name for retrieving plugin in the code unit. |
| plugger_version | Plugger version for compatibility checking. |
| _paths | List of path separated by ":" for retrieving the plugin. Pass "*" for initializing with the default system paths. |
References Vector< T, E, A >::indexOf(), Path::PATH_SEPARATOR, and Plugger::paths().
Get the list of the names of available plug-ins (may be not already plugged).
References elm::range().
Return the last produced error.
References Plugger::BAD_PLUGIN, Plugger::BAD_VERSION, elm::io::err, Plugger::NO_HOOK, Plugger::NO_MAGIC, Plugger::NO_PLUGIN, Plugger::OK, and StringBuffer::toString().
Referenced by Plugger::lastErrorMessage().
Test if the named plug-in is plugged.
| name | Name of the plug-in. |
References elm::io::p(), and Plugger::plugged().
| Plugger::error_t lastError | ( | void | ) |
This method is called when an error arises to let the user display or not the message. As default, the message is displayed on standard error.
| message | Message of the error. |
References elm::cerr, and elm::io::endl.
Referenced by Plugger::plugFile().
This method is called when a warning arises to let the user display or not the message. As default, the message is displayed on standard error.
| message | Message of the warning. |
References elm::cerr, and elm::io::endl.
Referenced by Plugger::plugFile().
Get the list of direcory paths used to retrieve plug-ins.
Referenced by Plugger::Plugger().
Get a plugin by its name.
| name | Name of the plugin to get (possibly containing '/' to access sub-directories). |
References Plugger::NO_PLUGIN, Plugger::OK, elm::sys::PLUG_EXT, Plugger::plugFile(), String::startsWith(), and StringBuffer::toString().
Referenced by Plugger::plugFile().
Plug the given file in the plugger.
| path | Path of file to plug. |
References elm::_, Version::accepts(), Plugger::BAD_PLUGIN, Plugger::BAD_VERSION, CString::chars(), elm::io::err, Path::exists(), Path::extension(), elm::sys::fun_suffix, Path::isFile(), Path::isReadable(), elm::level_error, elm::level_warning, Plugin::MAGIC, MessageException::message(), Plugger::NO_HOOK, Plugger::NO_MAGIC, Plugger::NO_PLUGIN, Plugger::OK, Plugger::onError(), Plugger::onWarning(), Path::parent(), Plugger::plug(), elm::sys::PLUG_EXT, Plugin::pluggerVersion(), System::readFile(), Path::setExtension(), and String::toCString().
Referenced by Plugger::plug().
Referenced by Plugger::isPlugged().
Test if the plugger emit or not message error during plugin operation.
Referenced by Plugger::setQuiet().
Set the quiet mode of the plugger. If set to true, the plugger will no more emit error messages during plugin operation.
| quiet | True for quiet mode, false else. |
References Plugger::quiet().