Compare commits
11 Commits
69957bd7b2
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| a787fef614 | |||
| 298184d58f | |||
| 51999199c6 | |||
| 682fc5b853 | |||
| 94209fd740 | |||
| 170d6e35a6 | |||
| 83fd814d6e | |||
| 85f17c4188 | |||
| 5645e706ad | |||
| d4807cd2a0 | |||
| bd792a0d25 |
@@ -3,6 +3,7 @@ build/gba
|
||||
build/*-asan
|
||||
build/*-debug
|
||||
build/*-release
|
||||
dist
|
||||
.current_build
|
||||
tags
|
||||
compile_commands.json
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.19)
|
||||
cmake_minimum_required(VERSION 3.25)
|
||||
set(CMAKE_POLICY_DEFAULT_CMP0110 NEW) # requires CMake 3.19
|
||||
|
||||
project(Ox CXX)
|
||||
|
||||
+27
-1
@@ -1 +1,27 @@
|
||||
add_subdirectory(ox)
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
set(OX_OS_WINDOWS TRUE)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||
set(OX_OS_FREEBSD TRUE)
|
||||
else()
|
||||
set(OX_OS_FREEBSD FALSE)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
set(OX_OS_LINUX TRUE)
|
||||
else()
|
||||
set(OX_OS_LINUX FALSE)
|
||||
endif()
|
||||
|
||||
if(OX_USE_STDLIB)
|
||||
add_subdirectory(oc)
|
||||
endif()
|
||||
add_subdirectory(clargs)
|
||||
add_subdirectory(claw)
|
||||
add_subdirectory(event)
|
||||
add_subdirectory(fs)
|
||||
add_subdirectory(logconn)
|
||||
add_subdirectory(mc)
|
||||
add_subdirectory(model)
|
||||
add_subdirectory(preloader)
|
||||
add_subdirectory(std)
|
||||
|
||||
@@ -7,7 +7,7 @@ endif()
|
||||
|
||||
add_library(
|
||||
OxClArgs
|
||||
clargs.cpp
|
||||
src/clargs.cpp
|
||||
)
|
||||
|
||||
set_property(
|
||||
@@ -27,11 +27,16 @@ target_link_libraries(
|
||||
OxStd
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
OxClArgs PUBLIC
|
||||
include
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
clargs.hpp
|
||||
DIRECTORY
|
||||
include/ox
|
||||
DESTINATION
|
||||
include/ox/clargs
|
||||
include
|
||||
)
|
||||
|
||||
install(
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
#include <ox/std/string.hpp>
|
||||
#include "clargs.hpp"
|
||||
#include <ox/clargs/clargs.hpp>
|
||||
|
||||
namespace ox {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
add_library(
|
||||
OxClaw
|
||||
read.cpp
|
||||
write.cpp
|
||||
src/read.cpp
|
||||
src/write.cpp
|
||||
)
|
||||
|
||||
if(NOT MSVC)
|
||||
@@ -27,9 +27,22 @@ target_link_libraries(
|
||||
# )
|
||||
#endif()
|
||||
|
||||
install(TARGETS OxClaw
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
target_include_directories(
|
||||
OxClaw PUBLIC
|
||||
include
|
||||
)
|
||||
|
||||
install(
|
||||
DIRECTORY
|
||||
include/ox
|
||||
DESTINATION
|
||||
include
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS OxClaw
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
|
||||
if(OX_RUN_TESTS)
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <ox/std/buffer.hpp>
|
||||
|
||||
#include "read.hpp"
|
||||
#include <ox/claw/read.hpp>
|
||||
|
||||
namespace ox {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "write.hpp"
|
||||
#include <ox/claw/write.hpp>
|
||||
|
||||
namespace ox::detail {
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
add_library(
|
||||
OxEvent
|
||||
src/signal.cpp
|
||||
)
|
||||
|
||||
if(NOT MSVC)
|
||||
target_compile_options(OxEvent PRIVATE -Wsign-conversion)
|
||||
target_compile_options(OxEvent PRIVATE -Wconversion)
|
||||
endif()
|
||||
|
||||
if(NOT OX_BARE_METAL)
|
||||
set_property(
|
||||
TARGET
|
||||
OxEvent
|
||||
PROPERTY
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(
|
||||
OxEvent PUBLIC
|
||||
$<$<BOOL:${OX_USE_STDLIB}>:OX_USE_STDLIB>
|
||||
$<$<BOOL:${OX_NODEBUG}>:OX_NODEBUG>
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
OxEvent PUBLIC
|
||||
OxStd
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
OxEvent PUBLIC
|
||||
include
|
||||
)
|
||||
|
||||
install(
|
||||
DIRECTORY
|
||||
include/ox
|
||||
DESTINATION
|
||||
include
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS OxEvent
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
|
||||
if(OX_RUN_TESTS)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
@@ -6,7 +6,7 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "signal.hpp"
|
||||
#include <ox/event/signal.hpp>
|
||||
|
||||
namespace ox {
|
||||
|
||||
@@ -5,14 +5,12 @@ endif()
|
||||
|
||||
add_library(
|
||||
OxFS
|
||||
ptrarith/nodebuffer.hpp
|
||||
ptrarith/ptr.hpp
|
||||
filestore/filestoretemplate.cpp
|
||||
filesystem/filelocation.cpp
|
||||
filesystem/pathiterator.cpp
|
||||
filesystem/directory.cpp
|
||||
filesystem/filesystem.cpp
|
||||
filesystem/passthroughfs.cpp
|
||||
src/filestore/filestoretemplate.cpp
|
||||
src/filesystem/filelocation.cpp
|
||||
src/filesystem/pathiterator.cpp
|
||||
src/filesystem/directory.cpp
|
||||
src/filesystem/filesystem.cpp
|
||||
src/filesystem/passthroughfs.cpp
|
||||
)
|
||||
|
||||
if(NOT MSVC)
|
||||
@@ -33,10 +31,22 @@ target_link_libraries(
|
||||
OxMetalClaw
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
OxFS PUBLIC
|
||||
include
|
||||
)
|
||||
|
||||
install(
|
||||
DIRECTORY
|
||||
include/ox
|
||||
DESTINATION
|
||||
include
|
||||
)
|
||||
|
||||
if(NOT OX_BARE_METAL)
|
||||
add_executable(
|
||||
oxfs-tool
|
||||
tool.cpp
|
||||
src/tool.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
@@ -52,29 +62,6 @@ if(NOT OX_BARE_METAL)
|
||||
)
|
||||
endif()
|
||||
|
||||
install(
|
||||
FILES
|
||||
filestore/filestoretemplate.hpp
|
||||
DESTINATION
|
||||
include/ox/fs/filestore
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
filesystem/filesystem.hpp
|
||||
filesystem/pathiterator.hpp
|
||||
DESTINATION
|
||||
include/ox/fs/filesystem
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
ptrarith/nodebuffer.hpp
|
||||
ptrarith/ptr.hpp
|
||||
DESTINATION
|
||||
include/ox/fs/ptrarith
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS
|
||||
OxFS
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "filestoretemplate.hpp"
|
||||
#include <ox/fs/filestore/filestoretemplate.hpp>
|
||||
|
||||
namespace ox {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "directory.hpp"
|
||||
#include <ox/fs/filesystem/directory.hpp>
|
||||
|
||||
namespace ox {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <ox/model/modelops.hpp>
|
||||
|
||||
#include "filelocation.hpp"
|
||||
#include <ox/fs/filesystem/filelocation.hpp>
|
||||
|
||||
namespace ox {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <ox/std/error.hpp>
|
||||
#include <ox/std/utility.hpp>
|
||||
|
||||
#include "filesystem.hpp"
|
||||
#include <ox/fs/filesystem/filesystem.hpp>
|
||||
|
||||
namespace ox {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <ox/std/error.hpp>
|
||||
|
||||
#include "passthroughfs.hpp"
|
||||
#include <ox/fs/filesystem/passthroughfs.hpp>
|
||||
|
||||
#if defined(OX_HAS_PASSTHROUGHFS)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <ox/std/memops.hpp>
|
||||
#include <ox/std/strops.hpp>
|
||||
#include <ox/std/trace.hpp>
|
||||
#include "pathiterator.hpp"
|
||||
#include <ox/fs/filesystem/pathiterator.hpp>
|
||||
|
||||
OX_CLANG_NOWARN_BEGIN(-Wunsafe-buffer-usage)
|
||||
|
||||
@@ -38,17 +38,6 @@ const std::map<ox::StringView, std::function<ox::Error(ox::StringView)>> tests =
|
||||
auto a1 = buffer->malloc(sizeof(String)).value;
|
||||
auto a2 = buffer->malloc(sizeof(String)).value;
|
||||
oxAssert(a1.valid(), "Allocation 1 failed.");
|
||||
oxAssert(a2.valid(), "Allocation 2 failed.");
|
||||
auto s1Buff = buffer->dataOf<String>(a1);
|
||||
auto s2Buff = buffer->dataOf<String>(a2);
|
||||
oxAssert(s1Buff.valid(), "s1 allocation 1 failed.");
|
||||
oxAssert(s2Buff.valid(), "s2 allocation 2 failed.");
|
||||
auto &s1 = *new (s1Buff) String("asdf");
|
||||
auto &s2 = *new (s2Buff) String("aoeu");
|
||||
oxTrace("test") << "s1: " << s1.c_str();
|
||||
oxTrace("test") << "s2: " << s2.c_str();
|
||||
oxAssert(s1 == "asdf", "Allocation 1 not as expected.");
|
||||
oxAssert(s2 == "aoeu", "Allocation 2 not as expected.");
|
||||
oxAssert(buffer->free(a1), "Free failed.");
|
||||
oxAssert(buffer->free(a2), "Free failed.");
|
||||
oxAssert(buffer->setSize(buffer->size() - buffer->available()), "Resize failed.");
|
||||
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
add_library(
|
||||
OxLogConn
|
||||
logconn.cpp
|
||||
src/logconn.cpp
|
||||
)
|
||||
|
||||
set_property(
|
||||
@@ -24,12 +24,16 @@ target_link_libraries(
|
||||
$<$<BOOL:${OX_OS_WINDOWS}>:ws2_32>
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
OxLogConn PUBLIC
|
||||
include
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
circularbuff.hpp
|
||||
logconn.hpp
|
||||
DIRECTORY
|
||||
include/ox
|
||||
DESTINATION
|
||||
include/ox/logconn
|
||||
include
|
||||
)
|
||||
|
||||
install(
|
||||
@@ -6,7 +6,9 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#ifdef OX_USE_STDLIB
|
||||
#include <ox/std/defines.hpp>
|
||||
|
||||
#ifndef OX_OS_BareMetal
|
||||
#include <cstdio>
|
||||
|
||||
#ifndef _WIN32
|
||||
@@ -23,7 +25,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
#include "logconn.hpp"
|
||||
#include <ox/logconn/logconn.hpp>
|
||||
|
||||
|
||||
namespace ox {
|
||||
@@ -1,7 +1,7 @@
|
||||
add_library(
|
||||
OxMetalClaw
|
||||
read.cpp
|
||||
write.cpp
|
||||
src/read.cpp
|
||||
src/write.cpp
|
||||
)
|
||||
|
||||
if(NOT MSVC)
|
||||
@@ -24,22 +24,22 @@ if(NOT OX_BARE_METAL)
|
||||
)
|
||||
endif()
|
||||
|
||||
install(
|
||||
FILES
|
||||
intops.hpp
|
||||
err.hpp
|
||||
mc.hpp
|
||||
presenceindicator.hpp
|
||||
read.hpp
|
||||
types.hpp
|
||||
write.hpp
|
||||
DESTINATION
|
||||
include/ox/mc
|
||||
target_include_directories(
|
||||
OxMetalClaw PUBLIC
|
||||
include
|
||||
)
|
||||
|
||||
install(TARGETS OxMetalClaw
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
install(
|
||||
DIRECTORY
|
||||
include/ox
|
||||
DESTINATION
|
||||
include
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS OxMetalClaw
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
|
||||
if(OX_RUN_TESTS)
|
||||
@@ -44,15 +44,7 @@ class MetalClawWriter: public ModelHandlerBase<MetalClawWriter<Writer>, OpType::
|
||||
|
||||
constexpr ~MetalClawWriter() noexcept = default;
|
||||
|
||||
constexpr Error field(CString, int8_t const *val) noexcept;
|
||||
constexpr Error field(CString, int16_t const *val) noexcept;
|
||||
constexpr Error field(CString, int32_t const *val) noexcept;
|
||||
constexpr Error field(CString, int64_t const *val) noexcept;
|
||||
|
||||
constexpr Error field(CString, uint8_t const *val) noexcept;
|
||||
constexpr Error field(CString, uint16_t const *val) noexcept;
|
||||
constexpr Error field(CString, uint32_t const *val) noexcept;
|
||||
constexpr Error field(CString, uint64_t const *val) noexcept;
|
||||
constexpr Error field(CString, Integer_c auto const *val) noexcept;
|
||||
|
||||
constexpr Error field(CString, bool const *val) noexcept;
|
||||
|
||||
@@ -133,42 +125,7 @@ constexpr MetalClawWriter<Writer>::MetalClawWriter(Writer &writer, Optional<int>
|
||||
}
|
||||
|
||||
template<Writer_c Writer>
|
||||
constexpr Error MetalClawWriter<Writer>::field(CString, int8_t const *val) noexcept {
|
||||
return appendInteger(*val);
|
||||
}
|
||||
|
||||
template<Writer_c Writer>
|
||||
constexpr Error MetalClawWriter<Writer>::field(CString, int16_t const *val) noexcept {
|
||||
return appendInteger(*val);
|
||||
}
|
||||
|
||||
template<Writer_c Writer>
|
||||
constexpr Error MetalClawWriter<Writer>::field(CString, int32_t const *val) noexcept {
|
||||
return appendInteger(*val);
|
||||
}
|
||||
|
||||
template<Writer_c Writer>
|
||||
constexpr Error MetalClawWriter<Writer>::field(CString, int64_t const *val) noexcept {
|
||||
return appendInteger(*val);
|
||||
}
|
||||
|
||||
template<Writer_c Writer>
|
||||
constexpr Error MetalClawWriter<Writer>::field(CString, uint8_t const *val) noexcept {
|
||||
return appendInteger(*val);
|
||||
}
|
||||
|
||||
template<Writer_c Writer>
|
||||
constexpr Error MetalClawWriter<Writer>::field(CString, uint16_t const *val) noexcept {
|
||||
return appendInteger(*val);
|
||||
}
|
||||
|
||||
template<Writer_c Writer>
|
||||
constexpr Error MetalClawWriter<Writer>::field(CString, uint32_t const *val) noexcept {
|
||||
return appendInteger(*val);
|
||||
}
|
||||
|
||||
template<Writer_c Writer>
|
||||
constexpr Error MetalClawWriter<Writer>::field(CString, uint64_t const *val) noexcept {
|
||||
constexpr Error MetalClawWriter<Writer>::field(CString, Integer_c auto const *val) noexcept {
|
||||
return appendInteger(*val);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <ox/std/buffer.hpp>
|
||||
#include <ox/std/reader.hpp>
|
||||
|
||||
#include "read.hpp"
|
||||
#include <ox/mc/read.hpp>
|
||||
|
||||
namespace ox {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <ox/std/memops.hpp>
|
||||
#include <ox/std/trace.hpp>
|
||||
|
||||
#include "write.hpp"
|
||||
#include <ox/mc/write.hpp>
|
||||
|
||||
namespace ox {
|
||||
|
||||
@@ -43,14 +43,14 @@ struct TestStruct {
|
||||
int32_t Int6 = 0;
|
||||
int32_t Int7 = 0;
|
||||
int32_t Int8 = 0;
|
||||
int unionIdx = 1;
|
||||
int32_t unionIdx = 1;
|
||||
TestUnion Union;
|
||||
ox::String String;
|
||||
ox::IString<32> IString = "";
|
||||
uint32_t List[4] = {0, 0, 0, 0};
|
||||
ox::Vector<uint32_t> Vector = {1, 2, 3, 4, 5};
|
||||
ox::Vector<uint32_t> Vector2 = {1, 2, 3, 4, 5};
|
||||
ox::HashMap<ox::String, int> Map;
|
||||
ox::HashMap<ox::String, int32_t> Map;
|
||||
TestStructNest EmptyStruct;
|
||||
TestStructNest Struct;
|
||||
constexpr ~TestStruct() noexcept {
|
||||
@@ -204,7 +204,8 @@ std::map<ox::StringView, ox::Error(*)()> tests = {
|
||||
std::cout << "val.length: " << val.length << '\n';
|
||||
return ox::Error(1);
|
||||
}
|
||||
ox::LittleEndian<decltype(expected)> decoded = *reinterpret_cast<decltype(expected)*>(&val.data[1]);
|
||||
ox::LittleEndian<decltype(expected)> decoded;
|
||||
ox::memcpy(&decoded, &val.data[1], sizeof(decoded));
|
||||
if (expected != decoded) {
|
||||
std::cout << "decoded: " << decoded << ", expected: " << expected << '\n';
|
||||
return ox::Error(1);
|
||||
@@ -370,7 +371,7 @@ std::map<ox::StringView, ox::Error(*)()> tests = {
|
||||
const auto [type, typeErr] = ox::buildTypeDef(typeStore, testIn);
|
||||
oxAssert(typeErr, "Descriptor write failed");
|
||||
ox::BufferReader br({dataBuff, dataBuffLen});
|
||||
OX_RETURN_ERROR(ox::walkModel<ox::MetalClawReader>(type, br,
|
||||
return ox::walkModel<ox::MetalClawReader>(type, br,
|
||||
[](const ox::Vector<ox::FieldName>&, const ox::Vector<ox::String>&, const ox::DescriptorField &f, ox::MetalClawReader *rdr) -> ox::Error {
|
||||
//std::cout << f.fieldName.c_str() << '\n';
|
||||
auto fieldName = f.fieldName.c_str();
|
||||
@@ -455,8 +456,7 @@ std::map<ox::StringView, ox::Error(*)()> tests = {
|
||||
}
|
||||
return ox::Error(0);
|
||||
}
|
||||
));
|
||||
return ox::Error(0);
|
||||
);
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
add_library(
|
||||
OxModel
|
||||
src/desctypes.cpp
|
||||
src/descwrite.cpp
|
||||
src/modelvalue.cpp
|
||||
)
|
||||
|
||||
if(NOT MSVC)
|
||||
target_compile_options(OxModel PRIVATE -Wconversion)
|
||||
target_compile_options(OxModel PRIVATE -Wsign-conversion)
|
||||
endif()
|
||||
|
||||
target_link_libraries(
|
||||
OxModel PUBLIC
|
||||
OxStd
|
||||
)
|
||||
|
||||
if(NOT OX_BARE_METAL)
|
||||
set_property(
|
||||
TARGET
|
||||
OxModel
|
||||
PROPERTY
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(
|
||||
OxModel PUBLIC
|
||||
OxStd
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
OxModel PUBLIC
|
||||
include
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS OxModel
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
|
||||
if(OX_RUN_TESTS)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
@@ -0,0 +1,7 @@
|
||||
<Type> : <TypeName><FieldList>
|
||||
<FieldList> : <FieldList> | <FieldList><Field>
|
||||
<Field> : <FieldType><TypeID><FieldName>
|
||||
<TypeID> : <TypeName> | <TypeName><Type>
|
||||
<TypeName> : <string>
|
||||
<FieldType> : <0: single> | <1: list>
|
||||
<FieldName> : <string>
|
||||
@@ -126,22 +126,7 @@ class TypeDescWriter {
|
||||
|
||||
private:
|
||||
[[nodiscard]]
|
||||
constexpr const DescriptorType *type(const int8_t *val) const noexcept;
|
||||
[[nodiscard]]
|
||||
constexpr const DescriptorType *type(const int16_t *val) const noexcept;
|
||||
[[nodiscard]]
|
||||
constexpr const DescriptorType *type(const int32_t *val) const noexcept;
|
||||
[[nodiscard]]
|
||||
constexpr const DescriptorType *type(const int64_t *val) const noexcept;
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr const DescriptorType *type(const uint8_t *val) const noexcept;
|
||||
[[nodiscard]]
|
||||
constexpr const DescriptorType *type(const uint16_t *val) const noexcept;
|
||||
[[nodiscard]]
|
||||
constexpr const DescriptorType *type(const uint32_t *val) const noexcept;
|
||||
[[nodiscard]]
|
||||
constexpr const DescriptorType *type(const uint64_t *val) const noexcept;
|
||||
constexpr const DescriptorType *type(const Integer_c auto *val) const noexcept;
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr const DescriptorType *type(const bool *val) const noexcept;
|
||||
@@ -295,52 +280,26 @@ constexpr const DescriptorType *TypeDescWriter::type(UnionView<U> val) const noe
|
||||
return t;
|
||||
}
|
||||
|
||||
constexpr const DescriptorType *TypeDescWriter::type(const int8_t*) const noexcept {
|
||||
constexpr auto PT = PrimitiveType::SignedInteger;
|
||||
constexpr auto Bytes = 1;
|
||||
return getType(types::Int8, 0, PT, Bytes);
|
||||
}
|
||||
|
||||
constexpr const DescriptorType *TypeDescWriter::type(const int16_t*) const noexcept {
|
||||
constexpr auto PT = PrimitiveType::SignedInteger;
|
||||
constexpr auto Bytes = 2;
|
||||
return getType(types::Int16, 0, PT, Bytes);
|
||||
}
|
||||
|
||||
constexpr const DescriptorType *TypeDescWriter::type(const int32_t*) const noexcept {
|
||||
constexpr auto PT = PrimitiveType::SignedInteger;
|
||||
constexpr auto Bytes = 4;
|
||||
return getType(types::Int32, 0, PT, Bytes);
|
||||
}
|
||||
|
||||
constexpr const DescriptorType *TypeDescWriter::type(const int64_t*) const noexcept {
|
||||
constexpr auto PT = PrimitiveType::SignedInteger;
|
||||
constexpr auto Bytes = 8;
|
||||
return getType(types::Int64, 0, PT, Bytes);
|
||||
}
|
||||
|
||||
constexpr const DescriptorType *TypeDescWriter::type(const uint8_t*) const noexcept {
|
||||
constexpr auto PT = PrimitiveType::UnsignedInteger;
|
||||
constexpr auto Bytes = 1;
|
||||
return getType(types::Uint8, 0, PT, Bytes);
|
||||
}
|
||||
|
||||
constexpr const DescriptorType *TypeDescWriter::type(const uint16_t*) const noexcept {
|
||||
constexpr auto PT = PrimitiveType::UnsignedInteger;
|
||||
constexpr auto Bytes = 2;
|
||||
return getType(types::Uint16, 0, PT, Bytes);
|
||||
}
|
||||
|
||||
constexpr const DescriptorType *TypeDescWriter::type(const uint32_t*) const noexcept {
|
||||
constexpr auto PT = PrimitiveType::UnsignedInteger;
|
||||
constexpr auto Bytes = 4;
|
||||
return getType(types::Uint32, 0, PT, Bytes);
|
||||
}
|
||||
|
||||
constexpr const DescriptorType *TypeDescWriter::type(const uint64_t*) const noexcept {
|
||||
constexpr auto PT = PrimitiveType::UnsignedInteger;
|
||||
constexpr auto Bytes = 8;
|
||||
return getType(types::Uint64, 0, PT, Bytes);
|
||||
constexpr const DescriptorType *TypeDescWriter::type(Integer_c auto const *val) const noexcept {
|
||||
constexpr auto isSigned = ox::is_signed_v<decltype(*val)>;
|
||||
constexpr auto PT = isSigned ?
|
||||
PrimitiveType::SignedInteger :
|
||||
PrimitiveType::UnsignedInteger;
|
||||
constexpr auto sz = sizeof(*val);
|
||||
constexpr auto bytes = sizeof(*val);
|
||||
return getType([] {
|
||||
switch (sz) {
|
||||
case 1:
|
||||
return isSigned ? types::Int8 : types::Uint8;
|
||||
case 2:
|
||||
return isSigned ? types::Int16 : types::Uint16;
|
||||
case 4:
|
||||
return isSigned ? types::Int32 : types::Uint32;
|
||||
case 8:
|
||||
return isSigned ? types::Int64 : types::Uint64;
|
||||
}
|
||||
return types::Int32;
|
||||
}(), 0, PT, bytes);
|
||||
}
|
||||
|
||||
constexpr const DescriptorType *TypeDescWriter::type(const bool*) const noexcept {
|
||||
@@ -6,7 +6,7 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "desctypes.hpp"
|
||||
#include <ox/model/desctypes.hpp>
|
||||
|
||||
namespace ox {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "descwrite.hpp"
|
||||
#include <ox/model/descwrite.hpp>
|
||||
|
||||
namespace ox {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <ox/std/hashmap.hpp>
|
||||
|
||||
#include "modelvalue.hpp"
|
||||
#include <ox/model/modelvalue.hpp>
|
||||
|
||||
namespace ox {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
add_library(
|
||||
OxOrganicClaw
|
||||
read.cpp
|
||||
write.cpp
|
||||
src/read.cpp
|
||||
src/write.cpp
|
||||
)
|
||||
|
||||
if(NOT MSVC)
|
||||
@@ -27,18 +27,22 @@ set_property(
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
oc.hpp
|
||||
read.hpp
|
||||
write.hpp
|
||||
DESTINATION
|
||||
include/ox/oc
|
||||
target_include_directories(
|
||||
OxOrganicClaw PUBLIC
|
||||
include
|
||||
)
|
||||
|
||||
install(TARGETS OxOrganicClaw
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
install(
|
||||
DIRECTORY
|
||||
include/ox
|
||||
DESTINATION
|
||||
include
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS OxOrganicClaw
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
|
||||
if(OX_RUN_TESTS)
|
||||
@@ -59,7 +59,7 @@ class OrganicClawWriter {
|
||||
|
||||
Error field(CString const key, int32_t const *val) noexcept {
|
||||
if (targetValid() && (*val || m_json.isArray())) {
|
||||
value(key) = *val;
|
||||
value(key) = static_cast<Json::Int>(*val);
|
||||
}
|
||||
++m_fieldIt;
|
||||
return {};
|
||||
@@ -92,7 +92,7 @@ class OrganicClawWriter {
|
||||
|
||||
Error field(CString const key, uint32_t const *val) noexcept {
|
||||
if (targetValid() && (*val || m_json.isArray())) {
|
||||
value(key) = *val;
|
||||
value(key) = static_cast<Json::UInt>(*val);
|
||||
}
|
||||
++m_fieldIt;
|
||||
return {};
|
||||
@@ -221,9 +221,9 @@ Error OrganicClawWriter::field(CString key, T const *val) noexcept {
|
||||
// the int type needs to be normalized because jsoncpp doesn't
|
||||
// factor in every permutation unsigned long, etc.
|
||||
if constexpr(is_signed_v<T>) {
|
||||
value(key) = static_cast<Int<8 * sizeof(*val)>>(*val);
|
||||
value(key) = static_cast<Json::Int64>(*val);
|
||||
} else {
|
||||
value(key) = static_cast<Uint<8 * sizeof(*val)>>(*val);
|
||||
value(key) = static_cast<Json::UInt64>(*val);
|
||||
}
|
||||
}
|
||||
} else if constexpr(isVector_v<T> || isArray_v<T>) {
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <ox/std/bit.hpp>
|
||||
#include <utility>
|
||||
|
||||
#include "read.hpp"
|
||||
#include <ox/oc/read.hpp>
|
||||
|
||||
namespace ox {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "write.hpp"
|
||||
#include <ox/oc/write.hpp>
|
||||
|
||||
namespace ox {
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
set(OX_OS_WINDOWS TRUE)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||
set(OX_OS_FREEBSD TRUE)
|
||||
else()
|
||||
set(OX_OS_FREEBSD FALSE)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
set(OX_OS_LINUX TRUE)
|
||||
else()
|
||||
set(OX_OS_LINUX FALSE)
|
||||
endif()
|
||||
|
||||
if(OX_USE_STDLIB)
|
||||
add_subdirectory(oc)
|
||||
endif()
|
||||
add_subdirectory(clargs)
|
||||
add_subdirectory(claw)
|
||||
add_subdirectory(event)
|
||||
add_subdirectory(fs)
|
||||
add_subdirectory(logconn)
|
||||
add_subdirectory(mc)
|
||||
add_subdirectory(model)
|
||||
add_subdirectory(preloader)
|
||||
add_subdirectory(std)
|
||||
@@ -1,46 +0,0 @@
|
||||
add_library(
|
||||
OxEvent
|
||||
signal.cpp
|
||||
)
|
||||
|
||||
if(NOT MSVC)
|
||||
target_compile_options(OxEvent PRIVATE -Wsign-conversion)
|
||||
target_compile_options(OxEvent PRIVATE -Wconversion)
|
||||
endif()
|
||||
|
||||
if(NOT OX_BARE_METAL)
|
||||
set_property(
|
||||
TARGET
|
||||
OxEvent
|
||||
PROPERTY
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(
|
||||
OxEvent PUBLIC
|
||||
$<$<BOOL:${OX_USE_STDLIB}>:OX_USE_STDLIB>
|
||||
$<$<BOOL:${OX_NODEBUG}>:OX_NODEBUG>
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
OxEvent PUBLIC
|
||||
OxStd
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
event.hpp
|
||||
signal.hpp
|
||||
DESTINATION
|
||||
include/ox/event
|
||||
)
|
||||
|
||||
install(TARGETS OxEvent
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
|
||||
if(OX_RUN_TESTS)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
@@ -1,54 +0,0 @@
|
||||
add_library(
|
||||
OxModel
|
||||
desctypes.cpp
|
||||
descwrite.cpp
|
||||
modelvalue.cpp
|
||||
)
|
||||
|
||||
if(NOT MSVC)
|
||||
target_compile_options(OxModel PRIVATE -Wconversion)
|
||||
target_compile_options(OxModel PRIVATE -Wsign-conversion)
|
||||
endif()
|
||||
|
||||
target_link_libraries(
|
||||
OxModel PUBLIC
|
||||
OxStd
|
||||
)
|
||||
|
||||
if(NOT OX_BARE_METAL)
|
||||
set_property(
|
||||
TARGET
|
||||
OxModel
|
||||
PROPERTY
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
endif()
|
||||
|
||||
install(
|
||||
FILES
|
||||
def.hpp
|
||||
descread.hpp
|
||||
desctypes.hpp
|
||||
descwrite.hpp
|
||||
optype.hpp
|
||||
metadata.hpp
|
||||
model.hpp
|
||||
modelhandleradaptor.hpp
|
||||
modelops.hpp
|
||||
modelvalue.hpp
|
||||
typenamecatcher.hpp
|
||||
types.hpp
|
||||
typestore.hpp
|
||||
walk.hpp
|
||||
DESTINATION
|
||||
include/ox/model
|
||||
)
|
||||
|
||||
install(TARGETS OxModel
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
|
||||
if(OX_RUN_TESTS)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
add_library(
|
||||
OxPreloader
|
||||
preloader.cpp
|
||||
src/preloader.cpp
|
||||
)
|
||||
|
||||
if(NOT MSVC)
|
||||
@@ -16,14 +16,16 @@ target_link_libraries(
|
||||
OxStd
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
OxPreloader PUBLIC
|
||||
include
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
alignmentcatcher.hpp
|
||||
platspecs.hpp
|
||||
preloader.hpp
|
||||
unionsizecatcher.hpp
|
||||
DIRECTORY
|
||||
include/ox
|
||||
DESTINATION
|
||||
include/nostalgia/preloader
|
||||
include
|
||||
)
|
||||
|
||||
install(
|
||||
@@ -6,7 +6,7 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "preloader.hpp"
|
||||
#include <ox/preloader/preloader.hpp>
|
||||
|
||||
namespace ox {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user