7 #ifndef _FCITX_UTILS_LIBRARY_H_ 8 #define _FCITX_UTILS_LIBRARY_H_ 20 #include <fcitx-utils/fcitxutils_export.h> 22 #include <fcitx-utils/macros.h> 26 enum class LibraryLoadHint {
28 ResolveAllSymbolsHint = 0x1,
29 PreventUnloadHint = 0x2,
30 ExportExternalSymbolsHint = 0x4,
32 DefaultHint = PreventUnloadHint,
39 explicit Library(
const std::string &path);
40 explicit Library(
const char *path);
41 explicit Library(
const std::filesystem::path &path = {});
42 FCITX_DECLARE_VIRTUAL_DTOR_MOVE(
Library);
47 void *resolve(
const char *name);
48 bool findData(
const char *slug,
const char *magic,
size_t lenOfMagic,
49 const std::function<
void(
const char *data)> &parser);
51 const std::string &path()
const;
52 const std::filesystem::path &fspath()
const;
54 template <
typename Func>
55 static auto toFunction(
void *ptr) {
56 return reinterpret_cast<Func *
>(ptr);
59 static bool isNewNamespaceSupported();
62 std::unique_ptr<LibraryPrivate> d_ptr;
67 #endif // _FCITX_UTILS_LIBRARY_H_
Class provides bit flag support for Enum.
Helper template class to make easier to use type safe enum flags.