TuttleOFX
1
|
#include <OfxhPluginCache.hpp>
Public Types | |
typedef OfxhPluginCache | This |
typedef boost::ptr_list < OfxhPluginBinary > | OfxhPluginBinaryList |
Public Member Functions | |
OfxhPluginCache () | |
ctor, which inits _pluginPath to default locations and not much else | |
~OfxhPluginCache () | |
dtor | |
OfxhPlugin * | getPluginById (const std::string &id, int vermaj=-1, int vermin=-1) |
const OfxhPlugin * | getPluginById (const std::string &id, int vermaj=-1, int vermin=-1) const |
const std::list< std::string > & | getPluginPath () const |
get the list in which plugins are sought | |
bool | isDirty () const |
was the cache outdated? | |
void | setDirty () |
void | addDirectoryToPath (const std::string &f, bool recurse=true) |
add a directory to the plugin path | |
void | setPluginHostPath (const std::string &hostId) |
void | setCacheVersion (const std::string &cacheVersion) |
std::string | seekPluginFile (const std::string &baseName) const |
void | setPluginSeekEnabled (bool enabled) |
void | scanPluginFiles () |
scan for plugins | |
void | clearPluginFiles () |
Remove all plugins. | |
void | registerAPICache (APICache::OfxhPluginAPICacheI &apiCache) |
register an API cache handler | |
APICache::OfxhPluginAPICacheI * | findApiHandler (const std::string &api, int apiver) |
find the API cache handler for the given api/apiverson | |
const std::list< OfxhPlugin * > & | getPlugins () const |
obtain a list of plugins to walk through | |
OfxhPluginBinaryList & | getBinaries () |
Protected Member Functions | |
void | scanDirectory (std::set< std::string > &foundBinFiles, const std::string &dir, bool recurse) |
void | addPlugin (OfxhPlugin *plugin) |
Protected Attributes | |
std::list< std::string > | _pluginPath |
list of directories to look in | |
std::set< std::string > | _nonrecursePath |
list of directories to look in (non-recursively) | |
std::list< std::string > | _pluginDirs |
list of directories we found | |
OfxhPluginBinaryList | _binaries |
all the binaries we know about, we own these | |
std::list< OfxhPlugin * > | _plugins |
all the plugins inside the binaries, we don't own these, populated from _binaries | |
std::map< std::string, OfxhPlugin * > | _pluginsByID |
std::map< OfxhPluginIdent, bool > | _loadedMap |
Used to check if a plugin is loaded twice. | |
std::set< std::string > | _knownBinFiles |
std::list < PluginCacheSupportedApi > | _apiHandlers |
bool | _ignoreCache |
std::string | _cacheVersion |
bool | _dirty |
bool | _enablePluginSeek |
Turn off to make all seekPluginFile() calls return an empty string. | |
Private Member Functions | |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Friends | |
class | boost::serialization::access |
std::ostream & | operator<< (std::ostream &os, const This &g) |
Where we keep our plugins.
Definition at line 58 of file OfxhPluginCache.hpp.
typedef boost::ptr_list<OfxhPluginBinary> tuttle::host::ofx::OfxhPluginCache::OfxhPluginBinaryList |
Definition at line 62 of file OfxhPluginCache.hpp.
Definition at line 61 of file OfxhPluginCache.hpp.
tuttle::host::ofx::OfxhPluginCache::OfxhPluginCache | ( | ) |
ctor, which inits _pluginPath to default locations and not much else
Definition at line 160 of file OfxhPluginCache.cpp.
References _pluginPath, DIRLIST_SEP_CHARS, and tuttle::host::ofx::OFXGetEnv().
tuttle::host::ofx::OfxhPluginCache::~OfxhPluginCache | ( | ) |
dtor
Definition at line 200 of file OfxhPluginCache.cpp.
void tuttle::host::ofx::OfxhPluginCache::addDirectoryToPath | ( | const std::string & | f, |
bool | recurse = true |
||
) | [inline] |
add a directory to the plugin path
Definition at line 123 of file OfxhPluginCache.hpp.
References _nonrecursePath, and _pluginPath.
Referenced by BOOST_AUTO_TEST_CASE(), and tuttle::host::PreloadPlugins::PreloadPlugins().
void tuttle::host::ofx::OfxhPluginCache::addPlugin | ( | OfxhPlugin * | plugin | ) | [protected] |
Definition at line 339 of file OfxhPluginCache.cpp.
References _loadedMap, _plugins, _pluginsByID, tuttle::host::ofx::OfxhPlugin::getBinary(), tuttle::host::ofx::OfxhPluginBinary::getFilePath(), tuttle::host::ofx::OfxhPluginDesc::getIdentifier(), tuttle::host::ofx::OfxhPluginDesc::getIdentity(), tuttle::host::ofx::OfxhPluginDesc::getRawIdentifier(), tuttle::host::ofx::OfxhPlugin::trumps(), and TUTTLE_LOG_INFO.
Referenced by scanPluginFiles().
void tuttle::host::ofx::OfxhPluginCache::clearPluginFiles | ( | ) |
Remove all plugins.
Definition at line 468 of file OfxhPluginCache.cpp.
References _binaries, _knownBinFiles, _loadedMap, _plugins, _pluginsByID, and setDirty().
Referenced by tuttle::host::Core::preload().
APICache::OfxhPluginAPICacheI * tuttle::host::ofx::OfxhPluginCache::findApiHandler | ( | const std::string & | api, |
int | apiver | ||
) |
find the API cache handler for the given api/apiverson
Definition at line 484 of file OfxhPluginCache.cpp.
References _apiHandlers.
Referenced by tuttle::host::ofx::OfxhPluginBinary::loadPluginInfo(), and serialize().
OfxhPluginBinaryList& tuttle::host::ofx::OfxhPluginCache::getBinaries | ( | ) | [inline] |
Definition at line 174 of file OfxhPluginCache.hpp.
References _binaries.
OfxhPlugin * tuttle::host::ofx::OfxhPluginCache::getPluginById | ( | const std::string & | id, |
int | vermaj = -1 , |
||
int | vermin = -1 |
||
) |
get the plugin by id. vermaj and vermin can be specified. if they are not it will pick the highest found version.
Definition at line 502 of file OfxhPluginCache.cpp.
References _plugins, _pluginsByID, tuttle::host::ofx::OfxhPluginDesc::getIdentifier(), tuttle::host::ofx::OfxhPluginDesc::getVersionMajor(), tuttle::host::ofx::OfxhPluginDesc::getVersionMinor(), and tuttle::host::ofx::OfxhPlugin::trumps().
Referenced by getPluginById(), and tuttle::host::Core::operator[]().
const OfxhPlugin* tuttle::host::ofx::OfxhPluginCache::getPluginById | ( | const std::string & | id, |
int | vermaj = -1 , |
||
int | vermin = -1 |
||
) | const [inline] |
Definition at line 102 of file OfxhPluginCache.hpp.
References getPluginById().
const std::list<std::string>& tuttle::host::ofx::OfxhPluginCache::getPluginPath | ( | ) | const [inline] |
get the list in which plugins are sought
Definition at line 105 of file OfxhPluginCache.hpp.
References _pluginPath.
const std::list<OfxhPlugin*>& tuttle::host::ofx::OfxhPluginCache::getPlugins | ( | ) | const [inline] |
obtain a list of plugins to walk through
Definition at line 169 of file OfxhPluginCache.hpp.
References _plugins.
Referenced by tuttle::host::Core::getPlugins().
bool tuttle::host::ofx::OfxhPluginCache::isDirty | ( | ) | const [inline] |
was the cache outdated?
Definition at line 111 of file OfxhPluginCache.hpp.
References _dirty.
Referenced by tuttle::host::Core::preload().
void tuttle::host::ofx::OfxhPluginCache::registerAPICache | ( | APICache::OfxhPluginAPICacheI & | apiCache | ) |
register an API cache handler
Definition at line 479 of file OfxhPluginCache.cpp.
References _apiHandlers.
Referenced by tuttle::host::Core::Core().
void tuttle::host::ofx::OfxhPluginCache::scanDirectory | ( | std::set< std::string > & | foundBinFiles, |
const std::string & | dir, | ||
bool | recurse | ||
) | [protected] |
Definition at line 217 of file OfxhPluginCache.cpp.
References _binaries, _knownBinFiles, _pluginDirs, DIRSEP, tuttle::host::ofx::OfxhPlugin::getApiHandler(), tuttle::host::ofx::OfxhPluginDesc::getIdentifier(), tuttle::host::ofx::OfxhPluginBinary::getNPlugins(), tuttle::host::ofx::OfxhPluginBinary::getPlugin(), tuttle::host::ofx::OfxhPluginDesc::getVersionMajor(), tuttle::host::ofx::OfxhPluginDesc::getVersionMinor(), tuttle::host::ofx::APICache::OfxhPluginAPICacheI::loadFromPlugin(), tuttle::quotes(), setDirty(), TUTTLE_LOG_INFO, and TUTTLE_LOG_TRACE.
Referenced by scanPluginFiles().
void tuttle::host::ofx::OfxhPluginCache::scanPluginFiles | ( | ) |
scan for plugins
Definition at line 387 of file OfxhPluginCache.cpp.
References _binaries, _nonrecursePath, _pluginPath, addPlugin(), tuttle::host::ofx::APICache::OfxhPluginAPICacheI::confirmPlugin(), tuttle::host::ofx::OfxhPlugin::getApiHandler(), tuttle::host::ofx::OfxhPluginDesc::getIdentifier(), tuttle::host::ofx::APICache::OfxhPluginAPICacheI::loadFromPlugin(), tuttle::host::ofx::APICache::OfxhPluginAPICacheI::pluginSupported(), tuttle::quotes(), scanDirectory(), setDirty(), TUTTLE_LOG_INFO, and TUTTLE_LOG_TRACE.
Referenced by tuttle::host::Core::preload().
std::string tuttle::host::ofx::OfxhPluginCache::seekPluginFile | ( | const std::string & | baseName | ) | const |
Definition at line 366 of file OfxhPluginCache.cpp.
References _enablePluginSeek, _pluginDirs, and DIRSEP.
void tuttle::host::ofx::OfxhPluginCache::serialize | ( | Archive & | ar, |
const unsigned int | version | ||
) | [inline, private] |
Definition at line 182 of file OfxhPluginCache.hpp.
References _binaries, _knownBinFiles, _plugins, findApiHandler(), tuttle::host::ofx::OfxhPluginDesc::getApiVersion(), tuttle::host::ofx::OfxhPluginBinary::getFilePath(), tuttle::host::ofx::OfxhPluginDesc::getPluginApi(), tuttle::host::ofx::OfxhPluginBinary::getPlugins(), and tuttle::host::ofx::OfxhPlugin::setApiHandler().
void tuttle::host::ofx::OfxhPluginCache::setCacheVersion | ( | const std::string & | cacheVersion | ) | [inline] |
set the version string to write to the cache, and also that we expect on cachess read in
Definition at line 138 of file OfxhPluginCache.hpp.
References _cacheVersion.
Referenced by tuttle::host::Core::Core().
void tuttle::host::ofx::OfxhPluginCache::setDirty | ( | ) | [inline] |
Definition at line 116 of file OfxhPluginCache.hpp.
References _dirty.
Referenced by clearPluginFiles(), scanDirectory(), and scanPluginFiles().
void tuttle::host::ofx::OfxhPluginCache::setPluginHostPath | ( | const std::string & | hostId | ) |
specify which subdirectory of /usr/OFX or equivilant (as well as 'Plugins') to look in for plugins.
Definition at line 203 of file OfxhPluginCache.cpp.
References _pluginPath.
void tuttle::host::ofx::OfxhPluginCache::setPluginSeekEnabled | ( | bool | enabled | ) | [inline] |
Sets behaviour of seekPluginFile(). Enable (the default): normal operation; disable: returns an empty string instead
Definition at line 151 of file OfxhPluginCache.hpp.
References _enablePluginSeek.
friend class boost::serialization::access [friend] |
Definition at line 180 of file OfxhPluginCache.hpp.
std::ostream& operator<< | ( | std::ostream & | os, |
const This & | g | ||
) | [friend] |
Definition at line 537 of file OfxhPluginCache.cpp.
std::list<PluginCacheSupportedApi> tuttle::host::ofx::OfxhPluginCache::_apiHandlers [protected] |
Definition at line 75 of file OfxhPluginCache.hpp.
Referenced by findApiHandler(), and registerAPICache().
all the binaries we know about, we own these
Definition at line 69 of file OfxhPluginCache.hpp.
Referenced by clearPluginFiles(), getBinaries(), scanDirectory(), scanPluginFiles(), and serialize().
std::string tuttle::host::ofx::OfxhPluginCache::_cacheVersion [protected] |
Definition at line 79 of file OfxhPluginCache.hpp.
Referenced by setCacheVersion().
bool tuttle::host::ofx::OfxhPluginCache::_dirty [protected] |
Definition at line 80 of file OfxhPluginCache.hpp.
Referenced by isDirty(), and setDirty().
bool tuttle::host::ofx::OfxhPluginCache::_enablePluginSeek [protected] |
Turn off to make all seekPluginFile() calls return an empty string.
Definition at line 81 of file OfxhPluginCache.hpp.
Referenced by seekPluginFile(), and setPluginSeekEnabled().
bool tuttle::host::ofx::OfxhPluginCache::_ignoreCache [protected] |
Definition at line 78 of file OfxhPluginCache.hpp.
std::set<std::string> tuttle::host::ofx::OfxhPluginCache::_knownBinFiles [protected] |
Definition at line 73 of file OfxhPluginCache.hpp.
Referenced by clearPluginFiles(), scanDirectory(), and serialize().
std::map<OfxhPluginIdent, bool> tuttle::host::ofx::OfxhPluginCache::_loadedMap [protected] |
Used to check if a plugin is loaded twice.
Definition at line 72 of file OfxhPluginCache.hpp.
Referenced by addPlugin(), and clearPluginFiles().
std::set<std::string> tuttle::host::ofx::OfxhPluginCache::_nonrecursePath [protected] |
list of directories to look in (non-recursively)
Definition at line 66 of file OfxhPluginCache.hpp.
Referenced by addDirectoryToPath(), and scanPluginFiles().
std::list<std::string> tuttle::host::ofx::OfxhPluginCache::_pluginDirs [protected] |
list of directories we found
Definition at line 67 of file OfxhPluginCache.hpp.
Referenced by scanDirectory(), and seekPluginFile().
std::list<std::string> tuttle::host::ofx::OfxhPluginCache::_pluginPath [protected] |
list of directories to look in
Definition at line 65 of file OfxhPluginCache.hpp.
Referenced by addDirectoryToPath(), getPluginPath(), OfxhPluginCache(), scanPluginFiles(), and setPluginHostPath().
std::list<OfxhPlugin*> tuttle::host::ofx::OfxhPluginCache::_plugins [protected] |
all the plugins inside the binaries, we don't own these, populated from _binaries
Definition at line 70 of file OfxhPluginCache.hpp.
Referenced by addPlugin(), clearPluginFiles(), getPluginById(), getPlugins(), and serialize().
std::map<std::string, OfxhPlugin*> tuttle::host::ofx::OfxhPluginCache::_pluginsByID [protected] |
Definition at line 71 of file OfxhPluginCache.hpp.
Referenced by addPlugin(), clearPluginFiles(), getPluginById(), and tuttle::host::ofx::operator<<().