Compare commits
6 Commits
e9a6a09629
...
6b47133c22
Author | SHA1 | Date | |
---|---|---|---|
6b47133c22 | |||
0764720f9a | |||
78955376d6 | |||
a00a0bd2ff | |||
ed4f0e1f2b | |||
ea1feb726e |
2
deps/glutils/src/glutils.cpp
vendored
2
deps/glutils/src/glutils.cpp
vendored
@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ox/std/assert.hpp>
|
#include <ox/std/assert.hpp>
|
||||||
#include <ox/std/bstring.hpp>
|
#include <ox/std/istring.hpp>
|
||||||
#include <ox/std/trace.hpp>
|
#include <ox/std/trace.hpp>
|
||||||
|
|
||||||
#include "glutils/glutils.hpp"
|
#include "glutils/glutils.hpp"
|
||||||
|
4
deps/ox/src/ox/claw/test/tests.cpp
vendored
4
deps/ox/src/ox/claw/test/tests.cpp
vendored
@ -29,7 +29,7 @@ struct TestStructNest {
|
|||||||
static constexpr auto TypeVersion = 1;
|
static constexpr auto TypeVersion = 1;
|
||||||
bool Bool = false;
|
bool Bool = false;
|
||||||
uint32_t Int = 0;
|
uint32_t Int = 0;
|
||||||
ox::BString<32> String = "";
|
ox::IString<32> String = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TestStruct {
|
struct TestStruct {
|
||||||
@ -47,7 +47,7 @@ struct TestStruct {
|
|||||||
int32_t Int8 = 0;
|
int32_t Int8 = 0;
|
||||||
int unionIdx = 1;
|
int unionIdx = 1;
|
||||||
TestUnion Union;
|
TestUnion Union;
|
||||||
ox::BString<32> String = "";
|
ox::IString<32> String = "";
|
||||||
uint32_t List[4] = {0, 0, 0, 0};
|
uint32_t List[4] = {0, 0, 0, 0};
|
||||||
TestStructNest EmptyStruct;
|
TestStructNest EmptyStruct;
|
||||||
TestStructNest Struct;
|
TestStructNest Struct;
|
||||||
|
4
deps/ox/src/ox/claw/write.hpp
vendored
4
deps/ox/src/ox/claw/write.hpp
vendored
@ -61,14 +61,14 @@ struct type_version<T, decltype((void) T::TypeVersion, -1)> {
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
constexpr const char *getTypeName(const T *t) noexcept {
|
constexpr const char *getTypeName(const T *t) noexcept {
|
||||||
TypeInfoCatcher tnc;
|
TypeInfoCatcher tnc;
|
||||||
oxIgnoreError(model(&tnc, t));
|
std::ignore = model(&tnc, t);
|
||||||
return tnc.name;
|
return tnc.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
constexpr int getTypeVersion(const T *t) noexcept {
|
constexpr int getTypeVersion(const T *t) noexcept {
|
||||||
TypeInfoCatcher tnc;
|
TypeInfoCatcher tnc;
|
||||||
oxIgnoreError(model(&tnc, t));
|
std::ignore = model(&tnc, t);
|
||||||
return tnc.version;
|
return tnc.version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
deps/ox/src/ox/event/signal.hpp
vendored
2
deps/ox/src/ox/event/signal.hpp
vendored
@ -391,7 +391,7 @@ Error Signal<Error(Args...)>::disconnectObject(const void *receiver) const noexc
|
|||||||
template<class... Args>
|
template<class... Args>
|
||||||
void Signal<Error(Args...)>::emit(Args... args) const noexcept {
|
void Signal<Error(Args...)>::emit(Args... args) const noexcept {
|
||||||
for (auto &f : m_slots) {
|
for (auto &f : m_slots) {
|
||||||
oxIgnoreError(f->call(ox::forward<Args>(args)...));
|
std::ignore = f->call(ox::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,14 +132,14 @@ Error PathIterator::next(char *pathOut, std::size_t pathOutSize) {
|
|||||||
/**
|
/**
|
||||||
* @return 0 if no error
|
* @return 0 if no error
|
||||||
*/
|
*/
|
||||||
Error PathIterator::get(BString<MaxFileNameLength> *fileName) {
|
Error PathIterator::get(IString<MaxFileNameLength> *fileName) {
|
||||||
return get(fileName->data(), fileName->cap());
|
return get(fileName->data(), fileName->cap());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return 0 if no error
|
* @return 0 if no error
|
||||||
*/
|
*/
|
||||||
Error PathIterator::next(BString<MaxFileNameLength> *fileName) {
|
Error PathIterator::next(IString<MaxFileNameLength> *fileName) {
|
||||||
return next(fileName->data(), fileName->cap());
|
return next(fileName->data(), fileName->cap());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
namespace ox {
|
namespace ox {
|
||||||
|
|
||||||
constexpr std::size_t MaxFileNameLength = 255;
|
constexpr std::size_t MaxFileNameLength = 255;
|
||||||
using FileName = BString<MaxFileNameLength>;
|
using FileName = IString<MaxFileNameLength>;
|
||||||
|
|
||||||
class PathIterator {
|
class PathIterator {
|
||||||
private:
|
private:
|
||||||
|
2
deps/ox/src/ox/fs/test/tests.cpp
vendored
2
deps/ox/src/ox/fs/test/tests.cpp
vendored
@ -34,7 +34,7 @@ const std::map<ox::StringView, std::function<ox::Error(ox::StringView)>> tests =
|
|||||||
using BuffPtr_t = uint32_t;
|
using BuffPtr_t = uint32_t;
|
||||||
ox::Vector<char> buff(5 * ox::units::MB);
|
ox::Vector<char> buff(5 * ox::units::MB);
|
||||||
auto buffer = new (buff.data()) ox::ptrarith::NodeBuffer<BuffPtr_t, NodeType<BuffPtr_t>>(buff.size());
|
auto buffer = new (buff.data()) ox::ptrarith::NodeBuffer<BuffPtr_t, NodeType<BuffPtr_t>>(buff.size());
|
||||||
using String = ox::BString<6>;
|
using String = ox::IString<6>;
|
||||||
auto a1 = buffer->malloc(sizeof(String)).value;
|
auto a1 = buffer->malloc(sizeof(String)).value;
|
||||||
auto a2 = buffer->malloc(sizeof(String)).value;
|
auto a2 = buffer->malloc(sizeof(String)).value;
|
||||||
oxAssert(a1.valid(), "Allocation 1 failed.");
|
oxAssert(a1.valid(), "Allocation 1 failed.");
|
||||||
|
2
deps/ox/src/ox/logconn/logconn.cpp
vendored
2
deps/ox/src/ox/logconn/logconn.cpp
vendored
@ -98,7 +98,7 @@ void LoggerConn::msgSend() noexcept {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//std::printf("LoggerConn: sending %lu bytes\n", read);
|
//std::printf("LoggerConn: sending %lu bytes\n", read);
|
||||||
oxIgnoreError(send(tmp.data(), read));
|
std::ignore = send(tmp.data(), read);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
deps/ox/src/ox/mc/read.hpp
vendored
4
deps/ox/src/ox/mc/read.hpp
vendored
@ -77,7 +77,7 @@ class MetalClawReaderTemplate: public ModelHandlerBase<MetalClawReaderTemplate<R
|
|||||||
constexpr Error field(const char*, BasicString<SmallStringSize> *val) noexcept;
|
constexpr Error field(const char*, BasicString<SmallStringSize> *val) noexcept;
|
||||||
|
|
||||||
template<std::size_t L>
|
template<std::size_t L>
|
||||||
constexpr Error field(const char*, BString<L> *val) noexcept;
|
constexpr Error field(const char*, IString<L> *val) noexcept;
|
||||||
|
|
||||||
constexpr Error fieldCString(const char*, char *val, std::size_t buffLen) noexcept;
|
constexpr Error fieldCString(const char*, char *val, std::size_t buffLen) noexcept;
|
||||||
|
|
||||||
@ -336,7 +336,7 @@ constexpr Error MetalClawReaderTemplate<Reader>::field(const char*, BasicString<
|
|||||||
|
|
||||||
template<Reader_c Reader>
|
template<Reader_c Reader>
|
||||||
template<std::size_t L>
|
template<std::size_t L>
|
||||||
constexpr Error MetalClawReaderTemplate<Reader>::field(const char *name, BString<L> *val) noexcept {
|
constexpr Error MetalClawReaderTemplate<Reader>::field(const char *name, IString<L> *val) noexcept {
|
||||||
return fieldCString(name, val->data(), val->cap());
|
return fieldCString(name, val->data(), val->cap());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
32
deps/ox/src/ox/mc/test/tests.cpp
vendored
32
deps/ox/src/ox/mc/test/tests.cpp
vendored
@ -27,7 +27,7 @@ struct TestStructNest {
|
|||||||
static constexpr auto TypeVersion = 1;
|
static constexpr auto TypeVersion = 1;
|
||||||
bool Bool = false;
|
bool Bool = false;
|
||||||
uint32_t Int = 0;
|
uint32_t Int = 0;
|
||||||
ox::BString<32> BString = "";
|
ox::IString<32> IString = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TestStruct {
|
struct TestStruct {
|
||||||
@ -46,7 +46,7 @@ struct TestStruct {
|
|||||||
int unionIdx = 1;
|
int unionIdx = 1;
|
||||||
TestUnion Union;
|
TestUnion Union;
|
||||||
ox::String String;
|
ox::String String;
|
||||||
ox::BString<32> BString = "";
|
ox::IString<32> IString = "";
|
||||||
uint32_t List[4] = {0, 0, 0, 0};
|
uint32_t List[4] = {0, 0, 0, 0};
|
||||||
ox::Vector<uint32_t> Vector = {1, 2, 3, 4, 5};
|
ox::Vector<uint32_t> Vector = {1, 2, 3, 4, 5};
|
||||||
ox::Vector<uint32_t> Vector2 = {1, 2, 3, 4, 5};
|
ox::Vector<uint32_t> Vector2 = {1, 2, 3, 4, 5};
|
||||||
@ -72,7 +72,7 @@ constexpr ox::Error model(T *io, ox::CommonPtrWith<TestUnion> auto *obj) noexcep
|
|||||||
oxModelBegin(TestStructNest)
|
oxModelBegin(TestStructNest)
|
||||||
oxModelField(Bool)
|
oxModelField(Bool)
|
||||||
oxModelField(Int)
|
oxModelField(Int)
|
||||||
oxModelField(BString)
|
oxModelField(IString)
|
||||||
oxModelEnd()
|
oxModelEnd()
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -95,7 +95,7 @@ constexpr ox::Error model(T *io, ox::CommonPtrWith<TestStruct> auto *obj) noexce
|
|||||||
oxReturnError(io->field("Union", ox::UnionView{&obj->Union, obj->unionIdx}));
|
oxReturnError(io->field("Union", ox::UnionView{&obj->Union, obj->unionIdx}));
|
||||||
}
|
}
|
||||||
oxReturnError(io->field("String", &obj->String));
|
oxReturnError(io->field("String", &obj->String));
|
||||||
oxReturnError(io->field("BString", &obj->BString));
|
oxReturnError(io->field("IString", &obj->IString));
|
||||||
oxReturnError(io->field("List", obj->List, 4));
|
oxReturnError(io->field("List", obj->List, 4));
|
||||||
oxReturnError(io->field("Vector", &obj->Vector));
|
oxReturnError(io->field("Vector", &obj->Vector));
|
||||||
oxReturnError(io->field("Vector2", &obj->Vector2));
|
oxReturnError(io->field("Vector2", &obj->Vector2));
|
||||||
@ -127,7 +127,7 @@ std::map<ox::StringView, ox::Error(*)()> tests = {
|
|||||||
TestStruct testIn, testOut;
|
TestStruct testIn, testOut;
|
||||||
testIn.Bool = true;
|
testIn.Bool = true;
|
||||||
testIn.Int = 42;
|
testIn.Int = 42;
|
||||||
testIn.BString = "Test String 1";
|
testIn.IString = "Test String 1";
|
||||||
testIn.String = "Test String 2";
|
testIn.String = "Test String 2";
|
||||||
testIn.Vector = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, };
|
testIn.Vector = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, };
|
||||||
testIn.Vector2 = {};
|
testIn.Vector2 = {};
|
||||||
@ -137,7 +137,7 @@ std::map<ox::StringView, ox::Error(*)()> tests = {
|
|||||||
testIn.List[3] = 4;
|
testIn.List[3] = 4;
|
||||||
testIn.Struct.Bool = true;
|
testIn.Struct.Bool = true;
|
||||||
testIn.Struct.Int = 300;
|
testIn.Struct.Int = 300;
|
||||||
testIn.Struct.BString = "Test String 3";
|
testIn.Struct.IString = "Test String 3";
|
||||||
testIn.unionIdx = 1;
|
testIn.unionIdx = 1;
|
||||||
testIn.Union.Int = 93;
|
testIn.Union.Int = 93;
|
||||||
// run tests
|
// run tests
|
||||||
@ -157,7 +157,7 @@ std::map<ox::StringView, ox::Error(*)()> tests = {
|
|||||||
oxAssert(testIn.Int8 == testOut.Int8, "Int8 value mismatch");
|
oxAssert(testIn.Int8 == testOut.Int8, "Int8 value mismatch");
|
||||||
oxAssert(testIn.Union.Int == testOut.Union.Int, "Union.Int value mismatch");
|
oxAssert(testIn.Union.Int == testOut.Union.Int, "Union.Int value mismatch");
|
||||||
oxAssert(testIn.String == testOut.String, "String value mismatch");
|
oxAssert(testIn.String == testOut.String, "String value mismatch");
|
||||||
oxAssert(testIn.BString == testOut.BString, "BString value mismatch");
|
oxAssert(testIn.IString == testOut.IString, "IString value mismatch");
|
||||||
oxAssert(testIn.List[0] == testOut.List[0], "List[0] value mismatch");
|
oxAssert(testIn.List[0] == testOut.List[0], "List[0] value mismatch");
|
||||||
oxAssert(testIn.List[1] == testOut.List[1], "List[1] value mismatch");
|
oxAssert(testIn.List[1] == testOut.List[1], "List[1] value mismatch");
|
||||||
oxAssert(testIn.List[2] == testOut.List[2], "List[2] value mismatch");
|
oxAssert(testIn.List[2] == testOut.List[2], "List[2] value mismatch");
|
||||||
@ -171,9 +171,9 @@ std::map<ox::StringView, ox::Error(*)()> tests = {
|
|||||||
oxAssert(testIn.Map["aoeu"] == testOut.Map["aoeu"], "Map[\"aoeu\"] value mismatch");
|
oxAssert(testIn.Map["aoeu"] == testOut.Map["aoeu"], "Map[\"aoeu\"] value mismatch");
|
||||||
oxAssert(testIn.EmptyStruct.Bool == testOut.EmptyStruct.Bool, "EmptyStruct.Bool value mismatch");
|
oxAssert(testIn.EmptyStruct.Bool == testOut.EmptyStruct.Bool, "EmptyStruct.Bool value mismatch");
|
||||||
oxAssert(testIn.EmptyStruct.Int == testOut.EmptyStruct.Int, "EmptyStruct.Int value mismatch");
|
oxAssert(testIn.EmptyStruct.Int == testOut.EmptyStruct.Int, "EmptyStruct.Int value mismatch");
|
||||||
oxAssert(testIn.EmptyStruct.BString == testOut.EmptyStruct.BString, "EmptyStruct.BString value mismatch");
|
oxAssert(testIn.EmptyStruct.IString == testOut.EmptyStruct.IString, "EmptyStruct.IString value mismatch");
|
||||||
oxAssert(testIn.Struct.Int == testOut.Struct.Int, "Struct.Int value mismatch");
|
oxAssert(testIn.Struct.Int == testOut.Struct.Int, "Struct.Int value mismatch");
|
||||||
oxAssert(testIn.Struct.BString == testOut.Struct.BString, "Struct.BString value mismatch");
|
oxAssert(testIn.Struct.IString == testOut.Struct.IString, "Struct.IString value mismatch");
|
||||||
oxAssert(testIn.Struct.Bool == testOut.Struct.Bool, "Struct.Bool value mismatch");
|
oxAssert(testIn.Struct.Bool == testOut.Struct.Bool, "Struct.Bool value mismatch");
|
||||||
return OxError(0);
|
return OxError(0);
|
||||||
}
|
}
|
||||||
@ -303,14 +303,14 @@ std::map<ox::StringView, ox::Error(*)()> tests = {
|
|||||||
TestStruct testIn;
|
TestStruct testIn;
|
||||||
testIn.Bool = true;
|
testIn.Bool = true;
|
||||||
testIn.Int = 42;
|
testIn.Int = 42;
|
||||||
testIn.BString = "Test String 1";
|
testIn.IString = "Test String 1";
|
||||||
testIn.List[0] = 1;
|
testIn.List[0] = 1;
|
||||||
testIn.List[1] = 2;
|
testIn.List[1] = 2;
|
||||||
testIn.List[2] = 3;
|
testIn.List[2] = 3;
|
||||||
testIn.List[3] = 4;
|
testIn.List[3] = 4;
|
||||||
testIn.Struct.Bool = true;
|
testIn.Struct.Bool = true;
|
||||||
testIn.Struct.Int = 300;
|
testIn.Struct.Int = 300;
|
||||||
testIn.Struct.BString = "Test String 2";
|
testIn.Struct.IString = "Test String 2";
|
||||||
testIn.unionIdx = 1;
|
testIn.unionIdx = 1;
|
||||||
testIn.Union.Int = 93;
|
testIn.Union.Int = 93;
|
||||||
oxAssert(ox::writeMC(dataBuff.data(), dataBuff.size(), testIn), "Data generation failed");
|
oxAssert(ox::writeMC(dataBuff.data(), dataBuff.size(), testIn), "Data generation failed");
|
||||||
@ -322,7 +322,7 @@ std::map<ox::StringView, ox::Error(*)()> tests = {
|
|||||||
oxAssert(ox::readMC(dataBuff.data(), dataBuff.size(), &testOut), "Data read failed");
|
oxAssert(ox::readMC(dataBuff.data(), dataBuff.size(), &testOut), "Data read failed");
|
||||||
oxAssert(testOut.at("Int").unwrap()->get<int>() == testIn.Int, "testOut.Int failed");
|
oxAssert(testOut.at("Int").unwrap()->get<int>() == testIn.Int, "testOut.Int failed");
|
||||||
oxAssert(testOut.at("Bool").unwrap()->get<bool>() == testIn.Bool, "testOut.Bool failed");
|
oxAssert(testOut.at("Bool").unwrap()->get<bool>() == testIn.Bool, "testOut.Bool failed");
|
||||||
oxAssert(testOut.at("BString").unwrap()->get<ox::String>() == testIn.BString.c_str(), "testOut.String failed");
|
oxAssert(testOut.at("IString").unwrap()->get<ox::String>() == testIn.IString.c_str(), "testOut.String failed");
|
||||||
oxAssert(testOut.at("String").unwrap()->get<ox::String>() == testIn.String, "testOut.String failed");
|
oxAssert(testOut.at("String").unwrap()->get<ox::String>() == testIn.String, "testOut.String failed");
|
||||||
auto &testOutStruct = testOut.at("Struct").unwrap()->get<ox::ModelObject>();
|
auto &testOutStruct = testOut.at("Struct").unwrap()->get<ox::ModelObject>();
|
||||||
auto &testOutUnion = testOut.at("Union").unwrap()->get<ox::ModelUnion>();
|
auto &testOutUnion = testOut.at("Union").unwrap()->get<ox::ModelUnion>();
|
||||||
@ -333,14 +333,14 @@ std::map<ox::StringView, ox::Error(*)()> tests = {
|
|||||||
oxAssert(testOutStruct.typeName() == TestStructNest::TypeName, "ModelObject TypeName failed");
|
oxAssert(testOutStruct.typeName() == TestStructNest::TypeName, "ModelObject TypeName failed");
|
||||||
oxAssert(testOutStruct.typeVersion() == TestStructNest::TypeVersion, "ModelObject TypeVersion failed");
|
oxAssert(testOutStruct.typeVersion() == TestStructNest::TypeVersion, "ModelObject TypeVersion failed");
|
||||||
oxAssert(testOutStruct.at("Bool").unwrap()->get<bool>() == testIn.Struct.Bool, "testOut.Struct.Bool failed");
|
oxAssert(testOutStruct.at("Bool").unwrap()->get<bool>() == testIn.Struct.Bool, "testOut.Struct.Bool failed");
|
||||||
oxAssert(testOutStruct.at("BString").unwrap()->get<ox::String>() == testIn.Struct.BString.c_str(), "testOut.Struct.BString failed");
|
oxAssert(testOutStruct.at("IString").unwrap()->get<ox::String>() == testIn.Struct.IString.c_str(), "testOut.Struct.IString failed");
|
||||||
oxAssert(testOut.at("unionIdx").unwrap()->get<int>() == testIn.unionIdx, "testOut.unionIdx failed");
|
oxAssert(testOut.at("unionIdx").unwrap()->get<int>() == testIn.unionIdx, "testOut.unionIdx failed");
|
||||||
oxAssert(testOutUnion.unionIdx() == testIn.unionIdx, "testOut.Union idx wrong");
|
oxAssert(testOutUnion.unionIdx() == testIn.unionIdx, "testOut.Union idx wrong");
|
||||||
oxAssert(testOutUnion.at("Int").unwrap()->get<uint32_t>() == testIn.Union.Int, "testOut.Union.Int failed");
|
oxAssert(testOutUnion.at("Int").unwrap()->get<uint32_t>() == testIn.Union.Int, "testOut.Union.Int failed");
|
||||||
oxAssert(testOutList[0].get<uint32_t>() == testIn.List[0], "testOut.List[0] failed");
|
oxAssert(testOutList[0].get<uint32_t>() == testIn.List[0], "testOut.List[0] failed");
|
||||||
oxAssert(testOutList[1].get<uint32_t>() == testIn.List[1], "testOut.Struct.List[1] failed");
|
oxAssert(testOutList[1].get<uint32_t>() == testIn.List[1], "testOut.Struct.List[1] failed");
|
||||||
oxAssert(testOutStructCopy.at("Bool").unwrap()->get<bool>() == testIn.Struct.Bool, "testOut.Struct.Bool (copy) failed");
|
oxAssert(testOutStructCopy.at("Bool").unwrap()->get<bool>() == testIn.Struct.Bool, "testOut.Struct.Bool (copy) failed");
|
||||||
oxAssert(testOutStructCopy.at("BString").unwrap()->get<ox::String>() == testIn.Struct.BString.c_str(), "testOut.Struct.BString (copy) failed");
|
oxAssert(testOutStructCopy.at("IString").unwrap()->get<ox::String>() == testIn.Struct.IString.c_str(), "testOut.Struct.IString (copy) failed");
|
||||||
oxAssert(testOutListCopy[0].get<uint32_t>() == testIn.List[0], "testOut.Struct.List[0] (copy) failed");
|
oxAssert(testOutListCopy[0].get<uint32_t>() == testIn.List[0], "testOut.Struct.List[0] (copy) failed");
|
||||||
oxAssert(testOutListCopy[1].get<uint32_t>() == testIn.List[1], "testOut.Struct.List[1] (copy) failed");
|
oxAssert(testOutListCopy[1].get<uint32_t>() == testIn.List[1], "testOut.Struct.List[1] (copy) failed");
|
||||||
return OxError(0);
|
return OxError(0);
|
||||||
@ -357,14 +357,14 @@ std::map<ox::StringView, ox::Error(*)()> tests = {
|
|||||||
TestStruct testIn, testOut;
|
TestStruct testIn, testOut;
|
||||||
testIn.Bool = true;
|
testIn.Bool = true;
|
||||||
testIn.Int = 42;
|
testIn.Int = 42;
|
||||||
testIn.BString = "Test String 1";
|
testIn.IString = "Test String 1";
|
||||||
testIn.List[0] = 1;
|
testIn.List[0] = 1;
|
||||||
testIn.List[1] = 2;
|
testIn.List[1] = 2;
|
||||||
testIn.List[2] = 3;
|
testIn.List[2] = 3;
|
||||||
testIn.List[3] = 4;
|
testIn.List[3] = 4;
|
||||||
testIn.Struct.Bool = false;
|
testIn.Struct.Bool = false;
|
||||||
testIn.Struct.Int = 300;
|
testIn.Struct.Int = 300;
|
||||||
testIn.Struct.BString = "Test String 2";
|
testIn.Struct.IString = "Test String 2";
|
||||||
oxAssert(ox::writeMC(dataBuff, dataBuffLen, testIn), "Data generation failed");
|
oxAssert(ox::writeMC(dataBuff, dataBuffLen, testIn), "Data generation failed");
|
||||||
ox::TypeStore typeStore;
|
ox::TypeStore typeStore;
|
||||||
const auto [type, typeErr] = ox::buildTypeDef(&typeStore, &testIn);
|
const auto [type, typeErr] = ox::buildTypeDef(&typeStore, &testIn);
|
||||||
|
4
deps/ox/src/ox/mc/write.hpp
vendored
4
deps/ox/src/ox/mc/write.hpp
vendored
@ -66,7 +66,7 @@ class MetalClawWriter {
|
|||||||
constexpr Error field(const char*, const BasicString<SmallStringSize> *val) noexcept;
|
constexpr Error field(const char*, const BasicString<SmallStringSize> *val) noexcept;
|
||||||
|
|
||||||
template<std::size_t L>
|
template<std::size_t L>
|
||||||
constexpr Error field(const char*, const BString<L> *val) noexcept;
|
constexpr Error field(const char*, const IString<L> *val) noexcept;
|
||||||
|
|
||||||
constexpr Error fieldCString(const char *name, const char *const*val, std::size_t buffLen) noexcept;
|
constexpr Error fieldCString(const char *name, const char *const*val, std::size_t buffLen) noexcept;
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ constexpr Error MetalClawWriter<Writer>::field(const char*, const BasicString<Sm
|
|||||||
|
|
||||||
template<Writer_c Writer>
|
template<Writer_c Writer>
|
||||||
template<std::size_t L>
|
template<std::size_t L>
|
||||||
constexpr Error MetalClawWriter<Writer>::field(const char *name, const BString<L> *val) noexcept {
|
constexpr Error MetalClawWriter<Writer>::field(const char *name, const IString<L> *val) noexcept {
|
||||||
return fieldCString(name, val->data(), val->cap());
|
return fieldCString(name, val->data(), val->cap());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
deps/ox/src/ox/model/descwrite.hpp
vendored
6
deps/ox/src/ox/model/descwrite.hpp
vendored
@ -9,7 +9,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ox/std/byteswap.hpp>
|
#include <ox/std/byteswap.hpp>
|
||||||
#include <ox/std/bstring.hpp>
|
#include <ox/std/istring.hpp>
|
||||||
#include <ox/std/memory.hpp>
|
#include <ox/std/memory.hpp>
|
||||||
#include <ox/std/string.hpp>
|
#include <ox/std/string.hpp>
|
||||||
#include <ox/std/trace.hpp>
|
#include <ox/std/trace.hpp>
|
||||||
@ -152,7 +152,7 @@ class TypeDescWriter {
|
|||||||
|
|
||||||
template<std::size_t sz>
|
template<std::size_t sz>
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr const DescriptorType *type(const BString<sz> *val) const noexcept;
|
constexpr const DescriptorType *type(const IString<sz> *val) const noexcept;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
@ -334,7 +334,7 @@ constexpr const DescriptorType *TypeDescWriter::type(const char*) const noexcept
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t sz>
|
template<std::size_t sz>
|
||||||
constexpr const DescriptorType *TypeDescWriter::type(const BString<sz>*) const noexcept {
|
constexpr const DescriptorType *TypeDescWriter::type(const IString<sz>*) const noexcept {
|
||||||
constexpr auto PT = PrimitiveType::String;
|
constexpr auto PT = PrimitiveType::String;
|
||||||
return getType(types::BString, 0, PT, 0);
|
return getType(types::BString, 0, PT, 0);
|
||||||
}
|
}
|
||||||
|
2
deps/ox/src/ox/model/metadata.hpp
vendored
2
deps/ox/src/ox/model/metadata.hpp
vendored
@ -9,7 +9,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ox/std/byteswap.hpp>
|
#include <ox/std/byteswap.hpp>
|
||||||
#include <ox/std/bstring.hpp>
|
#include <ox/std/istring.hpp>
|
||||||
#include <ox/std/memory.hpp>
|
#include <ox/std/memory.hpp>
|
||||||
#include <ox/std/string.hpp>
|
#include <ox/std/string.hpp>
|
||||||
#include <ox/std/trace.hpp>
|
#include <ox/std/trace.hpp>
|
||||||
|
12
deps/ox/src/ox/model/modelops.hpp
vendored
12
deps/ox/src/ox/model/modelops.hpp
vendored
@ -276,8 +276,8 @@ constexpr void moveModel(T *dst, T *src) noexcept {
|
|||||||
constexpr auto size = ModelFieldCount_v<T>;
|
constexpr auto size = ModelFieldCount_v<T>;
|
||||||
detail::MemberList<size> dstFields;
|
detail::MemberList<size> dstFields;
|
||||||
detail::Mover<size> mover(&dstFields);
|
detail::Mover<size> mover(&dstFields);
|
||||||
oxIgnoreError(model(&dstFields, dst));
|
std::ignore = model(&dstFields, dst);
|
||||||
oxIgnoreError(model(&mover, src));
|
std::ignore = model(&mover, src);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -285,8 +285,8 @@ constexpr void copyModel(T *dst, const T *src) noexcept {
|
|||||||
constexpr auto size = ModelFieldCount_v<T>;
|
constexpr auto size = ModelFieldCount_v<T>;
|
||||||
detail::MemberList<size> dstFields;
|
detail::MemberList<size> dstFields;
|
||||||
detail::Copier<size> copier(&dstFields);
|
detail::Copier<size> copier(&dstFields);
|
||||||
oxIgnoreError(model(&dstFields, dst));
|
std::ignore = model(&dstFields, dst);
|
||||||
oxIgnoreError(model(&copier, src));
|
std::ignore = model(&copier, src);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -295,8 +295,8 @@ constexpr bool equalsModel(T *a, T *b) noexcept {
|
|||||||
constexpr auto size = T::Fields;
|
constexpr auto size = T::Fields;
|
||||||
detail::MemberList<size> aFields;
|
detail::MemberList<size> aFields;
|
||||||
detail::Equals<size> equals(&aFields);
|
detail::Equals<size> equals(&aFields);
|
||||||
oxIgnoreError(model(&aFields, a));
|
std::ignore = model(&aFields, a);
|
||||||
oxIgnoreError(model(&equals, b));
|
std::ignore = model(&equals, b);
|
||||||
return equals.value;
|
return equals.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
deps/ox/src/ox/model/modelvalue.hpp
vendored
4
deps/ox/src/ox/model/modelvalue.hpp
vendored
@ -1057,13 +1057,13 @@ constexpr ModelValue::ModelValue(ModelValue &&other) noexcept {
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
constexpr ModelValue::ModelValue(const T &val) noexcept
|
constexpr ModelValue::ModelValue(const T &val) noexcept
|
||||||
requires(!ox::is_same_v<ox::remove_reference_t<T>, ModelValue>) {
|
requires(!ox::is_same_v<ox::remove_reference_t<T>, ModelValue>) {
|
||||||
oxIgnoreError(set(val));
|
std::ignore = set(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
constexpr ModelValue::ModelValue(T &&val) noexcept
|
constexpr ModelValue::ModelValue(T &&val) noexcept
|
||||||
requires(!ox::is_same_v<ox::remove_reference_t<T>, ModelValue>) {
|
requires(!ox::is_same_v<ox::remove_reference_t<T>, ModelValue>) {
|
||||||
oxIgnoreError(set(ox::forward<T>(val)));
|
std::ignore = set(ox::forward<T>(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr ModelValue::~ModelValue() noexcept {
|
constexpr ModelValue::~ModelValue() noexcept {
|
||||||
|
10
deps/ox/src/ox/model/typenamecatcher.hpp
vendored
10
deps/ox/src/ox/model/typenamecatcher.hpp
vendored
@ -99,7 +99,7 @@ struct TypeInfoCatcher {
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
constexpr int getModelTypeVersion(T *val) noexcept {
|
constexpr int getModelTypeVersion(T *val) noexcept {
|
||||||
TypeInfoCatcher nc;
|
TypeInfoCatcher nc;
|
||||||
oxIgnoreError(model(&nc, val));
|
std::ignore = model(&nc, val);
|
||||||
return nc.version;
|
return nc.version;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ consteval int requireModelTypeVersion() noexcept {
|
|||||||
template<typename T, typename Str = const char*>
|
template<typename T, typename Str = const char*>
|
||||||
constexpr Str getModelTypeName(T *val) noexcept {
|
constexpr Str getModelTypeName(T *val) noexcept {
|
||||||
TypeNameCatcher nc;
|
TypeNameCatcher nc;
|
||||||
oxIgnoreError(model(&nc, val));
|
std::ignore = model(&nc, val);
|
||||||
return nc.name;
|
return nc.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,15 +151,15 @@ template<typename T, typename Str = const char*>
|
|||||||
constexpr auto ModelTypeVersionStr_v = [] {
|
constexpr auto ModelTypeVersionStr_v = [] {
|
||||||
constexpr auto version = ModelTypeVersion_v<T>;
|
constexpr auto version = ModelTypeVersion_v<T>;
|
||||||
constexpr auto versionStr = ox::sfmt("{}", version);
|
constexpr auto versionStr = ox::sfmt("{}", version);
|
||||||
return ox::BString<versionStr.len()>{versionStr};
|
return ox::IString<versionStr.len()>{versionStr};
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
constexpr auto ModelTypeId_v = [] {
|
constexpr auto ModelTypeId_v = [] {
|
||||||
constexpr auto name = ModelTypeName_v<T, ox::StringView>;
|
constexpr auto name = ModelTypeName_v<T, ox::StringView>;
|
||||||
constexpr auto version = ModelTypeVersion_v<T>;
|
constexpr auto version = ModelTypeVersion_v<T>;
|
||||||
constexpr auto versionStr = ox::sfmt<ox::BString<19>>("{}", version);
|
constexpr auto versionStr = ox::sfmt<ox::IString<19>>("{}", version);
|
||||||
return ox::sfmt<ox::BString<name.len() + versionStr.len() + 1>>("{};{}", name, versionStr);
|
return ox::sfmt<ox::IString<name.len() + versionStr.len() + 1>>("{};{}", name, versionStr);
|
||||||
}();
|
}();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
2
deps/ox/src/ox/model/types.hpp
vendored
2
deps/ox/src/ox/model/types.hpp
vendored
@ -21,7 +21,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <ox/std/array.hpp>
|
#include <ox/std/array.hpp>
|
||||||
#include <ox/std/bstring.hpp>
|
#include <ox/std/istring.hpp>
|
||||||
#include <ox/std/string.hpp>
|
#include <ox/std/string.hpp>
|
||||||
#include <ox/std/strops.hpp>
|
#include <ox/std/strops.hpp>
|
||||||
#include <ox/std/types.hpp>
|
#include <ox/std/types.hpp>
|
||||||
|
4
deps/ox/src/ox/oc/read.hpp
vendored
4
deps/ox/src/ox/oc/read.hpp
vendored
@ -70,7 +70,7 @@ class OrganicClawReader {
|
|||||||
Error field(const char *key, BasicString<L> *val) noexcept;
|
Error field(const char *key, BasicString<L> *val) noexcept;
|
||||||
|
|
||||||
template<std::size_t L>
|
template<std::size_t L>
|
||||||
Error field(const char *key, BString<L> *val) noexcept;
|
Error field(const char *key, IString<L> *val) noexcept;
|
||||||
|
|
||||||
Error fieldCString(const char *key, char *val, std::size_t buffLen) noexcept;
|
Error fieldCString(const char *key, char *val, std::size_t buffLen) noexcept;
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ Error OrganicClawReader::field(const char *key, BasicString<L> *val) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t L>
|
template<std::size_t L>
|
||||||
Error OrganicClawReader::field(const char *key, BString<L> *val) noexcept {
|
Error OrganicClawReader::field(const char *key, IString<L> *val) noexcept {
|
||||||
return fieldCString(key, val->data(), val->cap());
|
return fieldCString(key, val->data(), val->cap());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
deps/ox/src/ox/oc/test/tests.cpp
vendored
2
deps/ox/src/ox/oc/test/tests.cpp
vendored
@ -35,7 +35,7 @@ struct TestStructNest {
|
|||||||
static constexpr auto TypeVersion = 1;
|
static constexpr auto TypeVersion = 1;
|
||||||
bool Bool = false;
|
bool Bool = false;
|
||||||
uint32_t Int = 0;
|
uint32_t Int = 0;
|
||||||
ox::BString<32> String = "";
|
ox::IString<32> String = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TestStruct {
|
struct TestStruct {
|
||||||
|
2
deps/ox/src/ox/oc/write.hpp
vendored
2
deps/ox/src/ox/oc/write.hpp
vendored
@ -132,7 +132,7 @@ class OrganicClawWriter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t L>
|
template<std::size_t L>
|
||||||
Error field(char const*key, BString<L> const*val) noexcept {
|
Error field(char const*key, IString<L> const*val) noexcept {
|
||||||
if (targetValid() && val->len()) {
|
if (targetValid() && val->len()) {
|
||||||
value(key) = val->c_str();
|
value(key) = val->c_str();
|
||||||
}
|
}
|
||||||
|
2
deps/ox/src/ox/std/CMakeLists.txt
vendored
2
deps/ox/src/ox/std/CMakeLists.txt
vendored
@ -90,7 +90,7 @@ install(
|
|||||||
assert.hpp
|
assert.hpp
|
||||||
bit.hpp
|
bit.hpp
|
||||||
bounds.hpp
|
bounds.hpp
|
||||||
bstring.hpp
|
istring.hpp
|
||||||
buffer.hpp
|
buffer.hpp
|
||||||
buildinfo.hpp
|
buildinfo.hpp
|
||||||
byteswap.hpp
|
byteswap.hpp
|
||||||
|
4
deps/ox/src/ox/std/cstringview.hpp
vendored
4
deps/ox/src/ox/std/cstringview.hpp
vendored
@ -9,7 +9,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "basestringview.hpp"
|
#include "basestringview.hpp"
|
||||||
#include "bstring.hpp"
|
#include "istring.hpp"
|
||||||
#include "string.hpp"
|
#include "string.hpp"
|
||||||
#include "stringliteral.hpp"
|
#include "stringliteral.hpp"
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ class CStringView: public detail::BaseStringView {
|
|||||||
constexpr CStringView(BasicString<SmallStrSz> const&str) noexcept: BaseStringView(str.data(), str.len()) {}
|
constexpr CStringView(BasicString<SmallStrSz> const&str) noexcept: BaseStringView(str.data(), str.len()) {}
|
||||||
|
|
||||||
template<std::size_t SmallStrSz>
|
template<std::size_t SmallStrSz>
|
||||||
constexpr CStringView(BString<SmallStrSz> const&str) noexcept: BaseStringView(str.data(), str.len()) {}
|
constexpr CStringView(IString<SmallStrSz> const&str) noexcept: BaseStringView(str.data(), str.len()) {}
|
||||||
|
|
||||||
constexpr CStringView(std::nullptr_t) noexcept {}
|
constexpr CStringView(std::nullptr_t) noexcept {}
|
||||||
|
|
||||||
|
4
deps/ox/src/ox/std/error.hpp
vendored
4
deps/ox/src/ox/std/error.hpp
vendored
@ -314,7 +314,3 @@ constexpr Error toError(const Result<T> &r) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr void oxIgnoreError(const ox::Error&) noexcept {}
|
|
||||||
template<typename T>
|
|
||||||
constexpr void oxIgnoreError(const ox::Result<T>&) noexcept {}
|
|
||||||
|
9
deps/ox/src/ox/std/fmt.hpp
vendored
9
deps/ox/src/ox/std/fmt.hpp
vendored
@ -18,7 +18,8 @@
|
|||||||
|
|
||||||
#include "realstd.hpp"
|
#include "realstd.hpp"
|
||||||
#include "error.hpp"
|
#include "error.hpp"
|
||||||
#include "bstring.hpp"
|
#include "ignore.hpp"
|
||||||
|
#include "istring.hpp"
|
||||||
#include "string.hpp"
|
#include "string.hpp"
|
||||||
#include "strops.hpp"
|
#include "strops.hpp"
|
||||||
#include "types.hpp"
|
#include "types.hpp"
|
||||||
@ -38,7 +39,7 @@ constexpr StringView toStringView(const char *s) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<bool force = false, std::size_t size>
|
template<bool force = false, std::size_t size>
|
||||||
constexpr StringView toStringView(const BString<size> &s) noexcept {
|
constexpr StringView toStringView(const IString<size> &s) noexcept {
|
||||||
return s.c_str();
|
return s.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,12 +192,12 @@ constexpr StringType sfmt(StringView fmt, Args&&... args) noexcept {
|
|||||||
StringType out;
|
StringType out;
|
||||||
const auto fmtSegments = ox::detail::fmtSegments<sizeof...(args)+1>(fmt);
|
const auto fmtSegments = ox::detail::fmtSegments<sizeof...(args)+1>(fmt);
|
||||||
const auto &firstSegment = fmtSegments.segments[0];
|
const auto &firstSegment = fmtSegments.segments[0];
|
||||||
oxIgnoreError(out.append(firstSegment.str, firstSegment.length));
|
std::ignore = out.append(firstSegment.str, firstSegment.length);
|
||||||
const detail::FmtArg elements[sizeof...(args)] = {args...};
|
const detail::FmtArg elements[sizeof...(args)] = {args...};
|
||||||
for (size_t i = 0; i < fmtSegments.size - 1; ++i) {
|
for (size_t i = 0; i < fmtSegments.size - 1; ++i) {
|
||||||
out += elements[i].out;
|
out += elements[i].out;
|
||||||
const auto &s = fmtSegments.segments[i + 1];
|
const auto &s = fmtSegments.segments[i + 1];
|
||||||
oxIgnoreError(out.append(s.str, s.length));
|
std::ignore = out.append(s.str, s.length);
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
5
deps/ox/src/ox/std/hashmap.hpp
vendored
5
deps/ox/src/ox/std/hashmap.hpp
vendored
@ -9,6 +9,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "algorithm.hpp"
|
#include "algorithm.hpp"
|
||||||
|
#include "ignore.hpp"
|
||||||
#include "stringview.hpp"
|
#include "stringview.hpp"
|
||||||
#include "strops.hpp"
|
#include "strops.hpp"
|
||||||
#include "vector.hpp"
|
#include "vector.hpp"
|
||||||
@ -175,13 +176,13 @@ constexpr void HashMap<K, T>::erase(MaybeView_t<K> const&k) {
|
|||||||
while (true) {
|
while (true) {
|
||||||
const auto &p = m_pairs[h];
|
const auto &p = m_pairs[h];
|
||||||
if (p == nullptr || p->key == k) {
|
if (p == nullptr || p->key == k) {
|
||||||
oxIgnoreError(m_pairs.erase(h));
|
std::ignore = m_pairs.erase(h);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
h = hash(h) % m_pairs.size();
|
h = hash(h) % m_pairs.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
oxIgnoreError(m_keys.erase(ox::find(m_keys.begin(), m_keys.end(), k)));
|
std::ignore = m_keys.erase(ox::find(m_keys.begin(), m_keys.end(), k));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename K, typename T>
|
template<typename K, typename T>
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "ignore.hpp"
|
||||||
#include "memops.hpp"
|
#include "memops.hpp"
|
||||||
#include "stringview.hpp"
|
#include "stringview.hpp"
|
||||||
#include "strops.hpp"
|
#include "strops.hpp"
|
||||||
@ -15,40 +16,41 @@
|
|||||||
|
|
||||||
namespace ox {
|
namespace ox {
|
||||||
|
|
||||||
// Bounded String
|
// Inline String
|
||||||
template<std::size_t buffLen>
|
template<std::size_t buffLen>
|
||||||
class BString {
|
class IString {
|
||||||
private:
|
private:
|
||||||
char m_buff[buffLen + 1];
|
char m_buff[buffLen + 1];
|
||||||
|
size_t m_size{};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
constexpr BString() noexcept;
|
constexpr IString() noexcept;
|
||||||
|
|
||||||
constexpr BString(StringView str) noexcept;
|
constexpr IString(StringView str) noexcept;
|
||||||
|
|
||||||
constexpr BString(const char *str) noexcept;
|
constexpr IString(const char *str) noexcept;
|
||||||
|
|
||||||
constexpr BString &operator=(CRStringView str) noexcept;
|
constexpr IString &operator=(CRStringView str) noexcept;
|
||||||
|
|
||||||
constexpr BString &operator=(const char *str) noexcept;
|
constexpr IString &operator=(const char *str) noexcept;
|
||||||
|
|
||||||
constexpr BString &operator=(char *str) noexcept;
|
constexpr IString &operator=(char *str) noexcept;
|
||||||
|
|
||||||
constexpr BString &operator=(Integer_c auto i) noexcept;
|
constexpr IString &operator=(Integer_c auto i) noexcept;
|
||||||
|
|
||||||
constexpr BString &operator+=(const char *str) noexcept;
|
constexpr IString &operator+=(const char *str) noexcept;
|
||||||
|
|
||||||
constexpr BString &operator+=(char *str) noexcept;
|
constexpr IString &operator+=(char *str) noexcept;
|
||||||
|
|
||||||
constexpr BString &operator+=(Integer_c auto i) noexcept;
|
constexpr IString &operator+=(Integer_c auto i) noexcept;
|
||||||
|
|
||||||
constexpr BString &operator+=(StringView s) noexcept;
|
constexpr IString &operator+=(StringView s) noexcept;
|
||||||
|
|
||||||
constexpr BString operator+(const char *str) const noexcept;
|
constexpr IString operator+(const char *str) const noexcept;
|
||||||
|
|
||||||
constexpr BString operator+(char *str) const noexcept;
|
constexpr IString operator+(char *str) const noexcept;
|
||||||
|
|
||||||
constexpr BString operator+(Integer_c auto i) const noexcept;
|
constexpr IString operator+(Integer_c auto i) const noexcept;
|
||||||
|
|
||||||
constexpr bool operator==(const char *other) const noexcept;
|
constexpr bool operator==(const char *other) const noexcept;
|
||||||
|
|
||||||
@ -93,133 +95,135 @@ class BString {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<std::size_t size>
|
template<std::size_t size>
|
||||||
constexpr BString<size>::BString() noexcept: m_buff{{0}} {
|
constexpr IString<size>::IString() noexcept: m_buff{{0}} {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t size>
|
template<std::size_t size>
|
||||||
constexpr BString<size>::BString(StringView str) noexcept: m_buff{{0}} {
|
constexpr IString<size>::IString(StringView str) noexcept: m_buff{{0}} {
|
||||||
operator=(str);
|
operator=(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t size>
|
template<std::size_t size>
|
||||||
constexpr BString<size>::BString(const char *str) noexcept: m_buff{{0}} {
|
constexpr IString<size>::IString(const char *str) noexcept: m_buff{{0}} {
|
||||||
operator=(str);
|
operator=(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t size>
|
template<std::size_t size>
|
||||||
constexpr BString<size> &BString<size>::operator=(Integer_c auto i) noexcept {
|
constexpr IString<size> &IString<size>::operator=(Integer_c auto i) noexcept {
|
||||||
char str[65] = {};
|
char str[65] = {};
|
||||||
ox::itoa(i, str);
|
ox::itoa(i, str);
|
||||||
return this->operator=(str);
|
return this->operator=(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t size>
|
template<std::size_t size>
|
||||||
constexpr BString<size> &BString<size>::operator=(ox::CRStringView str) noexcept {
|
constexpr IString<size> &IString<size>::operator=(ox::CRStringView str) noexcept {
|
||||||
std::size_t strLen = str.bytes() + 1;
|
std::size_t strLen = str.bytes() + 1;
|
||||||
if (cap() < strLen) {
|
if (cap() < strLen) {
|
||||||
strLen = cap();
|
strLen = cap();
|
||||||
}
|
}
|
||||||
ox::memcpy(m_buff, str.data(), strLen);
|
m_size = strLen;
|
||||||
|
ox::listcpy(m_buff, str.data(), strLen);
|
||||||
// make sure last element is a null terminator
|
// make sure last element is a null terminator
|
||||||
m_buff[strLen] = 0;
|
m_buff[strLen] = 0;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t size>
|
template<std::size_t size>
|
||||||
constexpr BString<size> &BString<size>::operator=(const char *str) noexcept {
|
constexpr IString<size> &IString<size>::operator=(const char *str) noexcept {
|
||||||
std::size_t strLen = ox::strlen(str) + 1;
|
std::size_t strLen = ox::strlen(str) + 1;
|
||||||
if (cap() < strLen) {
|
if (cap() < strLen) {
|
||||||
strLen = cap();
|
strLen = cap();
|
||||||
}
|
}
|
||||||
ox::memcpy(m_buff, str, strLen);
|
m_size = strLen;
|
||||||
|
ox::listcpy(m_buff, str, strLen);
|
||||||
// make sure last element is a null terminator
|
// make sure last element is a null terminator
|
||||||
m_buff[cap()] = 0;
|
m_buff[cap()] = 0;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t size>
|
template<std::size_t size>
|
||||||
constexpr BString<size> &BString<size>::operator=(char *str) noexcept {
|
constexpr IString<size> &IString<size>::operator=(char *str) noexcept {
|
||||||
return *this = static_cast<const char*>(str);
|
return *this = static_cast<const char*>(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t size>
|
template<std::size_t size>
|
||||||
constexpr BString<size> &BString<size>::operator+=(const char *str) noexcept {
|
constexpr IString<size> &IString<size>::operator+=(const char *str) noexcept {
|
||||||
std::size_t strLen = ox::strlen(str) + 1;
|
std::size_t strLen = ox::strlen(str) + 1;
|
||||||
oxIgnoreError(append(str, strLen));
|
std::ignore = append(str, strLen);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t size>
|
template<std::size_t size>
|
||||||
constexpr BString<size> &BString<size>::operator+=(char *str) noexcept {
|
constexpr IString<size> &IString<size>::operator+=(char *str) noexcept {
|
||||||
return *this += static_cast<const char*>(str);
|
return *this += static_cast<const char*>(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t size>
|
template<std::size_t size>
|
||||||
constexpr BString<size> &BString<size>::operator+=(Integer_c auto i) noexcept {
|
constexpr IString<size> &IString<size>::operator+=(Integer_c auto i) noexcept {
|
||||||
char str[65] = {};
|
char str[65] = {};
|
||||||
ox::itoa(i, str);
|
ox::itoa(i, str);
|
||||||
return this->operator+=(str);
|
return this->operator+=(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t size>
|
template<std::size_t size>
|
||||||
constexpr BString<size> &BString<size>::operator+=(StringView s) noexcept {
|
constexpr IString<size> &IString<size>::operator+=(StringView s) noexcept {
|
||||||
std::size_t strLen = s.bytes();
|
std::size_t strLen = s.bytes();
|
||||||
oxIgnoreError(append(s.data(), strLen));
|
std::ignore = append(s.data(), strLen);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t size>
|
template<std::size_t size>
|
||||||
constexpr BString<size> BString<size>::operator+(const char *str) const noexcept {
|
constexpr IString<size> IString<size>::operator+(const char *str) const noexcept {
|
||||||
auto out = *this;
|
auto out = *this;
|
||||||
std::size_t strLen = ox::strlen(str) + 1;
|
std::size_t strLen = ox::strlen(str) + 1;
|
||||||
oxIgnoreError(out.append(str, strLen));
|
std::ignore = out.append(str, strLen);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t size>
|
template<std::size_t size>
|
||||||
constexpr BString<size> BString<size>::operator+(char *str) const noexcept {
|
constexpr IString<size> IString<size>::operator+(char *str) const noexcept {
|
||||||
return *this + static_cast<const char*>(str);
|
return *this + static_cast<const char*>(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t size>
|
template<std::size_t size>
|
||||||
constexpr BString<size> BString<size>::operator+(Integer_c auto i) const noexcept {
|
constexpr IString<size> IString<size>::operator+(Integer_c auto i) const noexcept {
|
||||||
char str[65] = {};
|
char str[65] = {};
|
||||||
ox::itoa(i, str);
|
ox::itoa(i, str);
|
||||||
return this->operator+(str);
|
return this->operator+(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t buffLen>
|
template<std::size_t buffLen>
|
||||||
constexpr bool BString<buffLen>::operator==(const char *other) const noexcept {
|
constexpr bool IString<buffLen>::operator==(const char *other) const noexcept {
|
||||||
return ox::StringView(*this) == other;
|
return ox::StringView(*this) == other;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t buffLen>
|
template<std::size_t buffLen>
|
||||||
constexpr bool BString<buffLen>::operator==(const OxString_c auto &other) const noexcept {
|
constexpr bool IString<buffLen>::operator==(const OxString_c auto &other) const noexcept {
|
||||||
return ox::StringView(*this) == ox::StringView(other);
|
return ox::StringView(*this) == ox::StringView(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t buffLen>
|
template<std::size_t buffLen>
|
||||||
constexpr bool BString<buffLen>::operator!=(const char *other) const noexcept {
|
constexpr bool IString<buffLen>::operator!=(const char *other) const noexcept {
|
||||||
return !operator==(other);
|
return !operator==(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t buffLen>
|
template<std::size_t buffLen>
|
||||||
constexpr bool BString<buffLen>::operator!=(const OxString_c auto &other) noexcept {
|
constexpr bool IString<buffLen>::operator!=(const OxString_c auto &other) noexcept {
|
||||||
return !operator==(other);
|
return !operator==(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t buffLen>
|
template<std::size_t buffLen>
|
||||||
constexpr char BString<buffLen>::operator[](std::size_t i) const noexcept {
|
constexpr char IString<buffLen>::operator[](std::size_t i) const noexcept {
|
||||||
return m_buff[i];
|
return m_buff[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t buffLen>
|
template<std::size_t buffLen>
|
||||||
constexpr char &BString<buffLen>::operator[](std::size_t i) noexcept {
|
constexpr char &IString<buffLen>::operator[](std::size_t i) noexcept {
|
||||||
return m_buff[i];
|
return m_buff[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t buffLen>
|
template<std::size_t buffLen>
|
||||||
constexpr Error BString<buffLen>::append(const char *str, std::size_t strLen) noexcept {
|
constexpr Error IString<buffLen>::append(const char *str, std::size_t strLen) noexcept {
|
||||||
Error err;
|
Error err;
|
||||||
auto currentLen = len();
|
auto currentLen = len();
|
||||||
if (cap() < currentLen + strLen + 1) {
|
if (cap() < currentLen + strLen + 1) {
|
||||||
@ -233,23 +237,23 @@ constexpr Error BString<buffLen>::append(const char *str, std::size_t strLen) no
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t buffLen>
|
template<std::size_t buffLen>
|
||||||
constexpr const char *BString<buffLen>::data() const noexcept {
|
constexpr const char *IString<buffLen>::data() const noexcept {
|
||||||
return static_cast<const char*>(m_buff);
|
return static_cast<const char*>(m_buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t buffLen>
|
template<std::size_t buffLen>
|
||||||
constexpr char *BString<buffLen>::data() noexcept {
|
constexpr char *IString<buffLen>::data() noexcept {
|
||||||
return static_cast<char*>(m_buff);
|
return static_cast<char*>(m_buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t buffLen>
|
template<std::size_t buffLen>
|
||||||
constexpr const char *BString<buffLen>::c_str() const noexcept {
|
constexpr const char *IString<buffLen>::c_str() const noexcept {
|
||||||
return static_cast<const char*>(m_buff);
|
return static_cast<const char*>(m_buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<std::size_t buffLen>
|
template<std::size_t buffLen>
|
||||||
constexpr std::size_t BString<buffLen>::len() const noexcept {
|
constexpr std::size_t IString<buffLen>::len() const noexcept {
|
||||||
std::size_t length = 0;
|
std::size_t length = 0;
|
||||||
for (std::size_t i = 0; i < buffLen; i++) {
|
for (std::size_t i = 0; i < buffLen; i++) {
|
||||||
uint8_t b = static_cast<uint8_t>(m_buff[i]);
|
uint8_t b = static_cast<uint8_t>(m_buff[i]);
|
||||||
@ -267,14 +271,14 @@ constexpr std::size_t BString<buffLen>::len() const noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t buffLen>
|
template<std::size_t buffLen>
|
||||||
constexpr std::size_t BString<buffLen>::bytes() const noexcept {
|
constexpr std::size_t IString<buffLen>::bytes() const noexcept {
|
||||||
std::size_t i = 0;
|
std::size_t i = 0;
|
||||||
for (i = 0; i < buffLen && m_buff[i]; i++);
|
for (i = 0; i < buffLen && m_buff[i]; i++);
|
||||||
return i + 1; // add one for null terminator
|
return i + 1; // add one for null terminator
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t buffLen>
|
template<std::size_t buffLen>
|
||||||
constexpr std::size_t BString<buffLen>::cap() const noexcept {
|
constexpr std::size_t IString<buffLen>::cap() const noexcept {
|
||||||
return buffLen;
|
return buffLen;
|
||||||
}
|
}
|
||||||
|
|
2
deps/ox/src/ox/std/std.hpp
vendored
2
deps/ox/src/ox/std/std.hpp
vendored
@ -13,7 +13,7 @@
|
|||||||
#include "assert.hpp"
|
#include "assert.hpp"
|
||||||
#include "bit.hpp"
|
#include "bit.hpp"
|
||||||
#include "bounds.hpp"
|
#include "bounds.hpp"
|
||||||
#include "bstring.hpp"
|
#include "istring.hpp"
|
||||||
#include "byteswap.hpp"
|
#include "byteswap.hpp"
|
||||||
#include "concepts.hpp"
|
#include "concepts.hpp"
|
||||||
#include "cstringview.hpp"
|
#include "cstringview.hpp"
|
||||||
|
10
deps/ox/src/ox/std/string.hpp
vendored
10
deps/ox/src/ox/std/string.hpp
vendored
@ -13,6 +13,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "algorithm.hpp"
|
#include "algorithm.hpp"
|
||||||
|
#include "ignore.hpp"
|
||||||
#include "memops.hpp"
|
#include "memops.hpp"
|
||||||
#include "serialize.hpp"
|
#include "serialize.hpp"
|
||||||
#include "stringliteral.hpp"
|
#include "stringliteral.hpp"
|
||||||
@ -33,9 +34,6 @@ class BasicString {
|
|||||||
|
|
||||||
constexpr explicit BasicString(std::size_t cap) noexcept;
|
constexpr explicit BasicString(std::size_t cap) noexcept;
|
||||||
|
|
||||||
template<size_t Sz>
|
|
||||||
constexpr BasicString(char const (&str)[Sz]) noexcept;
|
|
||||||
|
|
||||||
constexpr explicit BasicString(const char *str) noexcept;
|
constexpr explicit BasicString(const char *str) noexcept;
|
||||||
|
|
||||||
constexpr explicit BasicString(const char8_t *str) noexcept;
|
constexpr explicit BasicString(const char8_t *str) noexcept;
|
||||||
@ -364,7 +362,7 @@ constexpr BasicString<SmallStringSize_v> &BasicString<SmallStringSize_v>::operat
|
|||||||
template<std::size_t SmallStringSize_v>
|
template<std::size_t SmallStringSize_v>
|
||||||
constexpr BasicString<SmallStringSize_v> &BasicString<SmallStringSize_v>::operator+=(const char *str) noexcept {
|
constexpr BasicString<SmallStringSize_v> &BasicString<SmallStringSize_v>::operator+=(const char *str) noexcept {
|
||||||
std::size_t strLen = ox::strlen(str);
|
std::size_t strLen = ox::strlen(str);
|
||||||
oxIgnoreError(append(str, strLen));
|
std::ignore = append(str, strLen);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,13 +387,13 @@ constexpr BasicString<SmallStringSize_v> &BasicString<SmallStringSize_v>::operat
|
|||||||
template<std::size_t SmallStringSize_v>
|
template<std::size_t SmallStringSize_v>
|
||||||
constexpr BasicString<SmallStringSize_v> &BasicString<SmallStringSize_v>::operator+=(StringView s) noexcept {
|
constexpr BasicString<SmallStringSize_v> &BasicString<SmallStringSize_v>::operator+=(StringView s) noexcept {
|
||||||
std::size_t strLen = s.bytes();
|
std::size_t strLen = s.bytes();
|
||||||
oxIgnoreError(append(s.data(), strLen));
|
std::ignore = append(s.data(), strLen);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t SmallStringSize_v>
|
template<std::size_t SmallStringSize_v>
|
||||||
constexpr BasicString<SmallStringSize_v> &BasicString<SmallStringSize_v>::operator+=(BasicString const&src) noexcept {
|
constexpr BasicString<SmallStringSize_v> &BasicString<SmallStringSize_v>::operator+=(BasicString const&src) noexcept {
|
||||||
oxIgnoreError(append(src.c_str(), src.len()));
|
std::ignore = append(src.c_str(), src.len());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
3
deps/ox/src/ox/std/stringliteral.hpp
vendored
3
deps/ox/src/ox/std/stringliteral.hpp
vendored
@ -32,8 +32,7 @@ class StringLiteral: public detail::BaseStringView {
|
|||||||
|
|
||||||
constexpr explicit StringLiteral(const char *str, std::size_t len) noexcept: BaseStringView(str, len) {}
|
constexpr explicit StringLiteral(const char *str, std::size_t len) noexcept: BaseStringView(str, len) {}
|
||||||
|
|
||||||
template<size_t Sz>
|
constexpr explicit StringLiteral(char const *str) noexcept: StringLiteral(str, ox::strlen(str)) {
|
||||||
constexpr explicit StringLiteral(char const (&str)[Sz]) noexcept: StringLiteral(str, Sz) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr auto &operator=(StringLiteral const&other) noexcept {
|
constexpr auto &operator=(StringLiteral const&other) noexcept {
|
||||||
|
4
deps/ox/src/ox/std/stringview.hpp
vendored
4
deps/ox/src/ox/std/stringview.hpp
vendored
@ -20,7 +20,7 @@
|
|||||||
namespace ox {
|
namespace ox {
|
||||||
|
|
||||||
template<std::size_t buffLen>
|
template<std::size_t buffLen>
|
||||||
class BString;
|
class IString;
|
||||||
|
|
||||||
template<std::size_t buffLen>
|
template<std::size_t buffLen>
|
||||||
class BasicString;
|
class BasicString;
|
||||||
@ -41,7 +41,7 @@ class StringView: public detail::BaseStringView {
|
|||||||
constexpr StringView(const BasicString<SmallStrSz> &str) noexcept: BaseStringView(str.data(), str.len()) {}
|
constexpr StringView(const BasicString<SmallStrSz> &str) noexcept: BaseStringView(str.data(), str.len()) {}
|
||||||
|
|
||||||
template<std::size_t SmallStrSz>
|
template<std::size_t SmallStrSz>
|
||||||
constexpr StringView(const BString<SmallStrSz> &str) noexcept: BaseStringView(str.data(), str.len()) {}
|
constexpr StringView(const IString<SmallStrSz> &str) noexcept: BaseStringView(str.data(), str.len()) {}
|
||||||
|
|
||||||
constexpr StringView(std::nullptr_t) noexcept {}
|
constexpr StringView(std::nullptr_t) noexcept {}
|
||||||
|
|
||||||
|
2
deps/ox/src/ox/std/test/tests.cpp
vendored
2
deps/ox/src/ox/std/test/tests.cpp
vendored
@ -68,7 +68,7 @@ static std::map<ox::StringView, ox::Error(*)()> tests = {
|
|||||||
{
|
{
|
||||||
"BString",
|
"BString",
|
||||||
[]() {
|
[]() {
|
||||||
ox::BString<5> s;
|
ox::IString<5> s;
|
||||||
s += "A";
|
s += "A";
|
||||||
s += "B";
|
s += "B";
|
||||||
s += 9;
|
s += 9;
|
||||||
|
2
deps/ox/src/ox/std/trace.cpp
vendored
2
deps/ox/src/ox/std/trace.cpp
vendored
@ -37,7 +37,7 @@ void setLogger(Logger *logger) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void send(const TraceMsg &msg) noexcept {
|
void send(const TraceMsg &msg) noexcept {
|
||||||
oxIgnoreError(logger->send(msg));
|
std::ignore = logger->send(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
8
deps/ox/src/ox/std/trace.hpp
vendored
8
deps/ox/src/ox/std/trace.hpp
vendored
@ -12,7 +12,7 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "bstring.hpp"
|
#include "istring.hpp"
|
||||||
#include "def.hpp"
|
#include "def.hpp"
|
||||||
#include "fmt.hpp"
|
#include "fmt.hpp"
|
||||||
#include "hashmap.hpp"
|
#include "hashmap.hpp"
|
||||||
@ -148,12 +148,12 @@ class OutStream {
|
|||||||
m_msg.line = line;
|
m_msg.line = line;
|
||||||
m_msg.ch = ch;
|
m_msg.ch = ch;
|
||||||
const auto &firstSegment = fmtSegments.segments[0];
|
const auto &firstSegment = fmtSegments.segments[0];
|
||||||
oxIgnoreError(m_msg.msg.append(firstSegment.str, firstSegment.length));
|
std::ignore = m_msg.msg.append(firstSegment.str, firstSegment.length);
|
||||||
//const detail::FmtArg elements[sizeof...(args)] = {args...};
|
//const detail::FmtArg elements[sizeof...(args)] = {args...};
|
||||||
for (size_t i = 0; auto const&e : std::initializer_list<detail::FmtArg>{elements...}) {
|
for (size_t i = 0; auto const&e : std::initializer_list<detail::FmtArg>{elements...}) {
|
||||||
m_msg.msg += e.out;
|
m_msg.msg += e.out;
|
||||||
const auto &s = fmtSegments.segments[i + 1];
|
const auto &s = fmtSegments.segments[i + 1];
|
||||||
oxIgnoreError(m_msg.msg.append(s.str, s.length));
|
std::ignore = m_msg.msg.append(s.str, s.length);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,7 +182,7 @@ class OutStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t sz>
|
template<std::size_t sz>
|
||||||
constexpr OutStream &operator<<(const BString<sz> &v) noexcept {
|
constexpr OutStream &operator<<(const IString<sz> &v) noexcept {
|
||||||
return operator<<(v.c_str());
|
return operator<<(v.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
deps/ox/src/ox/std/typetraits.hpp
vendored
4
deps/ox/src/ox/std/typetraits.hpp
vendored
@ -272,7 +272,7 @@ constexpr bool is_move_constructible_v = detail::is_move_constructible<T>(0);
|
|||||||
template<std::size_t SmallStringSize>
|
template<std::size_t SmallStringSize>
|
||||||
class BasicString;
|
class BasicString;
|
||||||
template<std::size_t sz>
|
template<std::size_t sz>
|
||||||
class BString;
|
class IString;
|
||||||
class CStringView;
|
class CStringView;
|
||||||
class StringLiteral;
|
class StringLiteral;
|
||||||
class StringView;
|
class StringView;
|
||||||
@ -289,7 +289,7 @@ constexpr auto isOxString(const BasicString<sz>*) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t sz>
|
template<std::size_t sz>
|
||||||
constexpr auto isOxString(const BString<sz>*) noexcept {
|
constexpr auto isOxString(const IString<sz>*) noexcept {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
deps/ox/src/ox/std/uuid.hpp
vendored
10
deps/ox/src/ox/std/uuid.hpp
vendored
@ -9,7 +9,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "array.hpp"
|
#include "array.hpp"
|
||||||
#include "bstring.hpp"
|
#include "istring.hpp"
|
||||||
#include "buffer.hpp"
|
#include "buffer.hpp"
|
||||||
#include "random.hpp"
|
#include "random.hpp"
|
||||||
#include "ranges.hpp"
|
#include "ranges.hpp"
|
||||||
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
namespace ox {
|
namespace ox {
|
||||||
|
|
||||||
using UUIDStr = ox::BString<36>;
|
using UUIDStr = ox::IString<36>;
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ constexpr ox::Result<uint8_t> fromHex(ox::CRStringView v) noexcept {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr ox::BString<2> toHex(uint8_t v) noexcept {
|
constexpr ox::IString<2> toHex(uint8_t v) noexcept {
|
||||||
constexpr ox::Array<char, 16> valMap {
|
constexpr ox::Array<char, 16> valMap {
|
||||||
'0',
|
'0',
|
||||||
'1',
|
'1',
|
||||||
@ -155,7 +155,7 @@ class UUID {
|
|||||||
for (auto i = 0u; i < cnt; ++i) {
|
for (auto i = 0u; i < cnt; ++i) {
|
||||||
const auto v = value[valueI];
|
const auto v = value[valueI];
|
||||||
const auto h = detail::toHex(v);
|
const auto h = detail::toHex(v);
|
||||||
oxIgnoreError(writer.write(h.c_str(), h.len()));
|
std::ignore = writer.write(h.c_str(), h.len());
|
||||||
++valueI;
|
++valueI;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -175,7 +175,7 @@ class UUID {
|
|||||||
constexpr UUIDStr toString() const noexcept {
|
constexpr UUIDStr toString() const noexcept {
|
||||||
UUIDStr out;
|
UUIDStr out;
|
||||||
ox::CharBuffWriter bw(out.data(), out.cap());
|
ox::CharBuffWriter bw(out.data(), out.cap());
|
||||||
oxIgnoreError(toString(bw));
|
std::ignore = toString(bw);
|
||||||
out[out.cap()] = 0;
|
out[out.cap()] = 0;
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
@ -222,8 +222,8 @@ int caller2() {
|
|||||||
```
|
```
|
||||||
|
|
||||||
Lastly, there are a few macros available to help in passing ```ox::Error```s
|
Lastly, there are a few macros available to help in passing ```ox::Error```s
|
||||||
back up the call stack, ```oxReturnError```, ```oxThrowError```,
|
back up the call stack, ```oxReturnError```, ```oxThrowError```, and
|
||||||
```oxIgnoreError```, and ```oxRequire```.
|
```oxRequire```.
|
||||||
|
|
||||||
```oxReturnError``` is by far the more helpful of the two.
|
```oxReturnError``` is by far the more helpful of the two.
|
||||||
```oxReturnError``` will return an ```ox::Error``` if it is not 0 and
|
```oxReturnError``` will return an ```ox::Error``` if it is not 0 and
|
||||||
@ -232,13 +232,10 @@ Because exceptions are disabled for GBA builds and thus cannot be used in the
|
|||||||
engine, ```oxThrowError``` is only really useful at the boundary between
|
engine, ```oxThrowError``` is only really useful at the boundary between
|
||||||
engine libraries and Nostalgia Studio.
|
engine libraries and Nostalgia Studio.
|
||||||
|
|
||||||
```oxIgnoreError``` does what it says, it ignores the error.
|
|
||||||
Since ```ox::Error``` is always nodiscard, you must do something with them.
|
Since ```ox::Error``` is always nodiscard, you must do something with them.
|
||||||
In extremely rare cases, you may not have anything you can do with them or you
|
In rare cases, you may not have anything you can do with them or you may know
|
||||||
may know the code will never fail in that particular instance.
|
the code will never fail in that particular instance.
|
||||||
This should be used very sparingly.
|
This should be used sparingly.
|
||||||
At the time of this writing, it has only been used 4 times in 20,000 lines of
|
|
||||||
code.
|
|
||||||
|
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
@ -257,7 +254,7 @@ ox::Error engineCode() noexcept {
|
|||||||
|
|
||||||
void anyCode() {
|
void anyCode() {
|
||||||
auto [val, err] = foo(1);
|
auto [val, err] = foo(1);
|
||||||
oxIgnoreError(err);
|
std::ignore = err;
|
||||||
doStuff(val);
|
doStuff(val);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -28,11 +28,11 @@ void panic(const char *file, int line, const char *panicMsg, ox::Error const&err
|
|||||||
ox::heapmgr::initHeap(HEAP_BEGIN, HEAP_END);
|
ox::heapmgr::initHeap(HEAP_BEGIN, HEAP_END);
|
||||||
auto tctx = turbine::init(keel::loadRomFs("").unwrap(), "Nostalgia").unwrap();
|
auto tctx = turbine::init(keel::loadRomFs("").unwrap(), "Nostalgia").unwrap();
|
||||||
auto ctx = init(*tctx).unwrap();
|
auto ctx = init(*tctx).unwrap();
|
||||||
oxIgnoreError(initGfx(*ctx, {}));
|
std::ignore = initGfx(*ctx, {});
|
||||||
oxIgnoreError(initConsole(*ctx));
|
std::ignore = initConsole(*ctx);
|
||||||
setBgStatus(*ctx, 0, true);
|
setBgStatus(*ctx, 0, true);
|
||||||
clearBg(*ctx, 0);
|
clearBg(*ctx, 0);
|
||||||
ox::BString<23> serr = "Error code: ";
|
ox::IString<23> serr = "Error code: ";
|
||||||
serr += static_cast<int64_t>(err);
|
serr += static_cast<int64_t>(err);
|
||||||
puts(*ctx, 32 + 1, 1, "SADNESS...");
|
puts(*ctx, 32 + 1, 1, "SADNESS...");
|
||||||
puts(*ctx, 32 + 1, 4, "UNEXPECTED STATE:");
|
puts(*ctx, 32 + 1, 4, "UNEXPECTED STATE:");
|
||||||
|
@ -19,7 +19,7 @@ void AddPageCommand::redo() noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AddPageCommand::undo() noexcept {
|
void AddPageCommand::undo() noexcept {
|
||||||
oxIgnoreError(m_pal.pages.erase(static_cast<std::size_t>(m_pal.pages.size() - 1)));
|
std::ignore = m_pal.pages.erase(static_cast<std::size_t>(m_pal.pages.size() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ void DuplicatePageCommand::redo() noexcept {
|
|||||||
|
|
||||||
void DuplicatePageCommand::undo() noexcept {
|
void DuplicatePageCommand::undo() noexcept {
|
||||||
m_page = std::move(m_pal.pages[m_dstIdx]);
|
m_page = std::move(m_pal.pages[m_dstIdx]);
|
||||||
oxIgnoreError(m_pal.pages.erase(static_cast<std::size_t>(m_dstIdx)));
|
std::ignore = m_pal.pages.erase(static_cast<std::size_t>(m_dstIdx));
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t DuplicatePageCommand::insertIdx() const noexcept {
|
size_t DuplicatePageCommand::insertIdx() const noexcept {
|
||||||
@ -62,7 +62,7 @@ int RemovePageCommand::commandId() const noexcept {
|
|||||||
|
|
||||||
void RemovePageCommand::redo() noexcept {
|
void RemovePageCommand::redo() noexcept {
|
||||||
m_page = std::move(m_pal.pages[m_idx]);
|
m_page = std::move(m_pal.pages[m_idx]);
|
||||||
oxIgnoreError(m_pal.pages.erase(static_cast<std::size_t>(m_idx)));
|
std::ignore = m_pal.pages.erase(static_cast<std::size_t>(m_idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemovePageCommand::undo() noexcept {
|
void RemovePageCommand::undo() noexcept {
|
||||||
@ -86,7 +86,7 @@ void AddColorCommand::redo() noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AddColorCommand::undo() noexcept {
|
void AddColorCommand::undo() noexcept {
|
||||||
oxIgnoreError(m_pal->pages[m_page].erase(static_cast<std::size_t>(m_idx)));
|
std::ignore = m_pal->pages[m_page].erase(static_cast<std::size_t>(m_idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ int RemoveColorCommand::commandId() const noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RemoveColorCommand::redo() noexcept {
|
void RemoveColorCommand::redo() noexcept {
|
||||||
oxIgnoreError(m_pal->pages[m_page].erase(static_cast<std::size_t>(m_idx)));
|
std::ignore = m_pal->pages[m_page].erase(static_cast<std::size_t>(m_idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveColorCommand::undo() noexcept {
|
void RemoveColorCommand::undo() noexcept {
|
||||||
@ -171,8 +171,8 @@ void MoveColorCommand::undo() noexcept {
|
|||||||
|
|
||||||
void MoveColorCommand::moveColor(int idx, int offset) noexcept {
|
void MoveColorCommand::moveColor(int idx, int offset) noexcept {
|
||||||
const auto c = m_pal->pages[m_page][static_cast<std::size_t>(idx)];
|
const auto c = m_pal->pages[m_page][static_cast<std::size_t>(idx)];
|
||||||
oxIgnoreError(m_pal->pages[m_page].erase(static_cast<std::size_t>(idx)));
|
std::ignore = m_pal->pages[m_page].erase(static_cast<std::size_t>(idx));
|
||||||
m_pal->pages[m_page].insert(static_cast<std::size_t>(idx + offset), c);
|
m_pal->pages[m_page].insert(static_cast<std::size_t>(idx + offset), c);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace nostalgia::core {
|
namespace nostalgia::core {
|
||||||
|
|
||||||
class StudioModule: public studio::Module {
|
static class: public studio::Module {
|
||||||
ox::Vector<studio::EditorMaker> editors(studio::StudioContext &ctx) const noexcept final {
|
ox::Vector<studio::EditorMaker> editors(studio::StudioContext &ctx) const noexcept final {
|
||||||
return {
|
return {
|
||||||
studio::editorMaker<TileSheetEditorImGui>(ctx, FileExt_ng),
|
studio::editorMaker<TileSheetEditorImGui>(ctx, FileExt_ng),
|
||||||
@ -25,9 +25,8 @@ class StudioModule: public studio::Module {
|
|||||||
out.emplace_back(ox::make<studio::ItemMakerT<core::Palette>>("Palette", "Palettes", FileExt_npal));
|
out.emplace_back(ox::make<studio::ItemMakerT<core::Palette>>("Palette", "Palettes", FileExt_npal));
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
};
|
} mod;
|
||||||
|
|
||||||
static StudioModule mod;
|
|
||||||
const studio::Module *studioModule() noexcept {
|
const studio::Module *studioModule() noexcept {
|
||||||
return &mod;
|
return &mod;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ core::PaletteChangeCommand::PaletteChangeCommand(
|
|||||||
m_img(img),
|
m_img(img),
|
||||||
m_idx(std::move(idx)),
|
m_idx(std::move(idx)),
|
||||||
m_oldPalette(m_img.defaultPalette),
|
m_oldPalette(m_img.defaultPalette),
|
||||||
m_newPalette(ox::FileAddress(ox::sfmt<ox::BString<43>>("uuid://{}", newPalette))) {
|
m_newPalette(ox::FileAddress(ox::sfmt<ox::IString<43>>("uuid://{}", newPalette))) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaletteChangeCommand::redo() noexcept {
|
void PaletteChangeCommand::redo() noexcept {
|
||||||
|
@ -64,6 +64,7 @@ static ox::Error toPngFile(
|
|||||||
for (auto &c : pixels) {
|
for (auto &c : pixels) {
|
||||||
c = color32(color(pal, page, c)) | static_cast<Color32>(0XFF << 24);
|
c = color32(color(pal, page, c)) | static_cast<Color32>(0XFF << 24);
|
||||||
}
|
}
|
||||||
|
std::hash<std::string>();
|
||||||
constexpr auto fmt = LCT_RGBA;
|
constexpr auto fmt = LCT_RGBA;
|
||||||
return OxError(static_cast<ox::ErrorCode>(
|
return OxError(static_cast<ox::ErrorCode>(
|
||||||
lodepng_encode_file(
|
lodepng_encode_file(
|
||||||
@ -81,7 +82,7 @@ TileSheetEditorImGui::TileSheetEditorImGui(studio::StudioContext &sctx, ox::CRSt
|
|||||||
m_tctx(m_sctx.tctx),
|
m_tctx(m_sctx.tctx),
|
||||||
m_view(m_sctx, path, *undoStack()),
|
m_view(m_sctx, path, *undoStack()),
|
||||||
m_model(m_view.model()) {
|
m_model(m_view.model()) {
|
||||||
oxIgnoreError(setPaletteSelection());
|
std::ignore = setPaletteSelection();
|
||||||
// connect signal/slots
|
// connect signal/slots
|
||||||
undoStack()->changeTriggered.connect(this, &TileSheetEditorImGui::markUnsavedChanges);
|
undoStack()->changeTriggered.connect(this, &TileSheetEditorImGui::markUnsavedChanges);
|
||||||
m_subsheetEditor.inputSubmitted.connect(this, &TileSheetEditorImGui::updateActiveSubsheet);
|
m_subsheetEditor.inputSubmitted.connect(this, &TileSheetEditorImGui::updateActiveSubsheet);
|
||||||
@ -440,7 +441,7 @@ void TileSheetEditorImGui::drawPaletteSelector() noexcept {
|
|||||||
ImGui::PushID(static_cast<int>(i));
|
ImGui::PushID(static_cast<int>(i));
|
||||||
// Column: color idx
|
// Column: color idx
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
auto const label = ox::BString<8>() + (i + 1);
|
auto const label = ox::IString<8>() + (i + 1);
|
||||||
auto const rowSelected = i == m_view.palIdx();
|
auto const rowSelected = i == m_view.palIdx();
|
||||||
if (ImGui::Selectable(label.c_str(), rowSelected, ImGuiSelectableFlags_SpanAllColumns)) {
|
if (ImGui::Selectable(label.c_str(), rowSelected, ImGuiSelectableFlags_SpanAllColumns)) {
|
||||||
m_view.setPalIdx(i);
|
m_view.setPalIdx(i);
|
||||||
|
@ -28,7 +28,7 @@ class TileSheetEditorImGui: public studio::Editor {
|
|||||||
private:
|
private:
|
||||||
class SubSheetEditor {
|
class SubSheetEditor {
|
||||||
private:
|
private:
|
||||||
ox::BString<100> m_name;
|
ox::IString<100> m_name;
|
||||||
int m_cols = 0;
|
int m_cols = 0;
|
||||||
int m_rows = 0;
|
int m_rows = 0;
|
||||||
bool m_show = false;
|
bool m_show = false;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
namespace nostalgia::scene {
|
namespace nostalgia::scene {
|
||||||
|
|
||||||
class SceneModule: public keel::Module {
|
static class: public keel::Module {
|
||||||
private:
|
private:
|
||||||
SceneDocToSceneStaticConverter m_sceneDocToSceneStaticConverter;
|
SceneDocToSceneStaticConverter m_sceneDocToSceneStaticConverter;
|
||||||
|
|
||||||
@ -42,9 +42,8 @@ class SceneModule: public keel::Module {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
} mod;
|
||||||
|
|
||||||
static const SceneModule mod;
|
|
||||||
const keel::Module *keelModule() noexcept {
|
const keel::Module *keelModule() noexcept {
|
||||||
return &mod;
|
return &mod;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ namespace nostalgia::scene {
|
|||||||
|
|
||||||
constexpr ox::StringLiteral FileExt_nscn("nscn");
|
constexpr ox::StringLiteral FileExt_nscn("nscn");
|
||||||
|
|
||||||
class StudioModule: public studio::Module {
|
static class: public studio::Module {
|
||||||
public:
|
public:
|
||||||
ox::Vector<studio::EditorMaker> editors(studio::StudioContext &ctx) const noexcept override {
|
ox::Vector<studio::EditorMaker> editors(studio::StudioContext &ctx) const noexcept override {
|
||||||
return {
|
return {
|
||||||
@ -21,9 +21,8 @@ class StudioModule: public studio::Module {
|
|||||||
ox::Vector<ox::UPtr<studio::ItemMaker>> out;
|
ox::Vector<ox::UPtr<studio::ItemMaker>> out;
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
};
|
} mod;
|
||||||
|
|
||||||
static StudioModule const mod;
|
|
||||||
const studio::Module *studioModule() noexcept {
|
const studio::Module *studioModule() noexcept {
|
||||||
return &mod;
|
return &mod;
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ class AssetRef: public ox::SignalHandler {
|
|||||||
}
|
}
|
||||||
if (m_ctr) {
|
if (m_ctr) {
|
||||||
m_ctr->decRefs();
|
m_ctr->decRefs();
|
||||||
oxIgnoreError(m_ctr->updated.disconnectObject(this));
|
std::ignore = m_ctr->updated.disconnectObject(this);
|
||||||
}
|
}
|
||||||
m_ctr = h.m_ctr;
|
m_ctr = h.m_ctr;
|
||||||
if (m_ctr) {
|
if (m_ctr) {
|
||||||
@ -133,11 +133,11 @@ class AssetRef: public ox::SignalHandler {
|
|||||||
}
|
}
|
||||||
if (m_ctr) {
|
if (m_ctr) {
|
||||||
m_ctr->decRefs();
|
m_ctr->decRefs();
|
||||||
oxIgnoreError(m_ctr->updated.disconnectObject(this));
|
std::ignore = m_ctr->updated.disconnectObject(this);
|
||||||
}
|
}
|
||||||
m_ctr = h.m_ctr;
|
m_ctr = h.m_ctr;
|
||||||
if (m_ctr) {
|
if (m_ctr) {
|
||||||
oxIgnoreError(m_ctr->updated.disconnectObject(&h));
|
std::ignore = m_ctr->updated.disconnectObject(&h);
|
||||||
m_ctr->updated.connect(this, &AssetRef::emitUpdated);
|
m_ctr->updated.connect(this, &AssetRef::emitUpdated);
|
||||||
}
|
}
|
||||||
h.m_ctr = nullptr;
|
h.m_ctr = nullptr;
|
||||||
|
@ -11,7 +11,7 @@ ox::Error init(
|
|||||||
ox::UPtr<ox::FileSystem> &&fs,
|
ox::UPtr<ox::FileSystem> &&fs,
|
||||||
ox::CRStringView appName) noexcept {
|
ox::CRStringView appName) noexcept {
|
||||||
ctx.appName = appName;
|
ctx.appName = appName;
|
||||||
oxIgnoreError(setRomFs(ctx, std::move(fs)));
|
std::ignore = setRomFs(ctx, std::move(fs));
|
||||||
#ifndef OX_BARE_METAL
|
#ifndef OX_BARE_METAL
|
||||||
auto const&mods = modules();
|
auto const&mods = modules();
|
||||||
for (auto &mod : mods) {
|
for (auto &mod : mods) {
|
||||||
|
@ -28,7 +28,7 @@ class NewMenu: public studio::Popup {
|
|||||||
private:
|
private:
|
||||||
Stage m_stage = Stage::Closed;
|
Stage m_stage = Stage::Closed;
|
||||||
ox::String m_typeName;
|
ox::String m_typeName;
|
||||||
ox::BString<255> m_itemName;
|
ox::IString<255> m_itemName;
|
||||||
ox::Vector<ox::UniquePtr<studio::ItemMaker>> m_types;
|
ox::Vector<ox::UniquePtr<studio::ItemMaker>> m_types;
|
||||||
int m_selectedType = 0;
|
int m_selectedType = 0;
|
||||||
bool m_open = false;
|
bool m_open = false;
|
||||||
|
@ -28,7 +28,7 @@ class NewProject: public studio::Popup {
|
|||||||
Stage m_stage = Stage::Closed;
|
Stage m_stage = Stage::Closed;
|
||||||
ox::String const m_projectDataDir;
|
ox::String const m_projectDataDir;
|
||||||
ox::String m_projectPath;
|
ox::String m_projectPath;
|
||||||
ox::BString<255> m_projectName;
|
ox::IString<255> m_projectName;
|
||||||
ox::Vector<ox::UniquePtr<studio::ItemMaker>> m_types;
|
ox::Vector<ox::UniquePtr<studio::ItemMaker>> m_types;
|
||||||
bool m_open = false;
|
bool m_open = false;
|
||||||
|
|
||||||
|
@ -417,10 +417,10 @@ ox::Error StudioUI::closeFile(ox::CRStringView path) noexcept {
|
|||||||
if (!m_openFiles.contains(path)) {
|
if (!m_openFiles.contains(path)) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
oxIgnoreError(m_openFiles.erase(std::remove(m_openFiles.begin(), m_openFiles.end(), path)));
|
std::ignore = m_openFiles.erase(std::remove(m_openFiles.begin(), m_openFiles.end(), path));
|
||||||
// save to config
|
// save to config
|
||||||
studio::editConfig<StudioConfig>(keelCtx(m_ctx), [&](StudioConfig *config) {
|
studio::editConfig<StudioConfig>(keelCtx(m_ctx), [&](StudioConfig *config) {
|
||||||
oxIgnoreError(config->openFiles.erase(std::remove(config->openFiles.begin(), config->openFiles.end(), path)));
|
std::ignore = config->openFiles.erase(std::remove(config->openFiles.begin(), config->openFiles.end(), path));
|
||||||
});
|
});
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ static ox::Result<ox::String> toResult(nfdresult_t r, NFD::UniquePathN const&pat
|
|||||||
ox::String out;
|
ox::String out;
|
||||||
for (auto i = 0u; path.get()[i]; ++i) {
|
for (auto i = 0u; path.get()[i]; ++i) {
|
||||||
auto const c = static_cast<char>(path.get()[i]);
|
auto const c = static_cast<char>(path.get()[i]);
|
||||||
oxIgnoreError(out.append(&c, 1));
|
std::ignore = out.append(&c, 1);
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
@ -9,13 +9,13 @@
|
|||||||
namespace studio {
|
namespace studio {
|
||||||
|
|
||||||
void TaskRunner::update(turbine::Context &ctx) noexcept {
|
void TaskRunner::update(turbine::Context &ctx) noexcept {
|
||||||
oxIgnoreError(m_tasks.erase(std::remove_if(m_tasks.begin(), m_tasks.end(), [&](ox::UPtr<studio::Task> &t) {
|
std::ignore = m_tasks.erase(std::remove_if(m_tasks.begin(), m_tasks.end(), [&](ox::UPtr<studio::Task> &t) {
|
||||||
auto const done = t->update(ctx) == TaskState::Done;
|
auto const done = t->update(ctx) == TaskState::Done;
|
||||||
if (done) {
|
if (done) {
|
||||||
t->finished.emit();
|
t->finished.emit();
|
||||||
}
|
}
|
||||||
return done;
|
return done;
|
||||||
})));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskRunner::add(Task &task) noexcept {
|
void TaskRunner::add(Task &task) noexcept {
|
||||||
|
@ -12,7 +12,7 @@ bool UndoCommand::mergeWith(UndoCommand const*) noexcept {
|
|||||||
|
|
||||||
void UndoStack::push(ox::UPtr<UndoCommand> &&cmd) noexcept {
|
void UndoStack::push(ox::UPtr<UndoCommand> &&cmd) noexcept {
|
||||||
for (auto const i = m_stackIdx; i < m_stack.size();) {
|
for (auto const i = m_stackIdx; i < m_stack.size();) {
|
||||||
oxIgnoreError(m_stack.erase(i));
|
std::ignore = m_stack.erase(i);
|
||||||
}
|
}
|
||||||
cmd->redo();
|
cmd->redo();
|
||||||
redoTriggered.emit(cmd.get());
|
redoTriggered.emit(cmd.get());
|
||||||
|
@ -22,7 +22,7 @@ void addDrawer(Context &ctx, Drawer *cd) noexcept {
|
|||||||
void removeDrawer(Context &ctx, Drawer *cd) noexcept {
|
void removeDrawer(Context &ctx, Drawer *cd) noexcept {
|
||||||
for (auto i = 0u; i < ctx.drawers.size(); ++i) {
|
for (auto i = 0u; i < ctx.drawers.size(); ++i) {
|
||||||
if (ctx.drawers[i] == cd) {
|
if (ctx.drawers[i] == cd) {
|
||||||
oxIgnoreError(ctx.drawers.erase(i));
|
std::ignore = ctx.drawers.erase(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user