/usr/include/glibmm-2.4/glibmm/module.h is in libglibmm-2.4-dev 2.42.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | // -*- c++ -*-
// Generated by gmmproc 2.42.0 -- DO NOT MODIFY!
#ifndef _GLIBMM_MODULE_H
#define _GLIBMM_MODULE_H
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <string>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
extern "C" { typedef struct _GModule GModule; }
#endif
namespace Glib
{
/** @addtogroup glibmmEnums glibmm Enums and Flags */
/**
* @var ModuleFlags MODULE_BIND_LAZY
* Specifies that symbols are only resolved when needed. The default action is to bind all symbols when the module is loaded.
*
* @var ModuleFlags MODULE_BIND_LOCAL
* Specifies that symbols in the module should not be added to the global name space. The default action on most platforms is to place symbols in the module in the global name space, which may cause conflicts with existing symbols.
*
* @var ModuleFlags MODULE_BIND_MASK
* Mask for all flags.
*
* @enum ModuleFlags
*
* Flags passed to g_module_open().
* Note that these flags are not supported on all platforms.
* @ingroup glibmmEnums
* @par Bitwise operators:
* <tt>%ModuleFlags operator|(ModuleFlags, ModuleFlags)</tt><br>
* <tt>%ModuleFlags operator&(ModuleFlags, ModuleFlags)</tt><br>
* <tt>%ModuleFlags operator^(ModuleFlags, ModuleFlags)</tt><br>
* <tt>%ModuleFlags operator~(ModuleFlags)</tt><br>
* <tt>%ModuleFlags& operator|=(ModuleFlags&, ModuleFlags)</tt><br>
* <tt>%ModuleFlags& operator&=(ModuleFlags&, ModuleFlags)</tt><br>
* <tt>%ModuleFlags& operator^=(ModuleFlags&, ModuleFlags)</tt><br>
*/
enum ModuleFlags
{
MODULE_BIND_LAZY = 1 << 0,
MODULE_BIND_LOCAL = 1 << 1,
MODULE_BIND_MASK = 0x03
};
/** @ingroup glibmmEnums */
inline ModuleFlags operator|(ModuleFlags lhs, ModuleFlags rhs)
{ return static_cast<ModuleFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
/** @ingroup glibmmEnums */
inline ModuleFlags operator&(ModuleFlags lhs, ModuleFlags rhs)
{ return static_cast<ModuleFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
/** @ingroup glibmmEnums */
inline ModuleFlags operator^(ModuleFlags lhs, ModuleFlags rhs)
{ return static_cast<ModuleFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
/** @ingroup glibmmEnums */
inline ModuleFlags operator~(ModuleFlags flags)
{ return static_cast<ModuleFlags>(~static_cast<unsigned>(flags)); }
/** @ingroup glibmmEnums */
inline ModuleFlags& operator|=(ModuleFlags& lhs, ModuleFlags rhs)
{ return (lhs = static_cast<ModuleFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
/** @ingroup glibmmEnums */
inline ModuleFlags& operator&=(ModuleFlags& lhs, ModuleFlags rhs)
{ return (lhs = static_cast<ModuleFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
/** @ingroup glibmmEnums */
inline ModuleFlags& operator^=(ModuleFlags& lhs, ModuleFlags rhs)
{ return (lhs = static_cast<ModuleFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
//TODO: Replace get_last_error() with exceptions?
//Provide operator()?
/** Dynamic Loading of Modules
* These functions provide a portable way to dynamically load object
* files (commonly known as 'plug-ins'). The current implementation
* supports all systems that provide an implementation of dlopen()
* (e.g. Linux/Sun), as well as HP-UX via its shl_load() mechanism,
* and Windows platforms via DLLs.
*/
class Module
{
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef Module CppObjectType;
typedef GModule BaseObjectType;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
private:
public:
/** Opens a module.
*
* First of all it tries to open file_name as a module. If that
* fails and file_name has the ".la"-suffix (and is a libtool
* archive) it tries to open the corresponding module. If that fails
* and it doesn't have the proper module suffix for the platform
* (G_MODULE_SUFFIX), this suffix will be appended and the
* corresponding module will be opended. If that fails and file_name
* doesn't have the ".la"-suffix, this suffix is appended and
* it tries to open the corresponding module.
*
* Use operator bool() to see whether the operation succeeded. For instance,
* @code
* Glib::Module module("plugins/helloworld");
* if(module)
* {
* void* func = 0;
* bool found = get_symbol("some_function", func);
* }
* @endcode
*
* @param file_name The library filename to open
* @param flags Flags to configure the load process
*/
explicit Module(const std::string& file_name, ModuleFlags flags = ModuleFlags(0));
/** Close a module. The module will be removed from memory, unless
* <tt>make_resident</tt> has been called.
*/
virtual ~Module();
/** Check whether the module was found.
*/
operator bool() const;
/** Checks if modules are supported on the current platform.
* @returns true if available, false otherwise
*/
static bool get_supported();
/** Ensures that a module will never be unloaded. Any calls to the
* Glib::Module destructor will not unload the module.
*/
void make_resident();
/** Gets a string describing the last module error.
* @returns The error string
*/
static std::string get_last_error();
/** Gets a symbol pointer from the module.
* @param symbol_name The name of the symbol to lookup
* @param symbol A pointer to set to the symbol
* @returns True if the symbol was found, false otherwise.
*/
bool get_symbol(const std::string& symbol_name, void*& symbol) const;
/** Get the name of the module.
* @returns The name of the module
*/
std::string get_name() const;
/** A portable way to build the filename of a module. The
* platform-specific prefix and suffix are added to the filename, if
* needed, and the result is added to the directory, using the
* correct separator character.
*
* The directory should specify the directory where the module can
* be found. It can be an empty string to indicate that the
* module is in a standard platform-specific directory, though this
* is not recommended since the wrong module may be found.
*
* For example, calling <tt>build_path()</tt> on a Linux
* system with a directory of <tt>/lib</tt> and a module_name of
* "mylibrary" will return <tt>/lib/libmylibrary.so</tt>. On a
* Windows system, using <tt>\\Windows</tt> as the directory it will
* return <tt>\\Windows\\mylibrary.dll</tt>.
*
* @param directory The directory the module is in
* @param module_name The name of the module
* @returns The system-specific filename of the module
*/
// TODO: add an override which doesn't take a directory
// TODO: check what happens when directory is ""
/** A portable way to build the filename of a module. The platform-specific
* prefix and suffix are added to the filename, if needed, and the result
* is added to the directory, using the correct separator character.
*
* The directory should specify the directory where the module can be found.
* It can be <tt>0</tt> or an empty string to indicate that the module is in a
* standard platform-specific directory, though this is not recommended
* since the wrong module may be found.
*
* For example, calling g_module_build_path() on a Linux system with a
* @a directory of `/lib` and a @a module_name of "mylibrary" will return
* `/lib/libmylibrary.so`. On a Windows system, using `\\Windows` as the
* directory it will return `\\Windows\\mylibrary.dll`.
*
* @param directory The directory where the module is. This can be
* <tt>0</tt> or the empty string to indicate that the standard platform-specific
* directories will be used, though that is not recommended.
* @param module_name The name of the module.
* @return The complete path of the module, including the standard library
* prefix and suffix. This should be freed when no longer needed.
*/
static std::string build_path(const std::string& directory, const std::string& module_name);
GModule* gobj() { return gobject_; }
const GModule* gobj() const { return gobject_; }
protected:
GModule* gobject_;
private:
// noncopyable
Module(const Module&);
Module& operator=(const Module&);
};
} // namespace Glib
#endif /* _GLIBMM_MODULE_H */
|