Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
elm::sys::Plugger Class Reference

#include <elm/sys/Plugger.h>

+ Inheritance diagram for elm::sys::Plugger:

Classes

class  Iterator
 
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)
 
Pluginplug (const string &path)
 
PluginplugFile (sys::Path path)
 
String hook (void) const
 
string getLastError (void)
 
virtual void onError (String message)
 
virtual void onWarning (String message)
 
error_t lastError (void)
 
String lastErrorMessage (void)
 
- Public Member Functions inherited from elm::ErrorBase
 ErrorBase (ErrorHandler *error_handler=&ErrorHandler::DEFAULT)
 
void setErrorHandler (ErrorHandler *error_handler)
 
ErrorHandlergetErrorHandler (void) const
 

Additional Inherited Members

- Protected Member Functions inherited from elm::ErrorBase
void onError (error_level_t level, const string &message)
 

Detailed Description

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.

Member Typedef Documentation

Member Enumeration Documentation

Enumerator
OK 
NO_PLUGIN 
NO_HOOK 
BAD_VERSION 
NO_MAGIC 
BAD_PLUGIN 
MISSING_DEP 

Constructor & Destructor Documentation

elm::sys::Plugger::Plugger ( CString  hook,
const Version plugger_version,
String  _paths = "*" 
)

Build a new plugger.

Parameters
hookHook name for retrieving plugin in the code unit.
plugger_versionPlugger version for compatibility checking.
_pathsList of path separated by ":" for retrieving the plugin. Pass "*" for initializing with the default system paths.

References elm::String::indexOf(), elm::sys::Path::PATH_SEPARATOR, and elm::String::substring().

elm::sys::Plugger::~Plugger ( void  )
virtual

Member Function Documentation

void elm::sys::Plugger::addPath ( String  path)

Add new path for retrieving plugins.

Parameters
pathAdded path.
string elm::sys::Plugger::getLastError ( void  )

Return the last produced error.

Returns
Last error message.
Deprecated:

References BAD_PLUGIN, BAD_VERSION, NO_HOOK, NO_MAGIC, NO_PLUGIN, OK, and elm::StringBuffer::toString().

Referenced by lastErrorMessage().

String elm::sys::Plugger::hook ( void  ) const
Plugger::error_t elm::sys::Plugger::lastError ( void  )

Get the last error.

Returns
Last error.
String elm::sys::Plugger::lastErrorMessage ( void  )

Get the message for the last error.

Returns
Error message.
Deprecated:

References getLastError().

void elm::sys::Plugger::onError ( String  message)
virtual

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.

Parameters
messageMessage of the error.
Deprecated:

References elm::cerr, and elm::io::endl.

Referenced by plugFile().

void elm::sys::Plugger::onWarning ( String  message)
virtual

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.

Parameters
messageMessage of the warning.
Deprecated:

References elm::cerr, and elm::io::endl.

Plugin * elm::sys::Plugger::plug ( const string name)

Get a plugin by its name.

Parameters
nameName of the plugin to get (possibly containing '/' to access sub-directories).
Returns
Found plugin or null.

References NO_PLUGIN, OK, elm::sys::PLUG_EXT, plugFile(), elm::String::startsWith(), and elm::StringBuffer::toString().

Referenced by plugFile().

void elm::sys::Plugger::removePath ( String  path)

Remove a path.

Parameters
pathRemoved path.
void elm::sys::Plugger::resetPaths ( void  )

Remove all paths.


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