3bc621ff73002792ab9265261b0e951bec55b8a8
[ardour.git] / libs / glibmm2 / glibmm / module.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <glibmm/module.h>
4 #include <glibmm/private/module_p.h>
5
6 // -*- c++ -*-
7 /* $Id$ */
8
9 /* Copyright (C) 2002 The gtkmm Development Team
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Library General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Library General Public License for more details.
20  *
21  * You should have received a copy of the GNU Library General Public
22  * License along with this library; if not, write to the Free
23  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  */
25
26 #include <glibmm/utility.h>
27 #include <gmodule.h>
28
29 namespace Glib
30 {
31
32 Module::Module(const std::string& file_name, ModuleFlags flags)
33 :
34   gobject_ (g_module_open(file_name.c_str(), (GModuleFlags) flags))
35 {}
36
37 Module::~Module()
38 {
39   if(gobject_)
40     g_module_close(gobject_);
41 }
42
43 Module::operator bool() const
44 {
45   return (gobject_ != 0);
46 }
47
48 } // namespace Glib
49
50
51 namespace
52 {
53 } // anonymous namespace
54
55
56 namespace Glib
57 {
58
59
60 bool Module::get_supported()
61 {
62   return g_module_supported();
63 }
64
65 void Module::make_resident()
66 {
67   g_module_make_resident(gobj());
68 }
69
70 std::string Module::get_last_error()
71 {
72   return Glib::convert_const_gchar_ptr_to_stdstring(g_module_error());
73 }
74
75 bool Module::get_symbol(const std::string& symbol_name, void*& symbol) const
76 {
77   return g_module_symbol(const_cast<GModule*>(gobj()), symbol_name.c_str(), &(symbol));
78 }
79
80 std::string Module::get_name() const
81 {
82   return Glib::convert_const_gchar_ptr_to_stdstring(g_module_name(const_cast<GModule*>(gobj())));
83 }
84
85 std::string Module::build_path(const std::string& directory, const std::string& module_name)
86 {
87   return Glib::convert_return_gchar_ptr_to_stdstring(g_module_build_path(directory.c_str(), module_name.c_str()));
88 }
89
90
91 } // namespace Glib
92
93