Show SEditorPluginManager.h syntax highlighted
#ifndef __SEDITORPLUGINMANAGER_H__
#define __SEDITORPLUGINMANAGER_H__ 1
#include <gen_prog/plugin/plugin_manager.h>
#include <osgDesigner/plugins/IEditorPluginDescABC.h>
#include <osgDesigner/core/SConfigManager.h>
#include <osgDesigner/plugins/CModulePrefixSuffix.h>
#include <osgDesigner/plugins/SEditorPluginRegistry.h>
namespace osgDesigner
{
class CEditorPluginIdentifier
{
public:
typedef boost::filesystem::path path_type;
typedef std::vector<path_type> path_list;
typedef std::string dynamic_library_key_type;
typedef std::string module_key_type;
void getDirectoryList(path_list & pathList) const
{
boost::filesystem::path userPluginDirectory(SConfigManager::instance()->getPluginDirectory(), boost::filesystem::native);
if (boost::filesystem::exists(userPluginDirectory))
pathList.push_back(userPluginDirectory / "editor");
else
{
pathList.push_back("./lib/osgDesignerPlugins/editor");
pathList.push_back("/usr/local/lib/osgDesignerPlugins/editor");
pathList.push_back("/usr/lib/osgDesignerPlugins/editor");
}
}
bool isValidModuleKey(const module_key_type & moduleKey) const
{ return (moduleKey.empty() == false); }
module_key_type toModuleKey(const dynamic_library_key_type & dlKey) const
{
if (dlKey.empty()) return ("");
module_key_type moduleKey;
std::string prefix(getPrefix());
std::string suffix(getSuffix());
if ((dlKey.find(prefix) == 0) && (dlKey.rfind(suffix) == dlKey.size() - suffix.size()))
{
moduleKey = dlKey;
moduleKey.erase(moduleKey.size() - suffix.size(), suffix.size());
moduleKey.erase(0, prefix.size());
}
return (moduleKey);
}
dynamic_library_key_type toDynamicLibraryKey(const module_key_type & moduleKey) const
{
return (getPrefix() + moduleKey + getSuffix());
}
private :
const char * getSuffix() const
{
return ("");
}
const char * getPrefix() const
{
return ("Editor_");
}
};
typedef gen_prog::plugin::detail::dynamic_library_identifier_helper< CModulePrefixSuffix > CEditorDynamicLibraryIdentifier;
typedef gen_prog::plugin::dynamic_library_manager< CEditorDynamicLibraryIdentifier > CEditorDynamicLibraryManager;
// ** define a manager for IEditorPluginDescABC
typedef gen_prog::plugin::plugin_manager< SEditorPluginRegistry,
CEditorPluginIdentifier,
CEditorDynamicLibraryManager > CEditorPluginManager;
typedef gen_prog::plugin::detail::singleton< CEditorPluginManager > SEditorPluginManager;
}
#endif // ** __SEDITORPLUGINMANAGER_H__ ** //
See more files for this project here