API Documentation
Loading...
Searching...
No Matches
ModuleManager.h
Go to the documentation of this file.
1#pragma once
2#include "DLLInfo.h"
3#if defined(_WIN32)
4// On Windows, NDEVR commands use the stdcall convention
5#define NDEVRAPI_ATTR
6#define NDEVRAPI_CALL __stdcall
7#define NDEVRAPI_PTR NDEVRAPI_CALL
8#elif !QT_BUILD && defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
9#error "NDEVR isn't supported for the 'armeabi' NDK ABI"
10#elif !QT_BUILD && defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
11// On Android 32-bit ARM targets, NDEVR functions use the "hardfloat"
12// calling convention, i.e. float parameters are passed in registers. This
13// is true even if the rest of the application passes floats on the stack,
14// as it does by default when compiling for the armeabi-v7a NDK ABI.
15#define NDEVRAPI_ATTR __attribute__((pcs("aapcs-vfp")))
16#define NDEVRAPI_CALL
17#define NDEVRAPI_PTR VKAPI_ATTR
18#else
19// On other platforms, use the default calling convention
20#define NDEVRAPI_ATTR
21#define NDEVRAPI_CALL
22#define NDEVRAPI_PTR
23#endif
24#include <NDEVR/String.h>
25#include <NDEVR/Dictionary.h>
26#include <NDEVR/File.h>
27#include <NDEVR/TranslatedString.h>
28typedef void (NDEVRAPI_PTR* PFN_NDEVRVoidFunction)(void);
29namespace NDEVR
30{
31 struct Module;
32 class QTModelManager;
33 class QTWindowManager;
34 class Exception;
35 class ModuleResourceManager;
36}
42typedef PFN_NDEVRVoidFunction(NDEVRAPI_PTR* PFN_SetupFactoriesForNDEVR)();//SetupFileStructureForNDEVR
43typedef PFN_NDEVRVoidFunction(NDEVRAPI_PTR* PFN_SetUpdateCheckerForNDEVR)();//SetupFileStructureForNDEVR
47typedef void(*PFN_SetupUIForNDEVR)(NDEVR::QTModelManager* model_manager, NDEVR::QTWindowManager* window_manager);
50
51namespace NDEVR
52{
54 {
56 {
57 e_application
58 , e_utility
59 , e_library_dependency
61 };
72 bool allow_user_toggle_active = false;
73 bool is_active = true;
74 ModuleType type = ModuleType::e_undefined;
75 Module();
76 Module(const String& name);
77 Module(const String& name, const File& library);
78 bool isValid() const;
79 void initialize();
80 void callModuleFunction(const String& function) const;
81 void callModuleFunction(const String& function, QTModelManager* model_manager, QTWindowManager* window_manager) const;
82 void defineModuleResources(ModuleResourceManager* resources) const;
83 protected:
84 void* module_ptr = nullptr;
85 };
86
87
89 {
90 public:
91 static File MainModuleFolder();
92 static void SetMainProgramModuleName(const String& name);
93 static void FindModules(const File& module_folder);
94 static void FindModules(const Buffer<String>& module_list, const File& module_folder);
95 static void FindModules(const File& module_list, const File& module_folder);
96 static void AddModule(const File& module_file);
97 static void CallModuleFunction(const String& function);
98 static void CallModuleFunction(const String& function, QTModelManager* model_manager, QTWindowManager* window_manager);
99 static void DefineModuleResources(const String& module_name, ModuleResourceManager* resources);
100 static void AddModule(const Module& module);
101 static void SaveModuleSettings();
102 static void SetupModuleRegistration();
103 static void OnExit();
104 static bool HasActiveModule(const String& module_name);
105 static bool IsModuleActive(const String& module_name);
106 static void ReadModuleSettings();
107 static void SetErrorCallback(const std::function<void(const Exception& e)>& callback);
108 static void* LoadDynamicLibrary(const String& library);
109 static void* LoadFromDynamicLibrary(void* library, const String& function);
110 static void* LoadFromDynamicLibrary(const String& library, const String& function);
116 };
118}
#define NDEVR_BASE_API
Definition DLLInfo.h:78
#define NDEVRAPI_PTR
Definition ModuleManager.h:22
PFN_NDEVRVoidFunction(NDEVRAPI_PTR * PFN_InitializeForNDEVR)(NDEVR::Module &module)
Definition ModuleManager.h:37
PFN_NDEVRVoidFunction(NDEVRAPI_PTR * PFN_SetupRegistrationForNDEVR)()
Definition ModuleManager.h:38
PFN_NDEVRVoidFunction(NDEVRAPI_PTR * PFN_DefineModuleResourcesForNDEVR)(NDEVR::ModuleResourceManager *resources)
Definition ModuleManager.h:48
PFN_NDEVRVoidFunction(NDEVRAPI_PTR * PFN_SetupManualsForNDEVR)()
Definition ModuleManager.h:44
PFN_NDEVRVoidFunction(NDEVRAPI_PTR * PFN_SetupUIThemesForNDEVR)()
Definition ModuleManager.h:45
PFN_NDEVRVoidFunction(NDEVRAPI_PTR * PFN_OnNDEVRExit)()
Definition ModuleManager.h:49
PFN_NDEVRVoidFunction(NDEVRAPI_PTR * PFN_RegisterUserSettingsForNDEVR)()
Definition ModuleManager.h:40
PFN_NDEVRVoidFunction(NDEVRAPI_PTR * PFN_FactoryResetNDEVR)()
Definition ModuleManager.h:46
PFN_NDEVRVoidFunction(NDEVRAPI_PTR * PFN_SetupFactoriesForNDEVR)()
Definition ModuleManager.h:42
PFN_NDEVRVoidFunction(NDEVRAPI_PTR * PFN_SetupMetatypesForNDEVR)()
Definition ModuleManager.h:39
void(* PFN_SetupUIForNDEVR)(NDEVR::QTModelManager *model_manager, NDEVR::QTWindowManager *window_manager)
Definition ModuleManager.h:47
PFN_NDEVRVoidFunction(NDEVRAPI_PTR * PFN_SetupFileStructureForNDEVR)()
Definition ModuleManager.h:41
void(NDEVRAPI_PTR * PFN_NDEVRVoidFunction)(void)
Definition ModuleManager.h:28
PFN_NDEVRVoidFunction(NDEVRAPI_PTR * PFN_SetUpdateCheckerForNDEVR)()
Definition ModuleManager.h:43
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition Dictionary.h:48
Definition Exception.hpp:56
Definition File.h:47
Definition ModuleManager.h:89
static Dictionary< String, Dictionary< String, void * > > functions
Definition ModuleManager.h:114
static Dictionary< String, Module > modules
Definition ModuleManager.h:112
static Dictionary< String, bool > module_active_list
Definition ModuleManager.h:113
static String main_program_module_name
Definition ModuleManager.h:115
static Buffer< String > ordered_modules
Definition ModuleManager.h:111
Definition ModuleResourceManager.h:179
Definition QTModelManager.h:94
Definition String.h:40
Definition StringStream.h:62
Definition TranslatedString.h:9
Definition ACIColor.h:37
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120
Definition ModuleManager.h:54
TranslatedString display_name
Definition ModuleManager.h:66
String activation_id
Definition ModuleManager.h:71
String icon
Definition ModuleManager.h:67
TranslatedString description
Definition ModuleManager.h:68
String version
Definition ModuleManager.h:64
Dictionary< String, void * > loaded_functions
Definition ModuleManager.h:62
File library
Definition ModuleManager.h:65
String name
Definition ModuleManager.h:63
String license_agreement
Definition ModuleManager.h:69
String website
Definition ModuleManager.h:70
ModuleType
Definition ModuleManager.h:56