From fc9726b3ec1f06cb4b1ed92467aba0187607fd1c Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Fri, 2 Feb 2018 01:30:56 -0600 Subject: [PATCH] Rename bstring to BString for consistency --- deps/ox/src/ox/mc/read.hpp | 4 ++-- deps/ox/src/ox/mc/test/tests.cpp | 4 ++-- deps/ox/src/ox/mc/write.hpp | 4 ++-- deps/ox/src/ox/std/string.hpp | 30 +++++++++++++++--------------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/deps/ox/src/ox/mc/read.hpp b/deps/ox/src/ox/mc/read.hpp index 1317c107..502150cc 100644 --- a/deps/ox/src/ox/mc/read.hpp +++ b/deps/ox/src/ox/mc/read.hpp @@ -51,7 +51,7 @@ class MetalClawReader { int op(const char*, T *val); template - int op(const char*, ox::bstring *val); + int op(const char*, ox::BString *val); size_t arrayLength(const char*); @@ -82,7 +82,7 @@ int MetalClawReader::op(const char*, T *val) { }; template -int MetalClawReader::op(const char*, ox::bstring *val) { +int MetalClawReader::op(const char*, ox::BString *val) { int err = 0; if (m_fieldPresence.get(m_field)) { // read the length diff --git a/deps/ox/src/ox/mc/test/tests.cpp b/deps/ox/src/ox/mc/test/tests.cpp index 74f7c194..8d9f494f 100644 --- a/deps/ox/src/ox/mc/test/tests.cpp +++ b/deps/ox/src/ox/mc/test/tests.cpp @@ -20,7 +20,7 @@ using namespace ox; struct TestStructNest { bool Bool = false; uint32_t Int = 0; - bstring<32> String = ""; + BString<32> String = ""; }; struct TestStruct { @@ -34,7 +34,7 @@ struct TestStruct { int32_t Int6 = 0; int32_t Int7 = 0; int32_t Int8 = 0; - bstring<32> String = ""; + BString<32> String = ""; uint32_t List[4] = {0, 0, 0 , 0}; TestStructNest EmptyStruct; TestStructNest Struct; diff --git a/deps/ox/src/ox/mc/write.hpp b/deps/ox/src/ox/mc/write.hpp index 9c892915..ef5a3110 100644 --- a/deps/ox/src/ox/mc/write.hpp +++ b/deps/ox/src/ox/mc/write.hpp @@ -45,7 +45,7 @@ class MetalClawWriter { int op(const char*, T *val, size_t len); template - int op(const char*, ox::bstring *val); + int op(const char*, ox::BString *val); template int op(const char*, T *val); @@ -64,7 +64,7 @@ class MetalClawWriter { }; template -int MetalClawWriter::op(const char*, ox::bstring *val) { +int MetalClawWriter::op(const char*, ox::BString *val) { int err = 0; bool fieldSet = false; if (val->len()) { diff --git a/deps/ox/src/ox/std/string.hpp b/deps/ox/src/ox/std/string.hpp index 4065d67e..2677d46c 100644 --- a/deps/ox/src/ox/std/string.hpp +++ b/deps/ox/src/ox/std/string.hpp @@ -16,20 +16,20 @@ namespace ox { // Bounded String template -class bstring { +class BString { private: uint8_t m_buff[buffLen]; public: - bstring(); + BString(); - bstring(const char *str); + BString(const char *str); - const bstring &operator=(const char *str); + const BString &operator=(const char *str); - const bstring &operator=(char *str); + const BString &operator=(char *str); - bool operator==(const bstring &other); + bool operator==(const BString &other); char *data(); @@ -50,17 +50,17 @@ class bstring { }; template -bstring::bstring() { +BString::BString() { m_buff[0] = 0; } template -bstring::bstring(const char *str) { +BString::BString(const char *str) { *this = str; } template -const bstring &bstring::operator=(const char *str) { +const BString &BString::operator=(const char *str) { size_t strLen = ox_strlen(str) + 1; if (cap() < strLen) { strLen = cap(); @@ -72,12 +72,12 @@ const bstring &bstring::operator=(const char *str) { } template -const bstring &bstring::operator=(char *str) { +const BString &BString::operator=(char *str) { return *this = (const char*) str; } template -bool bstring::operator==(const bstring &other) { +bool BString::operator==(const BString &other) { bool retval = true; size_t i = 0; while (i < buffLen && (m_buff[i] || other.m_buff[i])) { @@ -91,12 +91,12 @@ bool bstring::operator==(const bstring &other) { } template -char *bstring::data() { +char *BString::data() { return (char*) m_buff; } template -size_t bstring::len() { +size_t BString::len() { size_t length = 0; for (size_t i = 0; i < buffLen; i++) { uint8_t b = m_buff[i]; @@ -114,14 +114,14 @@ size_t bstring::len() { } template -size_t bstring::size() { +size_t BString::size() { size_t i; for (i = 0; i < buffLen && m_buff[i]; i++); return i + 1; // add one for null terminator } template -size_t bstring::cap() { +size_t BString::cap() { return buffLen; }