[ox] Add const char *const* fieldString handlers to OC and MC writers
This commit is contained in:
parent
6b9d9c50c7
commit
1302d5bf85
10
deps/ox/src/ox/mc/write.hpp
vendored
10
deps/ox/src/ox/mc/write.hpp
vendored
@ -76,10 +76,12 @@ class MetalClawWriter {
|
|||||||
template<std::size_t L>
|
template<std::size_t L>
|
||||||
constexpr Error field(const char*, BString<L> *val) noexcept;
|
constexpr Error field(const char*, BString<L> *val) noexcept;
|
||||||
|
|
||||||
constexpr Error fieldCString(const char *name, const char **val, std::size_t buffLen) noexcept;
|
constexpr Error fieldCString(const char *name, const char *const*val, std::size_t buffLen) noexcept;
|
||||||
|
|
||||||
constexpr Error fieldCString(const char *name, const char **val) noexcept;
|
constexpr Error fieldCString(const char *name, const char **val) noexcept;
|
||||||
|
|
||||||
|
constexpr Error fieldCString(const char *name, const char *const*val) noexcept;
|
||||||
|
|
||||||
constexpr Error fieldCString(const char *name, const char *val, std::size_t len) noexcept;
|
constexpr Error fieldCString(const char *name, const char *val, std::size_t len) noexcept;
|
||||||
|
|
||||||
constexpr Error fieldCString(const char *name, char **val, std::size_t buffLen) noexcept {
|
constexpr Error fieldCString(const char *name, char **val, std::size_t buffLen) noexcept {
|
||||||
@ -223,7 +225,7 @@ constexpr Error MetalClawWriter::field(const char *name, BString<L> *val) noexce
|
|||||||
return fieldCString(name, val->data(), val->cap());
|
return fieldCString(name, val->data(), val->cap());
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Error MetalClawWriter::fieldCString(const char*, const char **val, std::size_t) noexcept {
|
constexpr Error MetalClawWriter::fieldCString(const char*, const char *const*val, std::size_t) noexcept {
|
||||||
bool fieldSet = false;
|
bool fieldSet = false;
|
||||||
if (m_unionIdx == -1 || m_unionIdx == m_field) {
|
if (m_unionIdx == -1 || m_unionIdx == m_field) {
|
||||||
const auto strLen = *val ? ox_strlen(*val) : 0;
|
const auto strLen = *val ? ox_strlen(*val) : 0;
|
||||||
@ -249,6 +251,10 @@ constexpr Error MetalClawWriter::fieldCString(const char *name, const char **val
|
|||||||
return fieldCString(name, val, {});
|
return fieldCString(name, val, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr Error MetalClawWriter::fieldCString(const char *name, const char *const*val) noexcept {
|
||||||
|
return fieldCString(name, val, {});
|
||||||
|
}
|
||||||
|
|
||||||
constexpr Error MetalClawWriter::fieldCString(const char*, const char *val, std::size_t strLen) noexcept {
|
constexpr Error MetalClawWriter::fieldCString(const char*, const char *val, std::size_t strLen) noexcept {
|
||||||
bool fieldSet = false;
|
bool fieldSet = false;
|
||||||
if (strLen && (m_unionIdx == -1 || m_unionIdx == m_field)) {
|
if (strLen && (m_unionIdx == -1 || m_unionIdx == m_field)) {
|
||||||
|
4
deps/ox/src/ox/model/modelhandleradaptor.hpp
vendored
4
deps/ox/src/ox/model/modelhandleradaptor.hpp
vendored
@ -43,6 +43,10 @@ class ModelHandlerInterface {
|
|||||||
return m_handler->fieldCString(name, val);
|
return m_handler->fieldCString(name, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr Error fieldCString(const char *name, const char *const*val) noexcept {
|
||||||
|
return m_handler->fieldCString(name, val);
|
||||||
|
}
|
||||||
|
|
||||||
constexpr Error fieldCString(const char *name, const char **val) noexcept {
|
constexpr Error fieldCString(const char *name, const char **val) noexcept {
|
||||||
return m_handler->fieldCString(name, val);
|
return m_handler->fieldCString(name, val);
|
||||||
}
|
}
|
||||||
|
4
deps/ox/src/ox/oc/write.cpp
vendored
4
deps/ox/src/ox/oc/write.cpp
vendored
@ -26,7 +26,7 @@ Error OrganicClawWriter::field(const char *key, SerStr val) noexcept {
|
|||||||
return OxError(0);
|
return OxError(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Error OrganicClawWriter::fieldCString(const char *key, const char **val, int len) noexcept {
|
Error OrganicClawWriter::fieldCString(const char *key, const char *const*val, int len) noexcept {
|
||||||
if (targetValid() && len) {
|
if (targetValid() && len) {
|
||||||
value(key) = *val;
|
value(key) = *val;
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ Error OrganicClawWriter::fieldCString(const char *key, char **val, int len) noex
|
|||||||
return fieldCString(key, const_cast<const char**>(val), len);
|
return fieldCString(key, const_cast<const char**>(val), len);
|
||||||
}
|
}
|
||||||
|
|
||||||
Error OrganicClawWriter::fieldCString(const char *key, const char **val) noexcept {
|
Error OrganicClawWriter::fieldCString(const char *key, const char *const*val) noexcept {
|
||||||
return fieldCString(key, const_cast<const char**>(val), {});
|
return fieldCString(key, const_cast<const char**>(val), {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
deps/ox/src/ox/oc/write.hpp
vendored
4
deps/ox/src/ox/oc/write.hpp
vendored
@ -164,11 +164,11 @@ class OrganicClawWriter {
|
|||||||
|
|
||||||
Error field(const char*, SerStr val) noexcept;
|
Error field(const char*, SerStr val) noexcept;
|
||||||
|
|
||||||
Error fieldCString(const char*, const char **val, int len) noexcept;
|
Error fieldCString(const char*, const char *const*val, int len) noexcept;
|
||||||
|
|
||||||
Error fieldCString(const char *name, char **val, int len) noexcept;
|
Error fieldCString(const char *name, char **val, int len) noexcept;
|
||||||
|
|
||||||
Error fieldCString(const char *name, const char **val) noexcept;
|
Error fieldCString(const char *name, const char *const*val) noexcept;
|
||||||
|
|
||||||
Error fieldCString(const char *name, char **val) noexcept;
|
Error fieldCString(const char *name, char **val) noexcept;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user