mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2026-09-09 12:29:15 -05:00
- use const auto& where possible
- avoid using const std::unique_ptr& and const std::shared_ptr& - avoid wrapping results in std::optional - prefer std::string_view over const std::string& - update FSUtils::LoadFileToMem to write into std::vector<uint8_t> - use std::span when possible - Avoid unnessecary copies in PluginDataFactory - allocate plugins as HeapMemoryFixedSize which bascially is a std::unique_ptr with fixed size
This commit is contained in:
@@ -26,12 +26,12 @@
|
||||
|
||||
class WUPSConfig {
|
||||
public:
|
||||
explicit WUPSConfig(const std::string &name) {
|
||||
explicit WUPSConfig(std::string_view name) {
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
~WUPSConfig() {
|
||||
for (auto &element : categories) {
|
||||
for (const auto &element : categories) {
|
||||
delete element;
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
|
||||
\return On success, the created and inserted category will be returned.
|
||||
**/
|
||||
std::optional<WUPSConfigCategory *> addCategory(const std::string &categoryName) {
|
||||
std::optional<WUPSConfigCategory *> addCategory(std::string_view categoryName) {
|
||||
auto curCat = new (std::nothrow) WUPSConfigCategory(categoryName);
|
||||
if (curCat == nullptr) {
|
||||
return {};
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
|
||||
class WUPSConfigCategory {
|
||||
public:
|
||||
explicit WUPSConfigCategory(const std::string &name) {
|
||||
explicit WUPSConfigCategory(std::string_view name) {
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
~WUPSConfigCategory() {
|
||||
for (auto &element : items) {
|
||||
for (const auto &element : items) {
|
||||
delete element;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
Sets the display name of this WUPSConfigItem
|
||||
This is the value which will be shown in the configuration menu.
|
||||
**/
|
||||
virtual void setDisplayName(const std::string &_displayName) {
|
||||
virtual void setDisplayName(std::string_view _displayName) {
|
||||
this->displayName = _displayName;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
to be unique in the context of this WUPSConfig.
|
||||
Items in different categories are NOT allowed to have the config ID.
|
||||
**/
|
||||
virtual void setConfigID(const std::string &_configID) {
|
||||
virtual void setConfigID(std::string_view _configID) {
|
||||
this->configID = _configID;
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ public:
|
||||
return defaultValue != getCurrentValueDisplay();
|
||||
}
|
||||
|
||||
WUPSConfigItem(const std::string &_configID, const std::string &_displayName, WUPSConfigCallbacks_t callbacks, void *_context) {
|
||||
WUPSConfigItem(std::string_view _configID, std::string_view _displayName, WUPSConfigCallbacks_t callbacks, void *_context) {
|
||||
this->configID = _configID;
|
||||
this->displayName = _displayName;
|
||||
this->context = _context;
|
||||
|
||||
Reference in New Issue
Block a user