Move everything into the WUPSBackend namespace

This commit is contained in:
Maschell 2023-02-17 12:03:27 +01:00
parent c8acaac6a7
commit 2da2336082
7 changed files with 116 additions and 103 deletions

View File

@ -24,9 +24,10 @@
#include "PluginData.h" #include "PluginData.h"
#include "PluginMetaInformation.h" #include "PluginMetaInformation.h"
class PluginContainer { namespace WUPSBackend {
class PluginContainer {
public: public:
PluginContainer(std::shared_ptr<PluginData> data, std::shared_ptr<PluginMetaInformation> metaInfo) : pluginData(std::move(data)), PluginContainer(std::shared_ptr<PluginData> data, std::shared_ptr<PluginMetaInformation> metaInfo) : pluginData(std::move(data)),
metaInformation(std::move(metaInfo)) { metaInformation(std::move(metaInfo)) {
} }
@ -41,4 +42,5 @@ public:
const std::shared_ptr<PluginData> pluginData; const std::shared_ptr<PluginData> pluginData;
const std::shared_ptr<PluginMetaInformation> metaInformation; const std::shared_ptr<PluginMetaInformation> metaInformation;
}; };
} // namespace WUPSBackend

View File

@ -19,9 +19,10 @@
#include <cstdint> #include <cstdint>
#include <wups_backend/import_defines.h> #include <wups_backend/import_defines.h>
class PluginData { namespace WUPSBackend {
class PluginData {
public: public:
explicit PluginData(uint32_t handle); explicit PluginData(uint32_t handle);
~PluginData(); ~PluginData();
@ -30,4 +31,5 @@ public:
} }
uint32_t handle; uint32_t handle;
}; };
} // namespace WUPSBackend

View File

@ -21,8 +21,9 @@
#include <string> #include <string>
#include <vector> #include <vector>
class PluginMetaInformation { namespace WUPSBackend {
public: class PluginMetaInformation {
public:
[[nodiscard]] const std::string &getName() const { [[nodiscard]] const std::string &getName() const {
return name; return name;
} }
@ -64,7 +65,7 @@ public:
std::string storageId, std::string storageId,
size_t size); size_t size);
private: private:
PluginMetaInformation() = default; PluginMetaInformation() = default;
void setName(std::string name_) { void setName(std::string name_) {
@ -107,4 +108,5 @@ private:
std::string description; std::string description;
std::string storageId; std::string storageId;
size_t size{}; size_t size{};
}; };
} // namespace WUPSBackend

View File

@ -20,8 +20,9 @@
#include "PluginMetaInformation.h" #include "PluginMetaInformation.h"
#include <optional> #include <optional>
class PluginUtils { namespace WUPSBackend {
public: class PluginUtils {
public:
static std::optional<std::unique_ptr<PluginMetaInformation>> getMetaInformationForBuffer(char *buffer, size_t size); static std::optional<std::unique_ptr<PluginMetaInformation>> getMetaInformationForBuffer(char *buffer, size_t size);
static std::optional<std::unique_ptr<PluginMetaInformation>> getMetaInformationForPath(const std::string &path); static std::optional<std::unique_ptr<PluginMetaInformation>> getMetaInformationForPath(const std::string &path);
@ -33,4 +34,5 @@ public:
static std::optional<std::unique_ptr<PluginContainer>> getPluginForBuffer(char *buffer, size_t size); static std::optional<std::unique_ptr<PluginContainer>> getPluginForBuffer(char *buffer, size_t size);
static int32_t LoadAndLinkOnRestart(const std::vector<std::unique_ptr<PluginContainer>> &plugins); static int32_t LoadAndLinkOnRestart(const std::vector<std::unique_ptr<PluginContainer>> &plugins);
}; };
} // namespace WUPSBackend

View File

@ -20,6 +20,8 @@
#include "logger.h" #include "logger.h"
#include <coreinit/debug.h> #include <coreinit/debug.h>
using namespace WUPSBackend;
PluginData::PluginData(uint32_t handle) { PluginData::PluginData(uint32_t handle) {
this->handle = handle; this->handle = handle;
} }

View File

@ -18,9 +18,10 @@
#include "wups_backend/PluginMetaInformation.h" #include "wups_backend/PluginMetaInformation.h"
#include <cstring> #include <cstring>
#include <optional>
#include <utility> #include <utility>
using namespace WUPSBackend;
PluginMetaInformation::PluginMetaInformation(std::string name, PluginMetaInformation::PluginMetaInformation(std::string name,
std::string author, std::string author,
std::string version, std::string version,

View File

@ -22,6 +22,8 @@
#include <cstring> #include <cstring>
#include <memory> #include <memory>
using namespace WUPSBackend;
std::optional<std::unique_ptr<PluginMetaInformation>> getMetaInformation(const plugin_information &info) { std::optional<std::unique_ptr<PluginMetaInformation>> getMetaInformation(const plugin_information &info) {
if (info.plugin_information_version != PLUGIN_INFORMATION_VERSION) { if (info.plugin_information_version != PLUGIN_INFORMATION_VERSION) {
DEBUG_FUNCTION_LINE_ERR("Version mismatch"); DEBUG_FUNCTION_LINE_ERR("Version mismatch");