[ox/oc] Replace std::unique_ptr usage with ox::UniquePtr
This commit is contained in:
parent
2b579c58bb
commit
841a7436c1
11
deps/ox/src/ox/oc/read.hpp
vendored
11
deps/ox/src/ox/oc/read.hpp
vendored
@ -15,6 +15,7 @@
|
|||||||
#include <ox/std/byteswap.hpp>
|
#include <ox/std/byteswap.hpp>
|
||||||
#include <ox/std/hashmap.hpp>
|
#include <ox/std/hashmap.hpp>
|
||||||
#include <ox/std/memops.hpp>
|
#include <ox/std/memops.hpp>
|
||||||
|
#include <ox/std/memory.hpp>
|
||||||
#include <ox/std/string.hpp>
|
#include <ox/std/string.hpp>
|
||||||
#include <ox/std/vector.hpp>
|
#include <ox/std/vector.hpp>
|
||||||
|
|
||||||
@ -78,7 +79,8 @@ class OrganicClawReader {
|
|||||||
/**
|
/**
|
||||||
* Reads an string length from the current location in the buffer.
|
* Reads an string length from the current location in the buffer.
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] std::size_t stringLength(const char *name);
|
[[nodiscard]]
|
||||||
|
std::size_t stringLength(const char *name);
|
||||||
|
|
||||||
template<typename T = void>
|
template<typename T = void>
|
||||||
constexpr void setTypeInfo(const char* = T::TypeName, int = T::Fields) {
|
constexpr void setTypeInfo(const char* = T::TypeName, int = T::Fields) {
|
||||||
@ -87,7 +89,8 @@ class OrganicClawReader {
|
|||||||
/**
|
/**
|
||||||
* Returns a OrganicClawReader to parse a child object.
|
* Returns a OrganicClawReader to parse a child object.
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] OrganicClawReader child(const char *key, int unionIdx = -1);
|
[[nodiscard]]
|
||||||
|
OrganicClawReader child(const char *key, int unionIdx = -1);
|
||||||
|
|
||||||
// compatibility stub
|
// compatibility stub
|
||||||
constexpr void nextField() noexcept {}
|
constexpr void nextField() noexcept {}
|
||||||
@ -196,8 +199,8 @@ Error readOC(const char *json, std::size_t jsonSize, T *val) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Result<std::unique_ptr<T>> readOC(const char *json) {
|
Result<ox::UniquePtr<T>> readOC(const char *json) {
|
||||||
auto val = std::make_unique<T>();
|
auto val = ox::make_unique<T>();
|
||||||
oxReturnError(readOC(json, ox_strlen(json), val.get()));
|
oxReturnError(readOC(json, ox_strlen(json), val.get()));
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user