MorphoGraphX
Library.hpp
1 //
2 // This file is part of MorphoGraphX - http://www.MorphoGraphX.org
3 // Copyright (C) 2012-2015 Richard S. Smith and collaborators.
4 //
5 // If you use MorphoGraphX in your work, please cite:
6 // http://dx.doi.org/10.7554/eLife.05864
7 //
8 // MorphoGraphX is free software, and is licensed under under the terms of the
9 // GNU General (GPL) Public License version 2.0, http://www.gnu.org/licenses.
10 //
11 #ifndef LIBRARY_HPP
12 #define LIBRARY_HPP
13 
14 #include <Config.hpp>
15 
16 #include <QString>
17 
18 class Library {
19 public:
20 #if defined(WIN32) || defined(WIN64)
21  typedef HINSTANCE handle_t;
22 #else
23  typedef void* handle_t;
24 #endif
25 
26  Library(QString path);
27 
28  QString fileName() const {
29  return filename;
30  }
31  void setFileName(const QString& fn) {
32  filename = fn;
33  }
34 
35  bool load();
36  bool unload();
37 
38  bool isLoaded() const {
39  return (bool)handle;
40  }
41 
42  QString errorString() const {
43  return error_string;
44  }
45 
46  static bool isLibrary(QString path);
47 
48 protected:
49  QString filename, error_string;
50  handle_t handle;
51 };
52 
53 #endif
Definition: Library.hpp:18