NDEVR
API Documentation
ModuleResourceManager.h
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/Buffer.h>
4#include <NDEVR/String.h>
5#include <NDEVR/TranslatedString.h>
6#include <NDEVR/StringView.h>
7#undef linux
8namespace NDEVR
9{
14 struct NDEVR_BASE_API OSType
15 {
16
17
18 static constexpr StringView windows = "windows";
19 static constexpr StringView android = "android";
20 static constexpr StringView macx = "macx";
21 static constexpr StringView ios = "ios";
22 static constexpr StringView wasm = "wasm";
23 static constexpr StringView all = "windows|android|macx|ios|wasm";
24 };
25
30 struct NDEVR_BASE_API ConfigType
31 {
32 static constexpr StringView debug = "debug";
33 static constexpr StringView release = "release";
34 static constexpr StringView all = "debug|release";
35 };
36
41 struct NDEVR_BASE_API PlatformType
42 {
43 static constexpr StringView x86 = "x86";
44 static constexpr StringView x64 = "x64";
45 static constexpr StringView armeabi = "armeabi";
46 static constexpr StringView arm64 = "arm64";
47 static constexpr StringView all = "x86|x64|armeabi|arm64";
48 };
49
66
70 struct NDEVR_BASE_API ModuleConfiguration
71 {
80
91
97 bool neededForOS(const StringView& os) const
98 {
99 return os_type.hasSubString(os);
100 }
101
106 bool neededForConfig(const StringView& os) const
107 {
108 return config_type.hasSubString(os);
109 }
110
115 bool neededForPlatform(const StringView& os) const
116 {
117 return platform_type.hasSubString(os);
118 }
119
124 static String Combine(std::initializer_list<StringView> l);
131 static String& Remove(String& s, std::initializer_list<StringView> l);
135 };
136
146
159
169
179
189
199
212
216 {
219 bool append = false;
220 bool change_permission = false;
221 bool create_child = false;
222 bool create_file = false;
223 bool create_link = false;
224 bool create_subkey = false;
225 bool delete_object = false;
226 bool delete_child = false;
227 bool enumerate_subkey = false;
228 bool execute = false;
229 bool read = true;
230 bool notify = false;
231 bool take_ownership = false;
232 bool write = false;
233 bool all_rights = false;
234 };
235
250
300
347}
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
Stores all dependencies for a combination of modules that make up a complete software package.
Buffer< FileHandler > file_handlers
File types this module can handle.
Buffer< ModuleDependency > dependencies
All dependencies owned by this module.
void addModuleDependency(const StringView &resource, const StringView &os_type=OSType::all, const StringView &config_type=ConfigType::all, const StringView &platform_type=PlatformType::all)
Adds a module dependency to this module.
ModuleConfiguration supported_configurations
Supported configurations (empty means all).
Buffer< FireWallException > firewall_exceptions
Firewall exceptions required by this module.
void addFileDependency(const StringView &resource, const StringView &os_type=OSType::all, const StringView &config_type=ConfigType::all, const StringView &platform_type=PlatformType::all)
Adds a file dependency to this module.
void addInstallExeDependency(const StringView &resource, const StringView &os_type=OSType::all, const StringView &config_type=ConfigType::all, const StringView &platform_type=PlatformType::all)
Adds an install-time executable dependency to this module.
String launch_function
Entry-point launch function name for executable modules.
void addDependency(DependencyType type, const StringView &resource, const StringView &os_type=OSType::all, const StringView &config_type=ConfigType::all, const StringView &platform_type=PlatformType::all)
Adds a dependency of the specified type to this module.
Buffer< String > permissions
OS permissions required by this module.
Buffer< RegistryKeyAction > registry_actions
Registry actions to perform at install time.
This class is like a string view, but may optionally store the data internally Useful if the return t...
Definition String.h:1278
The core String View class for the NDEVR API.
Definition StringView.h:58
The core String class for the NDEVR API.
Definition String.h:95
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
RegistryType
Available registry actions that can be taken on program installation.
@ e_folder
The value represents a folder path.
@ e_expandable
The value is stored as an expandable string (REG_EXPAND_SZ).
@ e_integer
The value is stored as an integer (REG_DWORD).
@ e_binary
The value is stored as a hexadecimal value (REG_BINARY).
@ e_string
The value is stored as a string (REG_SZ).
@ e_multi_string
The value is stored as a multi-string (REG_MULTI_SZ).
RegistryActionType
Available registry actions that can be taken on program installation.
@ e_create
Creates the key, if absent, when the parent component is installed.
@ e_append
Appends the specified value(s) to a multiString registry key.
@ e_remove
Removes a registry name when the parent component is installed.
DependencyType
Stores the type of dependency for a Module or resource.
@ e_executable
An executable binary dependency.
@ e_module
An NDEVR module dependency.
@ e_rcc_resource
A Qt compiled resource (.rcc) dependency.
@ e_file
A standalone file dependency.
@ e_library
A shared or static library dependency.
@ e_type
A type registration dependency.
@ e_firewall_exception
A firewall exception that must be registered.
@ e_source_folder
A source folder dependency.
@ e_install_executable
An executable to run during installation.
@ e_bundled_folder
A folder bundled with the module for distribution.
Stores String variables reprenting the type of compile configuration that will be supported by a part...
static constexpr StringView debug
Debug build configuration.
static constexpr StringView release
Release build configuration.
static constexpr StringView all
All build configurations combined.
A description of the type of file a Module or resource can handle.
String id
File extension without the dot (e.g., "ndv").
String content_type
MIME content type (e.g., "application/ndv").
Buffer< FileHandlerVerb > verbs
Available verbs (actions) for this file extension.
Stores variables needed to perform a file action for a particular Module or resource.
String id
Unique verb identifier (e.g., "ndv_open").
StringAllocatingView command
The verb command name (e.g., "Open").
StringAllocatingView argument
Command-line argument template with %1 placeholder for the file path.
Stores information relating to a type of file the module can preview or handle.
String icon
Icon resource name for this file type.
bool advertise
Whether to advertise this file handler to the OS.
Buffer< FileHanderExtension > extensions
File extensions handled by this handler.
Stores information relating to a particular FireWallException needed by a Module or feature.
StringAllocatingView profile
Firewall profile: "domain", "private", "public", or "all".
bool ignore_failure
Whether to silently ignore failures to register this exception.
StringAllocatingView scope
Firewall scope: "any" or "localSubnet".
uint04 port
Port number to allow through the firewall.
Buffer< String > remote_addresses
Remote addresses allowed through the firewall.
StringAllocatingView protocol
Network protocol: "tcp" or "udp".
Stores all information relating to a particular feature or resource included by a Module.
bool neededForConfig(const StringView &os) const
Checks whether this configuration is needed for the given build configuration.
static String & Remove(String &s, std::initializer_list< StringView > l)
Removes specified values from a pipe-delimited configuration String.
String platform_type
The supported CPU platform types (pipe-delimited).
String config_type
The supported build configuration types (pipe-delimited).
ModuleConfiguration(const StringView &os_type, const StringView &config_type, const StringView &platform_type)
Constructs a ModuleConfiguration with specific OS, config, and platform types.
String os_type
The supported operating system types (pipe-delimited).
bool neededForOS(const StringView &os) const
Checks whether this configuration is needed for the given operating system.
static String Combine(std::initializer_list< StringView > l)
Combines multiple StringView values into a single pipe-delimited String.
ModuleConfiguration()
Constructs a ModuleConfiguration supporting all OS, config, and platform types.
bool neededForPlatform(const StringView &os) const
Checks whether this configuration is needed for the given CPU platform.
ModuleDependency(const FireWallException &exception, const StringView &os_type, const StringView &config_type, const StringView &platform_type=PlatformType::all)
Constructs a ModuleDependency from a FireWallException.
ModuleDependency(DependencyType type, const StringView &resource, const StringView &os_type, const StringView &config_type, const StringView &platform_type=PlatformType::all)
Constructs a ModuleDependency with an explicit dependency type.
String os_type
The operating system type filter for this dependency.
DependencyType type
The type of this dependency.
FireWallException getAsFirewallException() const
Converts this dependency back into a FireWallException.
String resource
The resource name or path for this dependency.
ModuleDependency(const StringView &resource, const StringView &os_type, const StringView &config_type, const StringView &platform_type=PlatformType::all)
Constructs a library ModuleDependency (default type is e_library).
describes the Module or feature to the end user.
TranslatedString name
User-facing display name.
String id
Unique identifier for this feature.
TranslatedString description
User-facing description (e.g., displayed in Windows Firewall manager).
Stores String variables reprenting the type of OS that will be supported by a particular module or re...
static constexpr StringView wasm
WebAssembly (Emscripten) platform.
static constexpr StringView android
Google Android operating system.
static constexpr StringView all
All supported operating systems combined.
static constexpr StringView macx
Apple macOS operating system.
static constexpr StringView windows
Microsoft Windows operating system.
static constexpr StringView ios
Apple iOS operating system.
Information about a requested OS-permission typically requested at install time.
bool change_permission
Permission to change permissions on the object.
bool write
Permission to write.
bool execute
Permission to execute.
bool take_ownership
Permission to take ownership of the object.
bool enumerate_subkey
Permission to enumerate registry subkeys.
String domain
The domain for the permission target.
bool create_child
Permission to create child objects.
bool all_rights
Grants all available permissions.
bool create_link
Permission to create symbolic links.
bool create_file
Permission to create files.
bool read
Permission to read.
bool delete_child
Permission to delete child objects.
bool notify
Permission to receive change notifications.
bool append
Permission to append data.
bool delete_object
Permission to delete the object.
bool create_subkey
Permission to create registry subkeys.
String user
The user account for the permission target.
Stores String variables reprenting the type of platform CPU configuration that will be supported by a...
static constexpr StringView all
All supported CPU architectures combined.
static constexpr StringView x64
64-bit x86-64 CPU architecture.
static constexpr StringView x86
32-bit x86 CPU architecture.
static constexpr StringView armeabi
ARM EABI CPU architecture.
static constexpr StringView arm64
64-bit ARM CPU architecture.
Information about a specific registry action to be taken, typically at install-time.
Buffer< Permission > permissions
Permissions to set on the registry key.
RegistryType type
The data type of the registry value.
StringAllocatingView value
The registry value data to write.
RegistryActionType action
The action to perform on the registry key.
bool is_key_path
Whether the path represents a key path rather than a value path.
StringAllocatingView root
Registry root hive: "HKMU", "HKCR", "HKCU", "HKLM", or "HKU".
bool ownership
Whether to take ownership of the registry key.
StringAllocatingView path
Registry key path relative to the root.