[ox/ser] Rename McStr to SerStr

This commit is contained in:
Gary Talent 2019-03-08 21:26:21 -06:00
parent 4330c015a5
commit 538fcdb43c
8 changed files with 13 additions and 16 deletions

View File

@ -65,7 +65,7 @@ Error MetalClawReader::op(const char*, bool *val) {
return 0;
}
Error MetalClawReader::op(const char*, McStr val) {
Error MetalClawReader::op(const char*, SerStr val) {
if (m_fieldPresence.get(m_field)) {
// read the length
StringLength size = 0;

View File

@ -61,7 +61,7 @@ class MetalClawReader {
template<std::size_t L>
Error op(const char*, ox::BString<L> *val);
Error op(const char*, McStr val);
Error op(const char*, SerStr val);
/**
* Reads an array length from the current location in the buffer.
@ -116,7 +116,7 @@ Error MetalClawReader::op(const char*, T *val) {
template<std::size_t L>
Error MetalClawReader::op(const char *name, ox::BString<L> *val) {
return op(name, McStr(val->data(), val->cap()));
return op(name, SerStr(val->data(), val->cap()));
}
template<typename I>

View File

@ -230,7 +230,7 @@ std::map<std::string, ox::Error(*)()> tests = {
case ox::PrimitiveType::String: {
ox::Vector<char> v(rdr->stringLength());
//std::cout << rdr->stringLength() << '\n';
oxAssert(rdr->op(fieldName, ox::McStr(v.data(), v.size())), "Walking ioOp failed.");
oxAssert(rdr->op(fieldName, ox::SerStr(v.data(), v.size())), "Walking ioOp failed.");
std::cout << fieldName << ":\t" << "string: " << v.data() << '\n';
break;
}

View File

@ -60,7 +60,7 @@ Error MetalClawWriter::op(const char*, bool *val) {
return m_fieldPresence.set(m_field++, *val);
}
Error MetalClawWriter::op(const char*, McStr val) {
Error MetalClawWriter::op(const char*, SerStr val) {
int err = 0;
bool fieldSet = false;
if (val.cap()) {

View File

@ -57,7 +57,7 @@ class MetalClawWriter {
template<std::size_t L>
Error op(const char*, ox::BString<L> *val);
Error op(const char*, McStr val);
Error op(const char*, SerStr val);
template<typename T>
int op(const char*, T *val);
@ -77,7 +77,7 @@ class MetalClawWriter {
template<std::size_t L>
Error MetalClawWriter::op(const char *name, ox::BString<L> *val) {
return op(name, McStr(val->data(), val->cap()));
return op(name, SerStr(val->data(), val->cap()));
}
template<typename T>

View File

@ -108,7 +108,7 @@ DescriptorType *TypeDescWriter::type(const char*, bool *alreadyExisted) {
return getType(TypeName, PT, 0, alreadyExisted);
}
DescriptorType *TypeDescWriter::type(McStr, bool *alreadyExisted) {
DescriptorType *TypeDescWriter::type(SerStr, bool *alreadyExisted) {
constexpr auto TypeName = "B:string";
constexpr auto PT = PrimitiveType::String;
return getType(TypeName, PT, 0, alreadyExisted);

View File

@ -97,7 +97,7 @@ class TypeDescWriter {
DescriptorType *type(const char *val, bool *alreadyExisted);
DescriptorType *type(McStr val, bool *alreadyExisted);
DescriptorType *type(SerStr val, bool *alreadyExisted);
template<std::size_t sz>
DescriptorType *type(BString<sz> *val, bool *alreadyExisted);
@ -144,7 +144,7 @@ ox::Error TypeDescWriter::op(const char *name, T *val) {
template<std::size_t sz>
DescriptorType *TypeDescWriter::type(BString<sz> *val, bool *alreadyExisted) {
return type(McStr(val), alreadyExisted);
return type(SerStr(val), alreadyExisted);
}
template<typename T>

View File

@ -14,10 +14,7 @@
namespace ox {
using StringLength = uint32_t;
using ArrayLength = uint32_t;
class McStr {
class SerStr {
protected:
int m_cap = 0;
@ -25,12 +22,12 @@ class McStr {
public:
template<std::size_t sz>
constexpr McStr(BString<sz> *str) noexcept {
constexpr SerStr(BString<sz> *str) noexcept {
m_str = str->data();
m_cap = str->cap();
}
constexpr McStr(char *str, int cap) noexcept {
constexpr SerStr(char *str, int cap) noexcept {
m_str = str;
m_cap = cap;
}