mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
Address some fo the feedback
This commit is contained in:
@@ -18,9 +18,6 @@
|
||||
#include "dPlatforms.h"
|
||||
#include "Game.h"
|
||||
#include "Logger.h"
|
||||
#include "json.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
enum eInventoryType : uint32_t;
|
||||
enum class eObjectBits : size_t;
|
||||
@@ -263,20 +260,6 @@ namespace GeneralUtils {
|
||||
return (str.size() == 3) ? TryParse<NiPoint3>(str[0], str[1], str[2]) : std::nullopt;
|
||||
}
|
||||
|
||||
/**
|
||||
* The TryParse overload for handling json parsing
|
||||
* @param str The string that is the json to parse
|
||||
* @returns An std::optional containing the desired json if it can be parsed from the string
|
||||
*/
|
||||
template <typename T>
|
||||
[[nodiscard]] std::optional<json> TryParse(const std::string_view str) {
|
||||
try {
|
||||
return json::parse(str);
|
||||
} catch (const std::exception& e) {
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::u16string to_u16string(const T value) {
|
||||
return GeneralUtils::ASCIIToUTF16(std::to_string(value));
|
||||
|
Reference in New Issue
Block a user