Field3D
|
Contains implementations of plugin loading functions. More...
#include <dlfcn.h>
#include <sys/types.h>
#include <dirent.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <boost/tokenizer.hpp>
#include "ClassFactory.h"
#include "PluginLoader.h"
Go to the source code of this file.
Functions | |
int | filter (std::string &name) |
bool | getDirSos (std::vector< std::string > &sos, std::string &dir) |
Contains implementations of plugin loading functions.
Definition in file PluginLoader.cpp.
int filter | ( | std::string & | name | ) |
Definition at line 96 of file PluginLoader.cpp.
Referenced by getDirSos().
{ std::string delimiters = "."; std::vector <std::string> items; tokenize(name, delimiters, items); if (items.size() == 0) { return 0; } if (items[items.size() -1] == "so") { return 1; } return 0; }
bool getDirSos | ( | std::vector< std::string > & | sos, |
std::string & | dir | ||
) |
Definition at line 116 of file PluginLoader.cpp.
References filter().
Referenced by PluginLoader::loadPlugins().
{ struct dirent *dirent; const char *ds = dir.c_str(); DIR *dirfd = opendir(ds); if (!dirfd) { std::string er = "Field3D_plugin loader: could not open directory " + dir + "\n"; //perror(er.c_str()); return false; } dirent = readdir(dirfd); while (dirent != NULL) { std::string name = dirent->d_name; if (filter(name)) { name = dir + "/" + name; sos.push_back(name); } dirent = readdir(dirfd); } closedir(dirfd); return true; }