diff --git a/src/ox/claw/read.cpp b/src/ox/claw/read.cpp index 4b2ab9c1c..c2c4aeee7 100644 --- a/src/ox/claw/read.cpp +++ b/src/ox/claw/read.cpp @@ -64,7 +64,7 @@ Result stripClawHeader(const char *buff, std::size_t buffLen) noexcept { oxReturnError(header); Buffer out(header.value.dataSize); ox_memcpy(out.data(), header.value.data, out.size()); - return ox::move(out); + return move(out); } } diff --git a/src/ox/fs/filestore/filestoretemplate.hpp b/src/ox/fs/filestore/filestoretemplate.hpp index 6c0254833..391caae0e 100644 --- a/src/ox/fs/filestore/filestoretemplate.hpp +++ b/src/ox/fs/filestore/filestoretemplate.hpp @@ -24,11 +24,11 @@ struct StatInfo { template struct OX_PACKED FileStoreItem: public ptrarith::Item { - ox::LittleEndian id = 0; - ox::LittleEndian fileType = 0; - ox::LittleEndian links = 0; - ox::LittleEndian left = 0; - ox::LittleEndian right = 0; + LittleEndian id = 0; + LittleEndian fileType = 0; + LittleEndian links = 0; + LittleEndian left = 0; + LittleEndian right = 0; FileStoreItem() = default; @@ -65,8 +65,8 @@ class FileStoreTemplate { static constexpr auto MaxInode = MaxValue / 2; struct OX_PACKED FileStoreData { - ox::LittleEndian rootNode = 0; - ox::Random random; + LittleEndian rootNode = 0; + Random random; }; size_t m_buffSize = 0; diff --git a/src/ox/fs/filesystem/filesystem.cpp b/src/ox/fs/filesystem/filesystem.cpp index e29ab8b4d..d68945470 100644 --- a/src/ox/fs/filesystem/filesystem.cpp +++ b/src/ox/fs/filesystem/filesystem.cpp @@ -56,7 +56,7 @@ Error FileSystem::read(const FileAddress &addr, std::size_t readStart, std::size } } -Result> FileSystem::ls(const ox::String &dir) noexcept { +Result> FileSystem::ls(const String &dir) noexcept { return ls(dir.c_str()); } diff --git a/src/ox/fs/filesystem/filesystem.hpp b/src/ox/fs/filesystem/filesystem.hpp index 5d9b25f78..e12086bd3 100644 --- a/src/ox/fs/filesystem/filesystem.hpp +++ b/src/ox/fs/filesystem/filesystem.hpp @@ -50,7 +50,7 @@ class FileSystem { Result directAccess(const FileAddress &addr) noexcept; - Result> ls(const ox::String &dir) noexcept; + Result> ls(const String &dir) noexcept; virtual Result> ls(const char *dir) noexcept = 0; diff --git a/src/ox/fs/filesystem/passthroughfs.cpp b/src/ox/fs/filesystem/passthroughfs.cpp index 97a829683..f1f116314 100644 --- a/src/ox/fs/filesystem/passthroughfs.cpp +++ b/src/ox/fs/filesystem/passthroughfs.cpp @@ -23,7 +23,7 @@ PassThroughFS::PassThroughFS(const char *dirPath) { PassThroughFS::~PassThroughFS() { } -ox::String PassThroughFS::basePath() { +String PassThroughFS::basePath() { return m_path.string().c_str(); } @@ -101,7 +101,7 @@ Result> PassThroughFS::ls(const char *dir) noexcept { oxReturnError(OxError(ec.value(), "PassThroughFS: ls failed")); for (auto &p : di) { auto u8p = p.path().filename().u8string(); - out.emplace_back(ox::bit_cast(u8p.c_str())); + out.emplace_back(bit_cast(u8p.c_str())); } return ox::move(out); } diff --git a/src/ox/fs/filesystem/passthroughfs.hpp b/src/ox/fs/filesystem/passthroughfs.hpp index e60c73e40..a1f0ad022 100644 --- a/src/ox/fs/filesystem/passthroughfs.hpp +++ b/src/ox/fs/filesystem/passthroughfs.hpp @@ -35,7 +35,7 @@ class PassThroughFS: public FileSystem { ~PassThroughFS(); [[nodiscard]] - ox::String basePath(); + String basePath(); Error mkdir(const char *path, bool recursive = false) noexcept override; @@ -95,7 +95,7 @@ Error PassThroughFS::ls(const char *dir, F cb) noexcept { oxReturnError(OxError(ec.value(), "PassThroughFS: ls failed")); for (auto &p : di) { auto u8p = p.path().filename().u8string(); - oxReturnError(cb(ox::bit_cast(u8p.c_str()), 0)); + oxReturnError(cb(bit_cast(u8p.c_str()), 0)); } return OxError(0); } diff --git a/src/ox/fs/ptrarith/nodebuffer.hpp b/src/ox/fs/ptrarith/nodebuffer.hpp index c289910f7..0af778137 100644 --- a/src/ox/fs/ptrarith/nodebuffer.hpp +++ b/src/ox/fs/ptrarith/nodebuffer.hpp @@ -20,9 +20,9 @@ class OX_PACKED NodeBuffer { public: struct OX_PACKED Header { - ox::LittleEndian size = sizeof(Header); // capacity - ox::LittleEndian bytesUsed = sizeof(Header); - ox::LittleEndian firstItem = 0; + LittleEndian size = sizeof(Header); // capacity + LittleEndian bytesUsed = sizeof(Header); + LittleEndian firstItem = 0; }; using ItemPtr = Ptr; @@ -435,11 +435,11 @@ uint8_t *NodeBuffer::data() noexcept { template struct OX_PACKED Item { public: - ox::LittleEndian prev = 0; - ox::LittleEndian next = 0; + LittleEndian prev = 0; + LittleEndian next = 0; private: - ox::LittleEndian m_size = sizeof(Item); + LittleEndian m_size = sizeof(Item); public: size_t size() const { diff --git a/src/ox/model/desctypes.hpp b/src/ox/model/desctypes.hpp index 4cdce649d..dea7e78a2 100644 --- a/src/ox/model/desctypes.hpp +++ b/src/ox/model/desctypes.hpp @@ -179,6 +179,6 @@ Error modelRead(T *io, DescriptorField *field) { return err; } -using TypeStore = ox::HashMap; +using TypeStore = HashMap; } diff --git a/src/ox/model/descwrite.hpp b/src/ox/model/descwrite.hpp index d4a44b2e1..d76f38b6c 100644 --- a/src/ox/model/descwrite.hpp +++ b/src/ox/model/descwrite.hpp @@ -145,7 +145,7 @@ class TypeDescWriter { template Error TypeDescWriter::field(const char *name, T *val, std::size_t) { if (m_type) { - constexpr typename ox::remove_pointer::type *p = nullptr; + constexpr typename remove_pointer::type *p = nullptr; bool alreadyExisted = false; const auto t = type(p, &alreadyExisted); oxAssert(t != nullptr, "field(const char *name, T *val, std::size_t): Type not found or generated"); diff --git a/src/ox/model/optype.hpp b/src/ox/model/optype.hpp index 64a7fbc2a..4a2856cd0 100644 --- a/src/ox/model/optype.hpp +++ b/src/ox/model/optype.hpp @@ -40,11 +40,11 @@ constexpr Error modelWriteDefinition(T*, O*) { template constexpr Error model(T *io, O *obj) { Error err; - if constexpr(ox_strcmp(T::opType(), ox::OpType::Read) == 0) { + if constexpr(ox_strcmp(T::opType(), OpType::Read) == 0) { err = modelRead(io, obj); - } else if constexpr(ox_strcmp(T::opType(), ox::OpType::Write) == 0) { + } else if constexpr(ox_strcmp(T::opType(), OpType::Write) == 0) { err = modelWrite(io, obj); - } else if constexpr(ox_strcmp(T::opType(), ox::OpType::WriteDefinition) == 0) { + } else if constexpr(ox_strcmp(T::opType(), OpType::WriteDefinition) == 0) { err = modelWriteDefinition(io, obj); } oxAssert(err, "Missing model function"); diff --git a/src/ox/model/types.hpp b/src/ox/model/types.hpp index 0dee14bf9..6376105c7 100644 --- a/src/ox/model/types.hpp +++ b/src/ox/model/types.hpp @@ -60,7 +60,7 @@ class SerStr { public: template - constexpr SerStr(BString *str) noexcept { + explicit constexpr SerStr(BString *str) noexcept { m_str = str->data(); m_cap = str->cap(); } @@ -70,14 +70,14 @@ class SerStr { m_cap = cap; } - constexpr SerStr(char **tgt, int cap = -1) noexcept { + explicit constexpr SerStr(char **tgt, int cap = -1) noexcept { m_tgt = tgt; m_str = const_cast(*tgt); m_cap = cap; } template - constexpr SerStr(char (&str)[cap]) noexcept { + explicit constexpr SerStr(char (&str)[cap]) noexcept { m_str = str; m_cap = cap; } diff --git a/src/ox/std/byteswap.hpp b/src/ox/std/byteswap.hpp index b2ebfb2b3..de14c08ba 100644 --- a/src/ox/std/byteswap.hpp +++ b/src/ox/std/byteswap.hpp @@ -75,7 +75,7 @@ class OX_PACKED ByteSwapInteger { m_value = other.m_value; } - constexpr ByteSwapInteger(T value) noexcept: m_value(ox::conditionalByteSwap(value)) { + constexpr ByteSwapInteger(T value) noexcept: m_value(conditionalByteSwap(value)) { } constexpr const ByteSwapInteger &operator=(const ByteSwapInteger &other) noexcept { @@ -85,39 +85,39 @@ class OX_PACKED ByteSwapInteger { template constexpr T operator=(I value) noexcept { - m_value = ox::conditionalByteSwap(value); + m_value = conditionalByteSwap(value); return value; } constexpr operator T() const noexcept { - return ox::conditionalByteSwap(m_value); + return conditionalByteSwap(m_value); } template constexpr T operator+=(I other) noexcept { auto newVal = *this + other; - m_value = ox::conditionalByteSwap(newVal); + m_value = conditionalByteSwap(newVal); return newVal; } template constexpr T operator-=(I other) noexcept { auto newVal = *this - other; - m_value = ox::conditionalByteSwap(newVal); + m_value = conditionalByteSwap(newVal); return newVal; } template constexpr T operator*=(I other) noexcept { auto newVal = *this * other; - m_value = ox::conditionalByteSwap(newVal); + m_value = conditionalByteSwap(newVal); return newVal; } template constexpr T operator/=(I other) noexcept { auto newVal = *this / other; - m_value = ox::conditionalByteSwap(newVal); + m_value = conditionalByteSwap(newVal); return newVal; } @@ -148,35 +148,35 @@ class OX_PACKED ByteSwapInteger { template constexpr T operator&=(I other) noexcept { auto newVal = *this & other; - m_value = ox::conditionalByteSwap(newVal); + m_value = conditionalByteSwap(newVal); return newVal; } template constexpr T operator|=(I other) noexcept { auto newVal = *this | other; - m_value = ox::conditionalByteSwap(newVal); + m_value = conditionalByteSwap(newVal); return newVal; } template constexpr T operator^=(I other) noexcept { auto newVal = *this ^ other; - m_value = ox::conditionalByteSwap(newVal); + m_value = conditionalByteSwap(newVal); return newVal; } template constexpr T operator>>=(I other) noexcept { auto newVal = *this >> other; - m_value = ox::conditionalByteSwap(newVal); + m_value = conditionalByteSwap(newVal); return newVal; } template constexpr T operator<<=(I other) noexcept { auto newVal = *this << other; - m_value = ox::conditionalByteSwap(newVal); + m_value = conditionalByteSwap(newVal); return newVal; } @@ -198,9 +198,9 @@ class OX_PACKED ByteSwapInteger { }; template -using LittleEndian = ByteSwapInteger; +using LittleEndian = ByteSwapInteger; template -using BigEndian = ByteSwapInteger; +using BigEndian = ByteSwapInteger; } diff --git a/src/ox/std/error.hpp b/src/ox/std/error.hpp index f5be32315..9bd5b1cba 100644 --- a/src/ox/std/error.hpp +++ b/src/ox/std/error.hpp @@ -59,7 +59,7 @@ struct [[nodiscard]] Error { template struct [[nodiscard]] Result { - using type = typename ox::remove_reference::type; + using type = typename remove_reference::type; T value; Error error; @@ -73,7 +73,7 @@ struct [[nodiscard]] Result { constexpr Result(const type &value, const Error &error = OxError(0)) noexcept: value(const_cast(value)), error(error) { } - constexpr Result(type &&value, const Error &error = OxError(0)) noexcept: value(ox::move(value)), error(error) { + constexpr Result(type &&value, const Error &error = OxError(0)) noexcept: value(move(value)), error(error) { } explicit constexpr operator const type&() const noexcept { @@ -100,7 +100,7 @@ struct [[nodiscard]] Result { } constexpr Error moveTo(type *val) noexcept { - *val = ox::move(value); + *val = move(value); return error; } diff --git a/src/ox/std/fmt.hpp b/src/ox/std/fmt.hpp index baa4ca9cd..4458ef3c8 100644 --- a/src/ox/std/fmt.hpp +++ b/src/ox/std/fmt.hpp @@ -29,11 +29,11 @@ constexpr const char *stringify(const char *s) noexcept { } template -constexpr const char *stringify(const ox::BString &s) noexcept { +constexpr const char *stringify(const BString &s) noexcept { return s.c_str(); } -constexpr const char *stringify(const ox::String &s) noexcept { +constexpr const char *stringify(const String &s) noexcept { return s.c_str(); } diff --git a/src/ox/std/hashmap.hpp b/src/ox/std/hashmap.hpp index efd1d3d72..90341be05 100644 --- a/src/ox/std/hashmap.hpp +++ b/src/ox/std/hashmap.hpp @@ -96,8 +96,8 @@ HashMap::HashMap(const HashMap &other) { template HashMap::HashMap(HashMap &&other) { - m_keys = ox::move(other.m_keys); - m_pairs = ox::move(other.m_pairs); + m_keys = move(other.m_keys); + m_pairs = move(other.m_pairs); } template @@ -133,8 +133,8 @@ template HashMap &HashMap::operator=(HashMap &&other) { if (this != &other) { clear(); - m_keys = ox::move(other.m_keys); - m_pairs = ox::move(other.m_pairs); + m_keys = move(other.m_keys); + m_pairs = move(other.m_pairs); } return *this; } diff --git a/src/ox/std/heapmgr.cpp b/src/ox/std/heapmgr.cpp index 9a4f59ecc..7e61a91d9 100644 --- a/src/ox/std/heapmgr.cpp +++ b/src/ox/std/heapmgr.cpp @@ -25,29 +25,29 @@ static constexpr std::size_t alignedSize(T = {}) noexcept { return alignedSize(sizeof(T)); } -void HeapSegment::init(std::size_t maxSize = ox::bit_cast(g_heapEnd)) noexcept { - this->size = maxSize - ox::bit_cast(this); +void HeapSegment::init(std::size_t maxSize = bit_cast(g_heapEnd)) noexcept { + this->size = maxSize - bit_cast(this); this->inUse = false; } template T *HeapSegment::data() noexcept { - return ox::bit_cast(ox::bit_cast(this) + alignedSize(this)); + return bit_cast(bit_cast(this) + alignedSize(this)); } template T *HeapSegment::end() noexcept { const auto size = alignedSize(this) + alignedSize(this->size); - auto e = ox::bit_cast(ox::bit_cast(this) + size); - return ox::bit_cast(e); + auto e = bit_cast(bit_cast(this) + size); + return bit_cast(e); } void initHeap(char *heapBegin, char *heapEnd) noexcept { - g_heapBegin = ox::bit_cast(heapBegin); - g_heapEnd = ox::bit_cast(heapEnd); + g_heapBegin = bit_cast(heapBegin); + g_heapEnd = bit_cast(heapEnd); heapIdx = g_heapBegin; - heapIdx->size = ox::bit_cast(heapEnd) - ox::bit_cast(heapIdx); + heapIdx->size = bit_cast(heapEnd) - bit_cast(heapIdx); heapIdx->inUse = false; } diff --git a/src/ox/std/new.hpp b/src/ox/std/new.hpp index ee6f1a64b..09315d840 100644 --- a/src/ox/std/new.hpp +++ b/src/ox/std/new.hpp @@ -46,7 +46,7 @@ constexpr void *operator new[](std::size_t, void *addr) noexcept { namespace ox { -constexpr auto MallocaStackLimit = ox::defines::UseStdLib ? 1024 : 0; +constexpr auto MallocaStackLimit = defines::UseStdLib ? 1024 : 0; /** * MallocaPtr will automatically cleanup the pointed to address upon diff --git a/src/ox/std/random.cpp b/src/ox/std/random.cpp index ce27630ae..0e925d996 100644 --- a/src/ox/std/random.cpp +++ b/src/ox/std/random.cpp @@ -28,8 +28,8 @@ uint64_t Random::gen() noexcept { auto retval = s0 + s1; s1 ^= s0; - m_seed[0] = ox::rotl(s0, 55) ^ s1 ^ (s1 << 14); - m_seed[1] = ox::rotl(s1, 36); + m_seed[0] = rotl(s0, 55) ^ s1 ^ (s1 << 14); + m_seed[1] = rotl(s1, 36); return retval; } diff --git a/src/ox/std/string.cpp b/src/ox/std/string.cpp index 681d126fa..82635eb52 100644 --- a/src/ox/std/string.cpp +++ b/src/ox/std/string.cpp @@ -44,7 +44,7 @@ String::String(const String &other) noexcept { } String::String(String &&other) noexcept { - m_buff = ox::move(other.m_buff); + m_buff = move(other.m_buff); } String &String::operator=(const char *str) noexcept { @@ -80,7 +80,7 @@ String &String::operator=(const String &src) noexcept { } String &String::operator=(String &&src) noexcept { - m_buff = ox::move(src.m_buff); + m_buff = move(src.m_buff); return *this; } diff --git a/src/ox/std/trace.hpp b/src/ox/std/trace.hpp index 4c50502e8..240fd231a 100644 --- a/src/ox/std/trace.hpp +++ b/src/ox/std/trace.hpp @@ -34,11 +34,11 @@ struct TraceMsg { int line = 0; uint64_t time = 0; const char *ch = ""; - ox::BString<100> msg; + BString<100> msg; }; template -constexpr Error model(T *io, ox::trace::TraceMsg *obj) { +constexpr Error model(T *io, TraceMsg *obj) { io->template setTypeInfo(); oxReturnError(io->field("ch", &obj->ch)); oxReturnError(io->field("file", &obj->file)); diff --git a/src/ox/std/typetraits.hpp b/src/ox/std/typetraits.hpp index 080c875a3..f788c3277 100644 --- a/src/ox/std/typetraits.hpp +++ b/src/ox/std/typetraits.hpp @@ -45,42 +45,42 @@ struct integral_constant { }; -using false_type = ox::integral_constant; -using true_type = ox::integral_constant; +using false_type = integral_constant; +using true_type = integral_constant; // is_integral ///////////////////////////////////////////////////////////////// -template struct is_integral: ox::false_type {}; -template<> struct is_integral : ox::true_type {}; -template<> struct is_integral : ox::true_type {}; -template<> struct is_integral : ox::true_type {}; -template<> struct is_integral : ox::true_type {}; -template<> struct is_integral : ox::true_type {}; -template<> struct is_integral: ox::true_type {}; -template<> struct is_integral : ox::true_type {}; -template<> struct is_integral: ox::true_type {}; +template struct is_integral: false_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral: true_type {}; +template<> struct is_integral : true_type {}; +template<> struct is_integral: true_type {}; // some of these need to be done with the actual language syntax because no one // can agree on what an (u)int64_t is... -template<> struct is_integral: ox::true_type {}; -template<> struct is_integral: ox::true_type {}; -template<> struct is_integral: ox::true_type {}; -template<> struct is_integral: ox::true_type {}; +template<> struct is_integral: true_type {}; +template<> struct is_integral: true_type {}; +template<> struct is_integral: true_type {}; +template<> struct is_integral: true_type {}; template -constexpr bool is_integral_v = ox::is_integral::value; +constexpr bool is_integral_v = is_integral::value; -template struct is_bool: ox::false_type {}; -template<> struct is_bool : ox::true_type {}; +template struct is_bool: false_type {}; +template<> struct is_bool : true_type {}; template -constexpr bool is_bool_v = ox::is_bool::value; +constexpr bool is_bool_v = is_bool::value; -template struct is_union: ox::integral_constant> {}; +template struct is_union: integral_constant> {}; template -constexpr bool is_union_v = ox::is_union(); +constexpr bool is_union_v = is_union(); // indicates the type can have members, but not that it necessarily does template @@ -89,21 +89,21 @@ template constexpr bool memberable(...) { return false; } template -struct is_class: ox::integral_constant::value && ox::memberable(0)> {}; +struct is_class: integral_constant::value && memberable(0)> {}; namespace test { struct TestClass {int i;}; union TestUnion {int i;}; -static_assert(ox::is_class::value == true); -static_assert(ox::is_class::value == false); -static_assert(ox::is_class::value == false); +static_assert(is_class::value == true); +static_assert(is_class::value == false); +static_assert(is_class::value == false); } template -constexpr bool is_class_v = ox::is_class(); +constexpr bool is_class_v = is_class(); template -constexpr bool is_signed_v = ox::integral_constant::value; +constexpr bool is_signed_v = integral_constant::value; // enable_if /////////////////////////////////////////////////////////////////// diff --git a/src/ox/std/utility.hpp b/src/ox/std/utility.hpp index 89144058b..d55fce2a6 100644 --- a/src/ox/std/utility.hpp +++ b/src/ox/std/utility.hpp @@ -13,8 +13,8 @@ namespace ox { template -constexpr typename ox::remove_reference::type &&move(T &&t) noexcept { - return static_cast::type&&>(t); +constexpr typename remove_reference::type &&move(T &&t) noexcept { + return static_cast::type&&>(t); } } diff --git a/src/ox/std/vector.hpp b/src/ox/std/vector.hpp index 6aba36445..b0073bb9d 100644 --- a/src/ox/std/vector.hpp +++ b/src/ox/std/vector.hpp @@ -124,7 +124,7 @@ Vector::Vector(const Vector &other) { m_cap = other.m_cap; m_items = bit_cast(new AllocAlias[m_cap]); for (std::size_t i = 0; i < m_size; i++) { - m_items[i] = ox::move(other.m_items[i]); + m_items[i] = move(other.m_items[i]); } } @@ -246,7 +246,7 @@ bool Vector::empty() const noexcept { template void Vector::clear() { - if constexpr(ox::is_class()) { + if constexpr(is_class()) { for (std::size_t i = 0; i < m_size; ++i) { m_items[i].~T(); } @@ -288,7 +288,7 @@ void Vector::insert(std::size_t pos, const T &val) { expandCap(m_cap ? m_cap * 2 : 100); } for (auto i = m_size; i > pos; --i) { - m_items[i] = ox::move(m_items[i - 1]); + m_items[i] = move(m_items[i - 1]); } m_items[pos] = val; ++m_size; @@ -326,7 +326,7 @@ Error Vector::erase(std::size_t pos) { } --m_size; for (auto i = pos; i < m_size; ++i) { - m_items[i] = ox::move(m_items[i + 1]); + m_items[i] = move(m_items[i + 1]); } return OxError(0); } @@ -337,7 +337,7 @@ Error Vector::unordered_erase(std::size_t pos) { return OxError(1); } m_size--; - m_items[pos] = ox::move(m_items[m_size]); + m_items[pos] = move(m_items[m_size]); return OxError(0); } @@ -349,7 +349,7 @@ void Vector::expandCap(std::size_t cap) { if (oldItems) { // move over old items const auto itRange = cap > m_size ? m_size : cap; for (std::size_t i = 0; i < itRange; i++) { - m_items[i] = ox::move(oldItems[i]); + m_items[i] = move(oldItems[i]); } for (std::size_t i = itRange; i < m_cap; i++) { new (&m_items[i]) T;