|
From: Tapio V. <aa...@us...> - 2010-08-12 21:27:34
|
Module: performous
Branch: joinmenu
Commit: c248ca972d5565c50ce2626671a6d377b59ce328
Author: Tapio Vierros <tap...@gm...>
Date: Sun Aug 8 23:18:12 2010 +0300
Whitespace.
---
libs/plugin++/include/plugin++/dll.hpp | 38 ++++++++++----------
libs/plugin++/include/plugin++/loader.hpp | 18 +++++-----
libs/plugin++/src/loader.cc | 54 ++++++++++++++--------------
3 files changed, 55 insertions(+), 55 deletions(-)
diff --git a/libs/plugin++/include/plugin++/dll.hpp b/libs/plugin++/include/plugin++/dll.hpp
index 51de65e..4c3d0cf 100644
--- a/libs/plugin++/include/plugin++/dll.hpp
+++ b/libs/plugin++/include/plugin++/dll.hpp
@@ -15,25 +15,25 @@ namespace plugin {
dll_error(std::string const& msg): runtime_error(msg) {}
};
- /// \brief Dynamic library loader
- class Plugin_API dll {
- void* lib;
- public:
- /// Open a dynamic library
- /// \throws dll_error if the library cannot be loaded
- dll(std::string const& filename);
- ~dll();
- /// Get a symbol from DLL (symptr can be a data or a function pointer)
- /// \throws dll_error if no symbol is found
- template <typename SymPtr> void sym(std::string const& name, SymPtr& symptr) {
- union { void* ptr; SymPtr symptr; } conv; // Data/function conversion without warnings
- conv.ptr = sym(name.c_str());
- if (!conv.ptr) throw dll_error("Symbol " + name + " not found");
- symptr = conv.symptr;
- }
- /// Get a symbol from DLL (low level C style version)
- void* sym(char const* name);
- };
+ /// \brief Dynamic library loader
+ class Plugin_API dll {
+ void* lib;
+ public:
+ /// Open a dynamic library
+ /// \throws dll_error if the library cannot be loaded
+ dll(std::string const& filename);
+ ~dll();
+ /// Get a symbol from DLL (symptr can be a data or a function pointer)
+ /// \throws dll_error if no symbol is found
+ template <typename SymPtr> void sym(std::string const& name, SymPtr& symptr) {
+ union { void* ptr; SymPtr symptr; } conv; // Data/function conversion without warnings
+ conv.ptr = sym(name.c_str());
+ if (!conv.ptr) throw dll_error("Symbol " + name + " not found");
+ symptr = conv.symptr;
+ }
+ /// Get a symbol from DLL (low level C style version)
+ void* sym(char const* name);
+ };
}
#endif
diff --git a/libs/plugin++/include/plugin++/loader.hpp b/libs/plugin++/include/plugin++/loader.hpp
index 4463cf6..d33084d 100644
--- a/libs/plugin++/include/plugin++/loader.hpp
+++ b/libs/plugin++/include/plugin++/loader.hpp
@@ -8,16 +8,16 @@
#include <boost/ptr_container/ptr_vector.hpp>
namespace plugin {
- namespace fs = boost::filesystem;
+ namespace fs = boost::filesystem;
- /** @short A helper for loading all matching libraries in a folder. **/
- class loader {
- boost::ptr_vector<dll> dlls;
- void parse(std::set<fs::path>& paths, char const* var, fs::path const& folder = fs::path());
- void load(fs::path const& path);
- public:
- loader(fs::path const& folder);
- };
+ /** @short A helper for loading all matching libraries in a folder. **/
+ class loader {
+ boost::ptr_vector<dll> dlls;
+ void parse(std::set<fs::path>& paths, char const* var, fs::path const& folder = fs::path());
+ void load(fs::path const& path);
+ public:
+ loader(fs::path const& folder);
+ };
}
#endif
diff --git a/libs/plugin++/src/loader.cc b/libs/plugin++/src/loader.cc
index a21ea30..078c4cf 100644
--- a/libs/plugin++/src/loader.cc
+++ b/libs/plugin++/src/loader.cc
@@ -23,33 +23,33 @@ namespace fs = boost::filesystem;
/// Break var (a delimited path string) into paths (appends folder if supplied).
void loader::parse(std::set<fs::path>& paths, char const* var, fs::path const& folder) {
- if (!var) return;
- std::istringstream iss(var);
- std::string elem;
- while (std::getline(iss, elem, PATHSEP)) {
- fs::path p = elem;
- if (!folder.empty()) p /= folder;
- if (fs::is_directory(p)) paths.insert(p);
- }
+ if (!var) return;
+ std::istringstream iss(var);
+ std::string elem;
+ while (std::getline(iss, elem, PATHSEP)) {
+ fs::path p = elem;
+ if (!folder.empty()) p /= folder;
+ if (fs::is_directory(p)) paths.insert(p);
+ }
}
/// Try to load all libraries in the given folder.
void loader::load(fs::path const& path) {
- for (fs::directory_iterator it(path), end; it != end; ++it) {
- try {
- dlls.push_back(new dll(it->string()));
- } catch (std::runtime_error const& e) {
- std::cerr << e.what() << std::endl;
- }
- }
+ for (fs::directory_iterator it(path), end; it != end; ++it) {
+ try {
+ dlls.push_back(new dll(it->string()));
+ } catch (std::runtime_error const& e) {
+ std::cerr << e.what() << std::endl;
+ }
+ }
}
loader::loader(fs::path const& folder) {
- std::set<fs::path> paths;
- // Try PLUGIN_PATH environment setting
- parse(paths, std::getenv("PLUGIN_PATH"));
- // Try other options only if folder was given
- if (!folder.empty()) {
+ std::set<fs::path> paths;
+ // Try PLUGIN_PATH environment setting
+ parse(paths, std::getenv("PLUGIN_PATH"));
+ // Try other options only if folder was given
+ if (!folder.empty()) {
// Try relative path from executable
fs::path p = execname();
p = p.parent_path().parent_path();
@@ -58,17 +58,17 @@ loader::loader(fs::path const& folder) {
if (fs::is_directory(p)) paths.insert(p);
}
#ifndef _WIN32
- // Try UNIX library paths
- parse(paths, std::getenv("LD_LIBRARY_PATH"), folder);
- parse(paths, UNIX_LIBPATH, folder);
+ // Try UNIX library paths
+ parse(paths, std::getenv("LD_LIBRARY_PATH"), folder);
+ parse(paths, UNIX_LIBPATH, folder);
#endif
- }
- // Load the contents of each folder
- for (std::set<fs::path>::const_iterator it = paths.begin(); it != paths.end(); ++it) load(*it);
+ }
+ // Load the contents of each folder
+ for (std::set<fs::path>::const_iterator it = paths.begin(); it != paths.end(); ++it) load(*it);
#ifndef _WIN32
// HACK: ifdeffing this message out since it would be consfusing on Windows,
// where PortAudio is built into libda (and thus no plugins used).
- if (dlls.empty()) std::cerr << "No plugins found. Try setting PLUGIN_PATH to the folder with the plugins." << std::endl;
+ if (dlls.empty()) std::cerr << "No plugins found. Try setting PLUGIN_PATH to the folder with the plugins." << std::endl;
#endif
}
|