[ox/{mc,oc}] Fix problems caused by making methods const

This commit is contained in:
Gary Talent 2021-07-29 23:19:58 -05:00
parent 11873bc3ed
commit d8a13a0933
5 changed files with 44 additions and 44 deletions

View File

@ -73,7 +73,7 @@ class MetalClawReader {
Error field(const char*, UnionView<U> val) noexcept; Error field(const char*, UnionView<U> val) noexcept;
template<std::size_t L> template<std::size_t L>
Error field(const char*, const BString<L> *val) noexcept; Error field(const char*, BString<L> *val) noexcept;
Error field(const char*, SerStr val) noexcept; Error field(const char*, SerStr val) noexcept;
@ -157,7 +157,7 @@ Error MetalClawReader::field(const char*, UnionView<U> val) noexcept {
} }
template<std::size_t L> template<std::size_t L>
Error MetalClawReader::field(const char *name, const BString<L> *val) noexcept { Error MetalClawReader::field(const char *name, BString<L> *val) noexcept {
return field(name, SerStr(val->data(), val->cap())); return field(name, SerStr(val->data(), val->cap()));
} }

View File

@ -28,40 +28,40 @@ MetalClawWriter::~MetalClawWriter() noexcept {
} }
} }
Error MetalClawWriter::field(const char*, const int8_t *val) noexcept { Error MetalClawWriter::field(const char*, int8_t *val) noexcept {
return appendInteger(*val); return appendInteger(*val);
} }
Error MetalClawWriter::field(const char*, const int16_t *val) noexcept { Error MetalClawWriter::field(const char*, int16_t *val) noexcept {
return appendInteger(*val); return appendInteger(*val);
} }
Error MetalClawWriter::field(const char*, const int32_t *val) noexcept { Error MetalClawWriter::field(const char*, int32_t *val) noexcept {
return appendInteger(*val); return appendInteger(*val);
} }
Error MetalClawWriter::field(const char*, const int64_t *val) noexcept { Error MetalClawWriter::field(const char*, int64_t *val) noexcept {
return appendInteger(*val); return appendInteger(*val);
} }
Error MetalClawWriter::field(const char*, const uint8_t *val) noexcept { Error MetalClawWriter::field(const char*, uint8_t *val) noexcept {
return appendInteger(*val); return appendInteger(*val);
} }
Error MetalClawWriter::field(const char*, const uint16_t *val) noexcept { Error MetalClawWriter::field(const char*, uint16_t *val) noexcept {
return appendInteger(*val); return appendInteger(*val);
} }
Error MetalClawWriter::field(const char*, const uint32_t *val) noexcept { Error MetalClawWriter::field(const char*, uint32_t *val) noexcept {
return appendInteger(*val); return appendInteger(*val);
} }
Error MetalClawWriter::field(const char*, const uint64_t *val) noexcept { Error MetalClawWriter::field(const char*, uint64_t *val) noexcept {
return appendInteger(*val); return appendInteger(*val);
} }
Error MetalClawWriter::field(const char*, const bool *val) noexcept { Error MetalClawWriter::field(const char*, bool *val) noexcept {
if (m_unionIdx == -1 || m_unionIdx == m_field) { if (m_unionIdx == -1 || m_unionIdx == m_field) {
oxReturnError(m_fieldPresence.set(m_field, *val)); oxReturnError(m_fieldPresence.set(m_field, *val));
} }

View File

@ -42,17 +42,17 @@ class MetalClawWriter {
~MetalClawWriter() noexcept; ~MetalClawWriter() noexcept;
Error field(const char*, const int8_t *val) noexcept; Error field(const char*, int8_t *val) noexcept;
Error field(const char*, const int16_t *val) noexcept; Error field(const char*, int16_t *val) noexcept;
Error field(const char*, const int32_t *val) noexcept; Error field(const char*, int32_t *val) noexcept;
Error field(const char*, const int64_t *val) noexcept; Error field(const char*, int64_t *val) noexcept;
Error field(const char*, const uint8_t *val) noexcept; Error field(const char*, uint8_t *val) noexcept;
Error field(const char*, const uint16_t *val) noexcept; Error field(const char*, uint16_t *val) noexcept;
Error field(const char*, const uint32_t *val) noexcept; Error field(const char*, uint32_t *val) noexcept;
Error field(const char*, const uint64_t *val) noexcept; Error field(const char*, uint64_t *val) noexcept;
Error field(const char*, const bool *val) noexcept; Error field(const char*, bool *val) noexcept;
template<typename T> template<typename T>
Error field(const char*, T *val, std::size_t len) noexcept; Error field(const char*, T *val, std::size_t len) noexcept;

View File

@ -18,7 +18,7 @@ OrganicClawWriter::OrganicClawWriter(Json::Value json, int unionIdx) noexcept:
m_unionIdx(unionIdx) { m_unionIdx(unionIdx) {
} }
Error OrganicClawWriter::field(const char *key, const int8_t *val) noexcept { Error OrganicClawWriter::field(const char *key, int8_t *val) noexcept {
if (*val) { if (*val) {
value(key) = *val; value(key) = *val;
} }
@ -26,7 +26,7 @@ Error OrganicClawWriter::field(const char *key, const int8_t *val) noexcept {
return OxError(0); return OxError(0);
} }
Error OrganicClawWriter::field(const char *key, const int16_t *val) noexcept { Error OrganicClawWriter::field(const char *key, int16_t *val) noexcept {
if (*val) { if (*val) {
value(key) = *val; value(key) = *val;
} }
@ -34,7 +34,7 @@ Error OrganicClawWriter::field(const char *key, const int16_t *val) noexcept {
return OxError(0); return OxError(0);
} }
Error OrganicClawWriter::field(const char *key, const int32_t *val) noexcept { Error OrganicClawWriter::field(const char *key, int32_t *val) noexcept {
if (*val) { if (*val) {
value(key) = *val; value(key) = *val;
} }
@ -42,7 +42,7 @@ Error OrganicClawWriter::field(const char *key, const int32_t *val) noexcept {
return OxError(0); return OxError(0);
} }
Error OrganicClawWriter::field(const char *key, const int64_t *val) noexcept { Error OrganicClawWriter::field(const char *key, int64_t *val) noexcept {
if (*val) { if (*val) {
value(key) = *val; value(key) = *val;
} }
@ -51,7 +51,7 @@ Error OrganicClawWriter::field(const char *key, const int64_t *val) noexcept {
} }
Error OrganicClawWriter::field(const char *key, const uint8_t *val) noexcept { Error OrganicClawWriter::field(const char *key, uint8_t *val) noexcept {
if (*val) { if (*val) {
value(key) = *val; value(key) = *val;
} }
@ -59,7 +59,7 @@ Error OrganicClawWriter::field(const char *key, const uint8_t *val) noexcept {
return OxError(0); return OxError(0);
} }
Error OrganicClawWriter::field(const char *key, const uint16_t *val) noexcept { Error OrganicClawWriter::field(const char *key, uint16_t *val) noexcept {
if (targetValid() && *val) { if (targetValid() && *val) {
value(key) = *val; value(key) = *val;
} }
@ -67,7 +67,7 @@ Error OrganicClawWriter::field(const char *key, const uint16_t *val) noexcept {
return OxError(0); return OxError(0);
} }
Error OrganicClawWriter::field(const char *key, const uint32_t *val) noexcept { Error OrganicClawWriter::field(const char *key, uint32_t *val) noexcept {
if (targetValid() && *val) { if (targetValid() && *val) {
value(key) = *val; value(key) = *val;
} }
@ -75,7 +75,7 @@ Error OrganicClawWriter::field(const char *key, const uint32_t *val) noexcept {
return OxError(0); return OxError(0);
} }
Error OrganicClawWriter::field(const char *key, const uint64_t *val) noexcept { Error OrganicClawWriter::field(const char *key, uint64_t *val) noexcept {
if (targetValid() && *val) { if (targetValid() && *val) {
value(key) = *val; value(key) = *val;
} }
@ -83,7 +83,7 @@ Error OrganicClawWriter::field(const char *key, const uint64_t *val) noexcept {
return OxError(0); return OxError(0);
} }
Error OrganicClawWriter::field(const char *key, const bool *val) noexcept { Error OrganicClawWriter::field(const char *key, bool *val) noexcept {
if (targetValid() && *val) { if (targetValid() && *val) {
value(key) = *val; value(key) = *val;
} }
@ -91,7 +91,7 @@ Error OrganicClawWriter::field(const char *key, const bool *val) noexcept {
return OxError(0); return OxError(0);
} }
Error OrganicClawWriter::field(const char *key, const String *val) noexcept { Error OrganicClawWriter::field(const char *key, String *val) noexcept {
if (targetValid() && val->len()) { if (targetValid() && val->len()) {
value(key) = val->c_str(); value(key) = val->c_str();
} }

View File

@ -35,17 +35,17 @@ class OrganicClawWriter {
explicit OrganicClawWriter(Json::Value json, int unionIdx = -1) noexcept; explicit OrganicClawWriter(Json::Value json, int unionIdx = -1) noexcept;
Error field(const char*, const int8_t *val) noexcept; Error field(const char*, int8_t *val) noexcept;
Error field(const char*, const int16_t *val) noexcept; Error field(const char*, int16_t *val) noexcept;
Error field(const char*, const int32_t *val) noexcept; Error field(const char*, int32_t *val) noexcept;
Error field(const char*, const int64_t *val) noexcept; Error field(const char*, int64_t *val) noexcept;
Error field(const char*, const uint8_t *val) noexcept; Error field(const char*, uint8_t *val) noexcept;
Error field(const char*, const uint16_t *val) noexcept; Error field(const char*, uint16_t *val) noexcept;
Error field(const char*, const uint32_t *val) noexcept; Error field(const char*, uint32_t *val) noexcept;
Error field(const char*, const uint64_t *val) noexcept; Error field(const char*, uint64_t *val) noexcept;
Error field(const char*, const bool *val) noexcept; Error field(const char*, bool *val) noexcept;
template<typename T> template<typename T>
Error field(const char*, T *val, std::size_t len) noexcept; Error field(const char*, T *val, std::size_t len) noexcept;
@ -54,12 +54,12 @@ class OrganicClawWriter {
Error field(const char*, UnionView<U> val) noexcept; Error field(const char*, UnionView<U> val) noexcept;
template<typename T> template<typename T>
Error field(const char*, const HashMap<String, T> *val) noexcept; Error field(const char*, HashMap<String, T> *val) noexcept;
template<std::size_t L> template<std::size_t L>
Error field(const char*, const BString<L> *val) noexcept; Error field(const char*, BString<L> *val) noexcept;
Error field(const char*, const String *val) noexcept; Error field(const char*, String *val) noexcept;
Error field(const char*, SerStr val) noexcept; Error field(const char*, SerStr val) noexcept;
@ -99,7 +99,7 @@ Error OrganicClawWriter::field(const char *key, T *val, std::size_t len) noexcep
} }
template<std::size_t L> template<std::size_t L>
Error OrganicClawWriter::field(const char *key, const BString<L> *val) noexcept { Error OrganicClawWriter::field(const char *key, BString<L> *val) noexcept {
return field(key, SerStr(val->data(), val->cap())); return field(key, SerStr(val->data(), val->cap()));
} }
@ -132,7 +132,7 @@ Error OrganicClawWriter::field(const char *key, UnionView<U> val) noexcept {
} }
template<typename T> template<typename T>
Error OrganicClawWriter::field(const char *key, const HashMap<String, T> *val) noexcept { Error OrganicClawWriter::field(const char *key, HashMap<String, T> *val) noexcept {
if (targetValid()) { if (targetValid()) {
const auto &keys = val->keys(); const auto &keys = val->keys();
OrganicClawWriter w; OrganicClawWriter w;