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 () |
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 | 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 | |
tuttle::host::ofx::property::OfxhPropSpec * | _hostSpec |
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 76 of file OfxhPluginCache.hpp.
typedef boost::ptr_list<OfxhPluginBinary> tuttle::host::ofx::OfxhPluginCache::OfxhPluginBinaryList |
Definition at line 80 of file OfxhPluginCache.hpp.
Definition at line 79 of file OfxhPluginCache.hpp.
tuttle::host::ofx::OfxhPluginCache::OfxhPluginCache | ( | ) |
ctor, which inits _pluginPath to default locations and not much else
Definition at line 144 of file OfxhPluginCache.cpp.
References _pluginPath, DIRLIST_SEP_CHARS, and tuttle::host::ofx::OFXGetEnv().
tuttle::host::ofx::OfxhPluginCache::~OfxhPluginCache | ( | ) |
dtor
Definition at line 184 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 167 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 | ) | [inline, protected] |
Definition at line 112 of file OfxhPluginCache.hpp.
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_WARNING.
Referenced by scanPluginFiles().
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 399 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 218 of file OfxhPluginCache.hpp.
References _binaries.
Referenced by serialize().
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 417 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 146 of file OfxhPluginCache.hpp.
References getPluginById().
const std::list<std::string>& tuttle::host::ofx::OfxhPluginCache::getPluginPath | ( | ) | [inline] |
get the list in which plugins are sought
Definition at line 149 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 213 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 155 of file OfxhPluginCache.hpp.
References _dirty.
Referenced by tuttle::host::Core::preload().
void tuttle::host::ofx::OfxhPluginCache::registerAPICache | ( | APICache::OfxhPluginAPICacheI & | apiCache | ) | [inline] |
register an API cache handler
Definition at line 204 of file OfxhPluginCache.hpp.
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 201 of file OfxhPluginCache.cpp.
References _binaries, _knownBinFiles, _pluginDirs, DIRSEP, tuttle::host::ofx::OfxhPlugin::getApiHandler(), tuttle::host::ofx::OfxhPluginBinary::getNPlugins(), tuttle::host::ofx::OfxhPluginBinary::getPlugin(), tuttle::host::ofx::APICache::OfxhPluginAPICacheI::loadFromPlugin(), setDirty(), TUTTLE_INFO, TUTTLE_LOG_WARNING, and TUTTLE_TLOG.
Referenced by scanPluginFiles().
void tuttle::host::ofx::OfxhPluginCache::scanPluginFiles | ( | ) |
scan for plugins
Definition at line 328 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(), and TUTTLE_LOG_ERROR.
Referenced by tuttle::host::Core::preload().
std::string tuttle::host::ofx::OfxhPluginCache::seekPluginFile | ( | const std::string & | baseName | ) | const |
Definition at line 307 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 226 of file OfxhPluginCache.hpp.
References _binaries, _knownBinFiles, _plugins, findApiHandler(), and getBinaries().
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 182 of file OfxhPluginCache.hpp.
References _cacheVersion.
Referenced by tuttle::host::Core::Core().
void tuttle::host::ofx::OfxhPluginCache::setDirty | ( | ) | [inline] |
Definition at line 160 of file OfxhPluginCache.hpp.
References _dirty.
Referenced by 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 187 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 195 of file OfxhPluginCache.hpp.
References _enablePluginSeek.
friend class boost::serialization::access [friend] |
Definition at line 224 of file OfxhPluginCache.hpp.
std::ostream& operator<< | ( | std::ostream & | os, |
const This & | g | ||
) | [friend] |
Definition at line 452 of file OfxhPluginCache.cpp.
std::list<PluginCacheSupportedApi> tuttle::host::ofx::OfxhPluginCache::_apiHandlers [protected] |
Definition at line 94 of file OfxhPluginCache.hpp.
Referenced by findApiHandler(), and registerAPICache().
all the binaries we know about, we own these
Definition at line 88 of file OfxhPluginCache.hpp.
Referenced by getBinaries(), scanDirectory(), scanPluginFiles(), and serialize().
std::string tuttle::host::ofx::OfxhPluginCache::_cacheVersion [protected] |
Definition at line 98 of file OfxhPluginCache.hpp.
Referenced by setCacheVersion().
bool tuttle::host::ofx::OfxhPluginCache::_dirty [protected] |
Definition at line 99 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 100 of file OfxhPluginCache.hpp.
Referenced by seekPluginFile(), and setPluginSeekEnabled().
tuttle::host::ofx::property::OfxhPropSpec* tuttle::host::ofx::OfxhPluginCache::_hostSpec [protected] |
Definition at line 83 of file OfxhPluginCache.hpp.
bool tuttle::host::ofx::OfxhPluginCache::_ignoreCache [protected] |
Definition at line 97 of file OfxhPluginCache.hpp.
std::set<std::string> tuttle::host::ofx::OfxhPluginCache::_knownBinFiles [protected] |
Definition at line 92 of file OfxhPluginCache.hpp.
Referenced by 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 91 of file OfxhPluginCache.hpp.
Referenced by addPlugin().
std::set<std::string> tuttle::host::ofx::OfxhPluginCache::_nonrecursePath [protected] |
list of directories to look in (non-recursively)
Definition at line 86 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 87 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 85 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 89 of file OfxhPluginCache.hpp.
Referenced by addPlugin(), getPluginById(), getPlugins(), and serialize().
std::map<std::string, OfxhPlugin*> tuttle::host::ofx::OfxhPluginCache::_pluginsByID [protected] |
Definition at line 90 of file OfxhPluginCache.hpp.
Referenced by addPlugin(), getPluginById(), and tuttle::host::ofx::operator<<().