Compare commits
67 Commits
release-d2
...
05d08a7687
Author | SHA1 | Date | |
---|---|---|---|
05d08a7687 | |||
c6750d50fc | |||
dade484d87 | |||
04f3d6b491 | |||
b015fe88b7 | |||
db2dc28f92 | |||
74fb051ef2 | |||
24fda7d589 | |||
a60cdf0a61 | |||
b97d7d9956 | |||
ce1eea817d | |||
9a0a2fd46a | |||
4e50889b5c | |||
9c0acf1b8f | |||
ee05118478 | |||
a41e93c582 | |||
59fa39070f | |||
c55994f67d | |||
e81d28a681 | |||
0626c2a815 | |||
dbcd37d7ea | |||
10a12f2ab2 | |||
2667be88f6 | |||
5972d8acef | |||
9c026e1a6c | |||
1dff26d895 | |||
ff2eb5b11b | |||
6a500345b4 | |||
28b1c6dcf4 | |||
ef9cb8bea4 | |||
0d106bde21 | |||
f038b89ab4 | |||
b75bbc4d20 | |||
227dd68a4f | |||
02db760b8c | |||
09c57545bc | |||
b9fddd47c2 | |||
f128664a81 | |||
e84df7801e | |||
caa59f3724 | |||
1cf09433e8 | |||
9948346ce4 | |||
aa8200beed | |||
961ab75662 | |||
124c7029bd | |||
d740609c8e | |||
5d1f680a51 | |||
08be822bdd | |||
c2e34b6456 | |||
173d3f4bc7 | |||
8a29c0952c | |||
5848bc8eb7 | |||
7ba66787f8 | |||
e367575974 | |||
2bc2003caa | |||
b31062e609 | |||
e4285bd48b | |||
a76638cc86 | |||
5433fd9b1d | |||
b46cb65b7f | |||
877349df46 | |||
5418c06296 | |||
dd9c1100c3 | |||
db82aee7c7 | |||
edf15858ca | |||
d1efbb2ffa | |||
051623f4b5 |
@ -2,4 +2,4 @@
|
||||
source:
|
||||
- src
|
||||
copyright_notice: |-
|
||||
Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
Copyright 2016 - 2024 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
|
6
deps/glutils/.liccor.yml
vendored
Normal file
6
deps/glutils/.liccor.yml
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
source:
|
||||
- include
|
||||
- src
|
||||
copyright_notice: |-
|
||||
Copyright 2016 - 2024 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
37
deps/glutils/include/glutils/glutils.hpp
vendored
37
deps/glutils/include/glutils/glutils.hpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
* Copyright 2016 - 2024 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@ -150,8 +150,39 @@ class FrameBufferBind {
|
||||
|
||||
void bind(const FrameBuffer &fb) noexcept;
|
||||
|
||||
struct ShaderVarSet {
|
||||
GLsizei len{};
|
||||
ox::String name;
|
||||
};
|
||||
|
||||
ox::Result<GLProgram> buildShaderProgram(ox::CStringView const&vert, ox::CStringView const&frag, ox::CStringView const&geo = "") noexcept;
|
||||
struct ProgramSource {
|
||||
ox::Vector<glutils::ShaderVarSet> const shaderParams;
|
||||
GLsizei const rowLen = [this] {
|
||||
GLsizei len{};
|
||||
for (auto const&v : shaderParams) {
|
||||
len += v.len;
|
||||
}
|
||||
return len;
|
||||
}();
|
||||
GLsizei const vboLen = rowLen * 4;
|
||||
ox::String const vertShader{};
|
||||
ox::String const fragShader{};
|
||||
ox::String const geomShader{};
|
||||
};
|
||||
|
||||
ox::Result<GLProgram> buildShaderProgram(ProgramSource const&src) noexcept;
|
||||
|
||||
ox::Result<GLProgram> buildShaderProgram(
|
||||
ox::CStringView const&vert,
|
||||
ox::CStringView const&frag,
|
||||
ox::CStringView const&geo = "") noexcept;
|
||||
|
||||
void setupShaderParams(
|
||||
GLProgram const&shader,
|
||||
ox::Vector<ShaderVarSet> const&vars,
|
||||
GLsizei vertexRowLen) noexcept;
|
||||
|
||||
void setupShaderParams(GLProgram const&shader, ox::Vector<ShaderVarSet> const&vars) noexcept;
|
||||
|
||||
glutils::GLVertexArray generateVertexArrayObject() noexcept;
|
||||
|
||||
@ -160,6 +191,8 @@ glutils::GLBuffer generateBuffer() noexcept;
|
||||
[[nodiscard]]
|
||||
FrameBuffer generateFrameBuffer(int width, int height) noexcept;
|
||||
|
||||
void resizeFrameBuffer(FrameBuffer &fb, int width, int height) noexcept;
|
||||
|
||||
/**
|
||||
* Resizes a FrameBuffer, and creates if it does not already exist.
|
||||
*/
|
||||
|
50
deps/glutils/src/glutils.cpp
vendored
50
deps/glutils/src/glutils.cpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
* Copyright 2016 - 2024 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <ox/std/assert.hpp>
|
||||
@ -88,6 +88,40 @@ static ox::Result<GLShader> buildShader(
|
||||
return shader;
|
||||
}
|
||||
|
||||
ox::Result<GLProgram> buildShaderProgram(ProgramSource const&src) noexcept {
|
||||
oxRequireM(program, buildShaderProgram(
|
||||
src.vertShader,
|
||||
src.fragShader,
|
||||
src.geomShader));
|
||||
setupShaderParams(program, src.shaderParams, src.rowLen);
|
||||
return std::move(program);
|
||||
}
|
||||
|
||||
void setupShaderParams(
|
||||
GLProgram const&shader,
|
||||
ox::Vector<ShaderVarSet> const&vars,
|
||||
GLsizei vertexRowLen) noexcept {
|
||||
// setup vars
|
||||
for (auto lenWritten = 0LU; auto const&v : vars) {
|
||||
auto const attr = static_cast<GLuint>(glGetAttribLocation(shader, v.name.c_str()));
|
||||
glEnableVertexAttribArray(attr);
|
||||
glVertexAttribPointer(
|
||||
attr, v.len, GL_FLOAT, GL_FALSE,
|
||||
vertexRowLen * static_cast<GLsizei>(sizeof(float)),
|
||||
std::bit_cast<void*>(uintptr_t{lenWritten * sizeof(float)}));
|
||||
lenWritten += static_cast<size_t>(v.len);
|
||||
}
|
||||
}
|
||||
|
||||
void setupShaderParams(GLProgram const&shader, ox::Vector<ShaderVarSet> const&vars) noexcept {
|
||||
// get row len
|
||||
GLsizei vertexRowLen{};
|
||||
for (auto const&v : vars) {
|
||||
vertexRowLen += v.len;
|
||||
}
|
||||
setupShaderParams(shader, vars, vertexRowLen);
|
||||
}
|
||||
|
||||
ox::Result<GLProgram> buildShaderProgram(
|
||||
ox::CStringView const&vert,
|
||||
ox::CStringView const&frag,
|
||||
@ -147,11 +181,7 @@ FrameBuffer generateFrameBuffer(int width, int height) noexcept {
|
||||
return fb;
|
||||
}
|
||||
|
||||
void resizeInitFrameBuffer(FrameBuffer &fb, int width, int height) noexcept {
|
||||
if (!fb) {
|
||||
fb = generateFrameBuffer(width, height);
|
||||
return;
|
||||
}
|
||||
void resizeFrameBuffer(FrameBuffer &fb, int width, int height) noexcept {
|
||||
width = ox::max(1, width);
|
||||
height = ox::max(1, height);
|
||||
fb.width = width;
|
||||
@ -171,6 +201,14 @@ void resizeInitFrameBuffer(FrameBuffer &fb, int width, int height) noexcept {
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
}
|
||||
|
||||
void resizeInitFrameBuffer(FrameBuffer &fb, int width, int height) noexcept {
|
||||
if (!fb) {
|
||||
fb = generateFrameBuffer(width, height);
|
||||
return;
|
||||
}
|
||||
resizeFrameBuffer(fb, width, height);
|
||||
}
|
||||
|
||||
void resizeInitFrameBuffer(FrameBuffer &fb, ox::Size const&sz) noexcept {
|
||||
resizeInitFrameBuffer(fb, sz.width, sz.height);
|
||||
}
|
||||
|
4
deps/ox/src/ox/clargs/clargs.cpp
vendored
4
deps/ox/src/ox/clargs/clargs.cpp
vendored
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <ox/std/string.hpp>
|
||||
|
4
deps/ox/src/ox/clargs/clargs.hpp
vendored
4
deps/ox/src/ox/clargs/clargs.hpp
vendored
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/claw/claw.hpp
vendored
2
deps/ox/src/ox/claw/claw.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/claw/format.hpp
vendored
2
deps/ox/src/ox/claw/format.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/claw/read.cpp
vendored
2
deps/ox/src/ox/claw/read.cpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
|
4
deps/ox/src/ox/claw/readclaw.cpp
vendored
4
deps/ox/src/ox/claw/readclaw.cpp
vendored
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
|
2
deps/ox/src/ox/claw/test/tests.cpp
vendored
2
deps/ox/src/ox/claw/test/tests.cpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
|
2
deps/ox/src/ox/claw/write.cpp
vendored
2
deps/ox/src/ox/claw/write.cpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "write.hpp"
|
||||
|
4
deps/ox/src/ox/claw/write.hpp
vendored
4
deps/ox/src/ox/claw/write.hpp
vendored
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/event/event.hpp
vendored
2
deps/ox/src/ox/event/event.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/event/signal.cpp
vendored
2
deps/ox/src/ox/event/signal.cpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "signal.hpp"
|
||||
|
2
deps/ox/src/ox/event/signal.hpp
vendored
2
deps/ox/src/ox/event/signal.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/event/test/tests.cpp
vendored
2
deps/ox/src/ox/event/test/tests.cpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#undef NDEBUG
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "filestoretemplate.hpp"
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/fs/filesystem/directory.cpp
vendored
2
deps/ox/src/ox/fs/filesystem/directory.cpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "directory.hpp"
|
||||
|
4
deps/ox/src/ox/fs/filesystem/directory.hpp
vendored
4
deps/ox/src/ox/fs/filesystem/directory.hpp
vendored
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
28
deps/ox/src/ox/fs/filesystem/filelocation.cpp
vendored
28
deps/ox/src/ox/fs/filesystem/filelocation.cpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <ox/model/modelops.hpp>
|
||||
@ -88,6 +88,32 @@ FileAddress &FileAddress::operator=(FileAddress &&other) noexcept {
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool FileAddress::operator==(FileAddress const&other) const noexcept {
|
||||
if (m_type != other.m_type) {
|
||||
auto const aIsPath =
|
||||
m_type == FileAddressType::Path || m_type == FileAddressType::ConstPath;
|
||||
auto const bIsPath =
|
||||
other.m_type == FileAddressType::Path || other.m_type == FileAddressType::ConstPath;
|
||||
if (!(aIsPath && bIsPath)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
switch (m_type) {
|
||||
case FileAddressType::ConstPath:
|
||||
case FileAddressType::Path: {
|
||||
auto const a = getPath();
|
||||
auto const b = other.getPath();
|
||||
return (other.m_type == FileAddressType::ConstPath || other.m_type == FileAddressType::Path)
|
||||
&& (a.value == b.value);
|
||||
}
|
||||
case FileAddressType::Inode:
|
||||
return m_data.inode == other.m_data.inode;
|
||||
case FileAddressType::None:
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FileAddress::operator==(CRStringView path) const noexcept {
|
||||
auto [p, err] = getPath();
|
||||
if (err) {
|
||||
|
11
deps/ox/src/ox/fs/filesystem/filelocation.hpp
vendored
11
deps/ox/src/ox/fs/filesystem/filelocation.hpp
vendored
@ -22,6 +22,9 @@ enum class FileAddressType: int8_t {
|
||||
Inode,
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
constexpr Error model(T *h, CommonPtrWith<class FileAddress> auto *fa) noexcept;
|
||||
|
||||
class FileAddress {
|
||||
|
||||
template<typename T>
|
||||
@ -67,6 +70,8 @@ class FileAddress {
|
||||
|
||||
FileAddress &operator=(FileAddress &&other) noexcept;
|
||||
|
||||
bool operator==(const FileAddress &other) const noexcept;
|
||||
|
||||
bool operator==(CRStringView path) const noexcept;
|
||||
|
||||
[[nodiscard]]
|
||||
@ -89,12 +94,12 @@ class FileAddress {
|
||||
}
|
||||
}
|
||||
|
||||
constexpr Result<ox::StringView> getPath() const noexcept {
|
||||
constexpr Result<ox::CStringView> getPath() const noexcept {
|
||||
switch (m_type) {
|
||||
case FileAddressType::Path:
|
||||
return ox::StringView(m_data.path);
|
||||
return ox::CStringView(m_data.path);
|
||||
case FileAddressType::ConstPath:
|
||||
return ox::StringView(m_data.constPath);
|
||||
return ox::CStringView(m_data.constPath);
|
||||
default:
|
||||
return OxError(1);
|
||||
}
|
||||
|
4
deps/ox/src/ox/fs/filesystem/filesystem.cpp
vendored
4
deps/ox/src/ox/fs/filesystem/filesystem.cpp
vendored
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <ox/std/error.hpp>
|
||||
|
4
deps/ox/src/ox/fs/filesystem/filesystem.hpp
vendored
4
deps/ox/src/ox/fs/filesystem/filesystem.hpp
vendored
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <ox/std/error.hpp>
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <ox/std/memops.hpp>
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/fs/filesystem/types.hpp
vendored
2
deps/ox/src/ox/fs/filesystem/types.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/fs/fs.hpp
vendored
2
deps/ox/src/ox/fs/fs.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
4
deps/ox/src/ox/fs/ptrarith/nodebuffer.hpp
vendored
4
deps/ox/src/ox/fs/ptrarith/nodebuffer.hpp
vendored
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
4
deps/ox/src/ox/fs/ptrarith/ptr.hpp
vendored
4
deps/ox/src/ox/fs/ptrarith/ptr.hpp
vendored
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/fs/test/tests.cpp
vendored
2
deps/ox/src/ox/fs/test/tests.cpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
// make sure asserts are enabled for the test file
|
||||
|
4
deps/ox/src/ox/fs/tool.cpp
vendored
4
deps/ox/src/ox/fs/tool.cpp
vendored
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
|
2
deps/ox/src/ox/logconn/def.hpp
vendored
2
deps/ox/src/ox/logconn/def.hpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
|
2
deps/ox/src/ox/logconn/logconn.cpp
vendored
2
deps/ox/src/ox/logconn/logconn.cpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
|
2
deps/ox/src/ox/mc/err.hpp
vendored
2
deps/ox/src/ox/mc/err.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/mc/intops.hpp
vendored
2
deps/ox/src/ox/mc/intops.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/mc/mc.hpp
vendored
2
deps/ox/src/ox/mc/mc.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/mc/presenceindicator.cpp
vendored
2
deps/ox/src/ox/mc/presenceindicator.cpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "err.hpp"
|
||||
|
4
deps/ox/src/ox/mc/presenceindicator.hpp
vendored
4
deps/ox/src/ox/mc/presenceindicator.hpp
vendored
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/mc/read.hpp
vendored
2
deps/ox/src/ox/mc/read.hpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
|
32
deps/ox/src/ox/mc/test/tests.cpp
vendored
32
deps/ox/src/ox/mc/test/tests.cpp
vendored
@ -320,27 +320,27 @@ std::map<ox::StringView, ox::Error(*)()> tests = {
|
||||
ox::ModelObject testOut;
|
||||
oxReturnError(testOut.setType(type));
|
||||
oxAssert(ox::readMC(dataBuff.data(), dataBuff.size(), &testOut), "Data read failed");
|
||||
oxAssert(testOut["Int"].get<int>() == testIn.Int, "testOut.Int failed");
|
||||
oxAssert(testOut["Bool"].get<bool>() == testIn.Bool, "testOut.Bool failed");
|
||||
oxAssert(testOut["BString"].get<ox::String>() == testIn.BString.c_str(), "testOut.String failed");
|
||||
oxAssert(testOut["String"].get<ox::String>() == testIn.String, "testOut.String failed");
|
||||
auto &testOutStruct = testOut["Struct"].get<ox::ModelObject>();
|
||||
auto &testOutUnion = testOut["Union"].get<ox::ModelUnion>();
|
||||
auto &testOutList = testOut["List"].get<ox::ModelValueVector>();
|
||||
auto testOutStructCopy = testOut["Struct"].get<ox::ModelObject>();
|
||||
auto testOutUnionCopy = testOut["Union"].get<ox::ModelUnion>();
|
||||
auto testOutListCopy = testOut["List"].get<ox::ModelValueVector>();
|
||||
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("BString").unwrap()->get<ox::String>() == testIn.BString.c_str(), "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 &testOutUnion = testOut.at("Union").unwrap()->get<ox::ModelUnion>();
|
||||
auto &testOutList = testOut.at("List").unwrap()->get<ox::ModelValueVector>();
|
||||
auto testOutStructCopy = testOut.at("Struct").unwrap()->get<ox::ModelObject>();
|
||||
auto testOutUnionCopy = testOut.at("Union").unwrap()->get<ox::ModelUnion>();
|
||||
auto testOutListCopy = testOut.at("List").unwrap()->get<ox::ModelValueVector>();
|
||||
oxAssert(testOutStruct.typeName() == TestStructNest::TypeName, "ModelObject TypeName failed");
|
||||
oxAssert(testOutStruct.typeVersion() == TestStructNest::TypeVersion, "ModelObject TypeVersion failed");
|
||||
oxAssert(testOutStruct["Bool"].get<bool>() == testIn.Struct.Bool, "testOut.Struct.Bool failed");
|
||||
oxAssert(testOutStruct["BString"].get<ox::String>() == testIn.Struct.BString.c_str(), "testOut.Struct.BString failed");
|
||||
oxAssert(testOut["unionIdx"].get<int>() == testIn.unionIdx, "testOut.unionIdx 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(testOut.at("unionIdx").unwrap()->get<int>() == testIn.unionIdx, "testOut.unionIdx failed");
|
||||
oxAssert(testOutUnion.unionIdx() == testIn.unionIdx, "testOut.Union idx wrong");
|
||||
oxAssert(testOutUnion["Int"].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[1].get<uint32_t>() == testIn.List[1], "testOut.Struct.List[1] failed");
|
||||
oxAssert(testOutStructCopy["Bool"].get<bool>() == testIn.Struct.Bool, "testOut.Struct.Bool (copy) failed");
|
||||
oxAssert(testOutStructCopy["BString"].get<ox::String>() == testIn.Struct.BString.c_str(), "testOut.Struct.BString (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(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");
|
||||
return OxError(0);
|
||||
|
2
deps/ox/src/ox/mc/types.hpp
vendored
2
deps/ox/src/ox/mc/types.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/mc/write.hpp
vendored
2
deps/ox/src/ox/mc/write.hpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
|
2
deps/ox/src/ox/model/def.hpp
vendored
2
deps/ox/src/ox/model/def.hpp
vendored
@ -13,5 +13,5 @@
|
||||
#define oxModelBegin(modelName) constexpr ox::Error model(auto *io, [[maybe_unused]] ox::CommonPtrWith<modelName> auto *o) noexcept { oxReturnError(io->template setTypeInfo<modelName>());
|
||||
#define oxModelEnd() return OxError(0); }
|
||||
#define oxModelField(fieldName) oxReturnError(io->field(#fieldName, &o->fieldName));
|
||||
#define oxModelFieldRename(serFieldName, objFieldName) oxReturnError(io->field(#serFieldName, &o->objFieldName));
|
||||
#define oxModelFieldRename(objFieldName, serFieldName) oxReturnError(io->field(#serFieldName, &o->objFieldName));
|
||||
#define oxModelFriend(modelName) friend constexpr ox::Error model(auto*, ox::CommonPtrWith<modelName> auto*) noexcept
|
||||
|
2
deps/ox/src/ox/model/descread.hpp
vendored
2
deps/ox/src/ox/model/descread.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/model/desctypes.cpp
vendored
2
deps/ox/src/ox/model/desctypes.cpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "desctypes.hpp"
|
||||
|
2
deps/ox/src/ox/model/descwrite.hpp
vendored
2
deps/ox/src/ox/model/descwrite.hpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
|
2
deps/ox/src/ox/model/fieldcounter.hpp
vendored
2
deps/ox/src/ox/model/fieldcounter.hpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
|
2
deps/ox/src/ox/model/metadata.hpp
vendored
2
deps/ox/src/ox/model/metadata.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
4
deps/ox/src/ox/model/modelhandleradaptor.hpp
vendored
4
deps/ox/src/ox/model/modelhandleradaptor.hpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@ -131,6 +131,8 @@ class ModelHandlerInterface {
|
||||
}
|
||||
case ModelValue::Type::Vector:
|
||||
return m_handler->field(name, &v->template get<ModelValueVector>());
|
||||
case ModelValue::Type::InlineArray:
|
||||
return m_handler->field(name, &v->template get<ModelValueArray>());
|
||||
}
|
||||
oxErrf("invalid type: {}: {}\n", name, static_cast<int>(v->type()));
|
||||
oxPanic(OxError(1), "invalid type");
|
||||
|
4
deps/ox/src/ox/model/modelops.hpp
vendored
4
deps/ox/src/ox/model/modelops.hpp
vendored
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
324
deps/ox/src/ox/model/modelvalue.hpp
vendored
324
deps/ox/src/ox/model/modelvalue.hpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@ -31,6 +31,7 @@ namespace ox {
|
||||
class ModelObject;
|
||||
class ModelUnion;
|
||||
class ModelValue;
|
||||
class ModelValueArray;
|
||||
class ModelValueVector;
|
||||
|
||||
class ModelValue {
|
||||
@ -50,6 +51,7 @@ class ModelValue {
|
||||
Object,
|
||||
Union,
|
||||
Vector,
|
||||
InlineArray,
|
||||
};
|
||||
|
||||
private:
|
||||
@ -68,6 +70,7 @@ class ModelValue {
|
||||
ModelObject *obj;
|
||||
ModelUnion *uni;
|
||||
ModelValueVector *vec;
|
||||
ModelValueArray *array;
|
||||
} m_data;
|
||||
|
||||
template<typename T>
|
||||
@ -101,6 +104,8 @@ class ModelValue {
|
||||
return Type::String;
|
||||
} else if constexpr(is_same_v<U, ModelValueVector>) {
|
||||
return Type::Vector;
|
||||
} else if constexpr(is_same_v<U, ModelValueArray>) {
|
||||
return Type::InlineArray;
|
||||
} else {
|
||||
return Type::Undefined;
|
||||
}
|
||||
@ -134,6 +139,8 @@ class ModelValue {
|
||||
return *t.m_data.obj;
|
||||
} else if constexpr(type == Type::Vector) {
|
||||
return *t.m_data.vec;
|
||||
} else if constexpr(type == Type::InlineArray) {
|
||||
return *t.m_data.array;
|
||||
} else {
|
||||
return t.m_data.i32;
|
||||
}
|
||||
@ -147,10 +154,12 @@ class ModelValue {
|
||||
constexpr ModelValue(ModelValue &&other) noexcept;
|
||||
|
||||
template<typename T>
|
||||
explicit constexpr ModelValue(const T &val) noexcept;
|
||||
explicit constexpr ModelValue(const T &val) noexcept
|
||||
requires(!ox::is_same_v<ox::remove_reference_t<T>, ModelValue>);
|
||||
|
||||
template<typename T>
|
||||
explicit constexpr ModelValue(T &&val) noexcept;
|
||||
explicit constexpr ModelValue(T &&val) noexcept
|
||||
requires(!ox::is_same_v<ox::remove_reference_t<T>, ModelValue>);
|
||||
|
||||
constexpr ~ModelValue() noexcept;
|
||||
|
||||
@ -177,7 +186,10 @@ class ModelValue {
|
||||
[[nodiscard]]
|
||||
constexpr Type type() const noexcept;
|
||||
|
||||
constexpr Error setType(const DescriptorType *type, int subscriptLevels = 0) noexcept;
|
||||
constexpr Error setType(
|
||||
DescriptorType const*type,
|
||||
int subscriptLevels = 0,
|
||||
SubscriptStack const& = {}) noexcept;
|
||||
|
||||
template<typename T>
|
||||
constexpr Error setType() noexcept;
|
||||
@ -199,11 +211,166 @@ class ModelValue {
|
||||
|
||||
};
|
||||
|
||||
class ModelValueArray {
|
||||
private:
|
||||
Vector<ModelValue> m_vec;
|
||||
const DescriptorType *m_type = nullptr;
|
||||
int m_typeSubscriptLevels = 0;
|
||||
SubscriptStack m_subscriptStack;
|
||||
String m_typeName;
|
||||
int m_typeVersion = 0;
|
||||
|
||||
public:
|
||||
constexpr explicit ModelValueArray() noexcept = default;
|
||||
|
||||
constexpr ModelValueArray(ModelValueArray const&other) noexcept {
|
||||
for (auto &v : other.m_vec) {
|
||||
m_vec.emplace_back(v);
|
||||
}
|
||||
m_typeName = other.m_typeName;
|
||||
m_typeVersion = other.m_typeVersion;
|
||||
}
|
||||
|
||||
constexpr ModelValueArray(ModelValueArray &&other) noexcept {
|
||||
m_vec = std::move(other.m_vec);
|
||||
m_typeName = std::move(other.m_typeName);
|
||||
m_typeVersion = other.m_typeVersion;
|
||||
}
|
||||
|
||||
constexpr ox::Error setSize(std::size_t sz) noexcept {
|
||||
const auto oldSz = m_vec.size();
|
||||
m_vec.resize(sz);
|
||||
if (sz > oldSz) {
|
||||
for (auto i = oldSz; i < sz; ++i) {
|
||||
oxReturnError(m_vec[i].setType(m_type, m_typeSubscriptLevels));
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr auto data() const noexcept {
|
||||
return m_vec.data();
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr auto data() noexcept {
|
||||
return m_vec.data();
|
||||
}
|
||||
|
||||
constexpr static ox::Result<ModelValueArray> make(size_t sz) noexcept {
|
||||
ox::Result<ModelValueArray> out;
|
||||
out.error = out.value.setSize(sz);
|
||||
return out;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr auto &get() noexcept {
|
||||
return m_vec;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr auto const&get() const noexcept {
|
||||
return m_vec;
|
||||
}
|
||||
|
||||
constexpr Error setType(
|
||||
DescriptorType const*type,
|
||||
int subscriptLevels,
|
||||
SubscriptStack subscriptStack) noexcept {
|
||||
m_type = type;
|
||||
m_typeSubscriptLevels = subscriptLevels;
|
||||
m_subscriptStack = std::move(subscriptStack);
|
||||
return {};
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr String const&typeName() const noexcept {
|
||||
return m_typeName;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr int typeVersion() const noexcept {
|
||||
return m_typeVersion;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr std::size_t size() const noexcept {
|
||||
return m_vec.size();
|
||||
}
|
||||
|
||||
constexpr auto &operator[](std::size_t i) noexcept {
|
||||
return m_vec[i];
|
||||
}
|
||||
|
||||
constexpr auto &operator[](std::size_t i) const noexcept {
|
||||
return m_vec[i];
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
auto begin() noexcept {
|
||||
return m_vec.begin();
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
auto begin() const noexcept {
|
||||
return m_vec.cbegin();
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
auto cbegin() const noexcept {
|
||||
return m_vec.cbegin();
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
auto rbegin() noexcept {
|
||||
return m_vec.rbegin();
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
auto crbegin() const noexcept {
|
||||
return m_vec.crbegin();
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
auto end() noexcept {
|
||||
return m_vec.end();
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
auto end() const noexcept {
|
||||
return m_vec.cend();
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
auto cend() const noexcept {
|
||||
return m_vec.cend();
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
auto rend() noexcept {
|
||||
return m_vec.rend();
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
auto crend() const noexcept {
|
||||
return m_vec.crend();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template<>
|
||||
[[nodiscard]]
|
||||
consteval bool isArray(ModelValueArray*) noexcept {
|
||||
return true;
|
||||
}
|
||||
|
||||
class ModelValueVector {
|
||||
private:
|
||||
Vector<ModelValue> m_vec;
|
||||
const DescriptorType *m_type = nullptr;
|
||||
int m_typeSubscriptLevels = 0;
|
||||
SubscriptStack m_subscriptStack;
|
||||
String m_typeName;
|
||||
int m_typeVersion = 0;
|
||||
|
||||
@ -233,7 +400,7 @@ class ModelValueVector {
|
||||
m_vec.resize(sz);
|
||||
if (sz > oldSz) {
|
||||
for (auto i = oldSz; i < sz; ++i) {
|
||||
oxReturnError(m_vec[i].setType(m_type, m_typeSubscriptLevels));
|
||||
oxReturnError(m_vec[i].setType(m_type, m_typeSubscriptLevels, m_subscriptStack));
|
||||
}
|
||||
}
|
||||
return {};
|
||||
@ -249,9 +416,13 @@ class ModelValueVector {
|
||||
return m_vec;
|
||||
}
|
||||
|
||||
constexpr Error setType(const DescriptorType *type, int subscriptLevels) noexcept {
|
||||
constexpr Error setType(
|
||||
DescriptorType const*type,
|
||||
int subscriptLevels,
|
||||
SubscriptStack subscriptStack) noexcept {
|
||||
m_type = type;
|
||||
m_typeSubscriptLevels = subscriptLevels;
|
||||
m_subscriptStack = std::move(subscriptStack);
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -334,7 +505,12 @@ consteval bool isVector(const ModelValueVector*) noexcept {
|
||||
return true;
|
||||
}
|
||||
|
||||
constexpr Error model(auto *h, CommonPtrWith<ModelObject> auto *obj) noexcept;
|
||||
constexpr Error model(auto *h, CommonPtrWith<ModelUnion> auto *obj) noexcept;
|
||||
|
||||
|
||||
class ModelObject {
|
||||
friend constexpr Error model(auto *h, CommonPtrWith<ModelObject> auto *obj) noexcept;
|
||||
public:
|
||||
struct Field {
|
||||
String name;
|
||||
@ -466,12 +642,9 @@ class ModelObject {
|
||||
return {};
|
||||
}
|
||||
|
||||
constexpr auto &operator[](StringView const&k) noexcept {
|
||||
auto [v, err] = m_fields.at(k);
|
||||
if (err) [[unlikely]] {
|
||||
oxPanic(err, ox::sfmt("field {} does not exist in type {}", k, buildTypeId(*m_type)).c_str());
|
||||
}
|
||||
return **v;
|
||||
constexpr ox::Result<ModelValue*> at(StringView const&k) noexcept {
|
||||
oxRequire(v, m_fields.at(k));
|
||||
return *v;
|
||||
}
|
||||
|
||||
constexpr auto &operator[](const std::size_t i) noexcept {
|
||||
@ -501,7 +674,7 @@ class ModelObject {
|
||||
for (const auto &f : type->fieldList) {
|
||||
auto field = make_unique<Field>();
|
||||
field->name = f.fieldName;
|
||||
oxReturnError(field->value.setType(f.type, f.subscriptLevels));
|
||||
oxReturnError(field->value.setType(f.type, f.subscriptLevels, f.subscriptStack));
|
||||
m_fields[field->name] = &field->value;
|
||||
m_fieldsOrder.emplace_back(std::move(field));
|
||||
}
|
||||
@ -517,7 +690,7 @@ class ModelUnion {
|
||||
String name;
|
||||
ModelValue value;
|
||||
};
|
||||
oxModelFriend(ModelUnion);
|
||||
friend constexpr Error model(auto *h, CommonPtrWith<ModelUnion> auto *obj) noexcept;
|
||||
friend ModelValue;
|
||||
Vector<UniquePtr<Field>> m_fieldsOrder;
|
||||
HashMap<String, Field*> m_fields;
|
||||
@ -555,12 +728,9 @@ class ModelUnion {
|
||||
return UniquePtr<ModelUnion>(new ModelUnion(other));
|
||||
}
|
||||
|
||||
constexpr auto &operator[](StringView const&k) noexcept {
|
||||
const auto [v, err] = m_fields.at(k);
|
||||
if (err) [[unlikely]] {
|
||||
oxPanic(err, ox::sfmt("field {} does not exist in type {}", k, buildTypeId(*m_type)).c_str());
|
||||
}
|
||||
return (*v)->value;
|
||||
constexpr ox::Result<ModelValue*> at(StringView const&k) noexcept {
|
||||
oxRequire(v, m_fields.at(k));
|
||||
return &(*v)->value;
|
||||
}
|
||||
|
||||
constexpr auto &operator[](const std::size_t i) noexcept {
|
||||
@ -647,6 +817,12 @@ class ModelUnion {
|
||||
|
||||
};
|
||||
|
||||
template<typename PlatSpec>
|
||||
[[nodiscard]]
|
||||
constexpr std::size_t sizeOf(ModelValueArray const*v) noexcept {
|
||||
return sizeOf<PlatSpec>(&(*v)[0]) * v->size();
|
||||
}
|
||||
|
||||
template<typename PlatSpec>
|
||||
[[nodiscard]]
|
||||
constexpr std::size_t sizeOf(const ModelValueVector*) noexcept {
|
||||
@ -708,10 +884,22 @@ constexpr std::size_t sizeOf(const ModelValue *t) noexcept {
|
||||
case ModelValue::Type::Vector:
|
||||
size = sizeOf<PlatSpec>(&t->get<ox::ModelValueVector>());
|
||||
break;
|
||||
case ModelValue::Type::InlineArray:
|
||||
{
|
||||
auto &list = t->get<ox::ModelValueArray>();
|
||||
size = sizeOf<PlatSpec>(&list[0]) * list.size();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
template<typename PlatSpec>
|
||||
[[nodiscard]]
|
||||
constexpr std::size_t alignOf(ModelValueArray const&v) noexcept {
|
||||
return alignOf<PlatSpec>(v[0]);
|
||||
}
|
||||
|
||||
template<typename PlatSpec>
|
||||
[[nodiscard]]
|
||||
constexpr std::size_t alignOf(const ModelValueVector&) noexcept {
|
||||
@ -722,56 +910,63 @@ constexpr std::size_t alignOf(const ModelValueVector&) noexcept {
|
||||
template<typename PlatSpec>
|
||||
[[nodiscard]]
|
||||
constexpr std::size_t alignOf(const ModelValue &t) noexcept {
|
||||
std::size_t size = 0;
|
||||
std::size_t alignment = 0;
|
||||
switch (t.type()) {
|
||||
case ModelValue::Type::Bool:
|
||||
size = PlatSpec::alignOf(t.get<bool>());
|
||||
alignment = PlatSpec::alignOf(t.get<bool>());
|
||||
break;
|
||||
case ModelValue::Type::Undefined:
|
||||
size = 1;
|
||||
alignment = 1;
|
||||
break;
|
||||
case ModelValue::Type::UnsignedInteger8:
|
||||
size = PlatSpec::alignOf(t.get<uint8_t>());
|
||||
alignment = PlatSpec::alignOf(t.get<uint8_t>());
|
||||
break;
|
||||
case ModelValue::Type::UnsignedInteger16:
|
||||
size = PlatSpec::alignOf(t.get<uint16_t>());
|
||||
alignment = PlatSpec::alignOf(t.get<uint16_t>());
|
||||
break;
|
||||
case ModelValue::Type::UnsignedInteger32:
|
||||
size = PlatSpec::alignOf(t.get<uint32_t>());
|
||||
alignment = PlatSpec::alignOf(t.get<uint32_t>());
|
||||
break;
|
||||
case ModelValue::Type::UnsignedInteger64:
|
||||
size = PlatSpec::alignOf(t.get<uint64_t>());
|
||||
alignment = PlatSpec::alignOf(t.get<uint64_t>());
|
||||
break;
|
||||
case ModelValue::Type::SignedInteger8:
|
||||
size = PlatSpec::alignOf(t.get<int8_t>());
|
||||
alignment = PlatSpec::alignOf(t.get<int8_t>());
|
||||
break;
|
||||
case ModelValue::Type::SignedInteger16:
|
||||
size = PlatSpec::alignOf(t.get<int16_t>());
|
||||
alignment = PlatSpec::alignOf(t.get<int16_t>());
|
||||
break;
|
||||
case ModelValue::Type::SignedInteger32:
|
||||
size = PlatSpec::alignOf(t.get<int32_t>());
|
||||
alignment = PlatSpec::alignOf(t.get<int32_t>());
|
||||
break;
|
||||
case ModelValue::Type::SignedInteger64:
|
||||
size = PlatSpec::alignOf(t.get<int64_t>());
|
||||
alignment = PlatSpec::alignOf(t.get<int64_t>());
|
||||
break;
|
||||
case ModelValue::Type::String:
|
||||
size = PlatSpec::alignOf(t.get<ox::String>());
|
||||
alignment = alignOf<PlatSpec>(t.get<ox::String>());
|
||||
break;
|
||||
case ModelValue::Type::Object:
|
||||
size = alignOf<PlatSpec>(t.get<ox::ModelObject>());
|
||||
alignment = alignOf<PlatSpec>(t.get<ox::ModelObject>());
|
||||
break;
|
||||
case ModelValue::Type::Union:
|
||||
size = alignOf<PlatSpec>(t.get<ox::ModelUnion>());
|
||||
alignment = alignOf<PlatSpec>(t.get<ox::ModelUnion>());
|
||||
break;
|
||||
case ModelValue::Type::Vector:
|
||||
size = alignOf<PlatSpec>(t.get<ox::ModelValueVector>());
|
||||
alignment = alignOf<PlatSpec>(t.get<ox::ModelValueVector>());
|
||||
break;
|
||||
case ModelValue::Type::InlineArray:
|
||||
{
|
||||
auto &list = t.get<ox::ModelValueArray>();
|
||||
alignment = alignOf<PlatSpec>(list[0]);
|
||||
break;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
return alignment;
|
||||
}
|
||||
|
||||
constexpr Error model(auto *h, CommonPtrWith<ModelObject> auto *obj) noexcept {
|
||||
oxReturnError(h->template setTypeInfo<ModelObject>(obj->typeName().c_str(), obj->typeVersion(), {}, obj->m_fieldsOrder.size()));
|
||||
oxReturnError(h->template setTypeInfo<ModelObject>(
|
||||
obj->typeName().c_str(), obj->typeVersion(), {}, obj->m_fieldsOrder.size()));
|
||||
for (auto &f : obj->m_fieldsOrder) {
|
||||
oxReturnError(h->field(f->name.c_str(), &f->value));
|
||||
}
|
||||
@ -779,7 +974,8 @@ constexpr Error model(auto *h, CommonPtrWith<ModelObject> auto *obj) noexcept {
|
||||
}
|
||||
|
||||
constexpr Error model(auto *h, CommonPtrWith<ModelUnion> auto *obj) noexcept {
|
||||
oxReturnError(h->template setTypeInfo<ModelUnion>(obj->typeName().c_str(), obj->typeVersion(), {}, obj->m_fieldsOrder.size()));
|
||||
oxReturnError(h->template setTypeInfo<ModelUnion>(
|
||||
obj->typeName().c_str(), obj->typeVersion(), {}, obj->m_fieldsOrder.size()));
|
||||
for (auto &f : obj->m_fieldsOrder) {
|
||||
oxReturnError(h->field(f->name.c_str(), &f->value));
|
||||
}
|
||||
@ -813,6 +1009,9 @@ constexpr ModelValue::ModelValue(const ModelValue &other) noexcept {
|
||||
case Type::Vector:
|
||||
m_data.vec = new ModelValueVector(*other.m_data.vec);
|
||||
break;
|
||||
case Type::InlineArray:
|
||||
m_data.array = new ModelValueArray(*other.m_data.array);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -848,17 +1047,23 @@ constexpr ModelValue::ModelValue(ModelValue &&other) noexcept {
|
||||
m_data.vec = other.m_data.vec;
|
||||
other.m_data.vec = new ModelValueVector;
|
||||
break;
|
||||
case Type::InlineArray:
|
||||
m_data.array = other.m_data.array;
|
||||
other.m_data.array = new ModelValueArray();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr ModelValue::ModelValue(const T &val) noexcept {
|
||||
set(val);
|
||||
constexpr ModelValue::ModelValue(const T &val) noexcept
|
||||
requires(!ox::is_same_v<ox::remove_reference_t<T>, ModelValue>) {
|
||||
oxIgnoreError(set(val));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr ModelValue::ModelValue(T &&val) noexcept {
|
||||
set(ox::forward(val));
|
||||
constexpr ModelValue::ModelValue(T &&val) noexcept
|
||||
requires(!ox::is_same_v<ox::remove_reference_t<T>, ModelValue>) {
|
||||
oxIgnoreError(set(ox::forward<T>(val)));
|
||||
}
|
||||
|
||||
constexpr ModelValue::~ModelValue() noexcept {
|
||||
@ -869,12 +1074,24 @@ constexpr ModelValue::Type ModelValue::type() const noexcept {
|
||||
return m_type;
|
||||
}
|
||||
|
||||
constexpr Error ModelValue::setType(const DescriptorType *type, int subscriptLevels) noexcept {
|
||||
constexpr Error ModelValue::setType(
|
||||
const DescriptorType *type,
|
||||
int subscriptLevels,
|
||||
SubscriptStack const&subscriptStack) noexcept {
|
||||
freeResources();
|
||||
if (subscriptLevels) {
|
||||
auto const&subscript = subscriptStack[subscriptStack.size() - static_cast<size_t>(subscriptLevels)];
|
||||
if (subscript.subscriptType == Subscript::SubscriptType::InlineArray) {
|
||||
m_type = Type::InlineArray;
|
||||
m_data.array = new ModelValueArray;
|
||||
oxReturnError(m_data.array->setType(type, subscriptLevels - 1, subscriptStack));
|
||||
oxReturnError(m_data.array->setSize(static_cast<size_t>(subscript.length)));
|
||||
} else {
|
||||
m_type = Type::Vector;
|
||||
m_data.vec = new ModelValueVector;
|
||||
return m_data.vec->setType(type, subscriptLevels - 1);
|
||||
oxReturnError(m_data.vec->setType(type, subscriptLevels - 1, subscriptStack));
|
||||
}
|
||||
return {};
|
||||
} else if (type->typeName == types::Bool) {
|
||||
m_type = Type::Bool;
|
||||
} else if (type->typeName == types::BasicString ||
|
||||
@ -917,7 +1134,8 @@ constexpr Error ModelValue::setType() noexcept {
|
||||
constexpr auto type = getType<T>();
|
||||
freeResources();
|
||||
m_type = type;
|
||||
// 2022.09.04: Clang retardedly requires initializing the union values directly, rather than using getValue<type>()
|
||||
// 2022.09.04: Clang retardedly requires initializing the union values directly,
|
||||
// rather than using getValue<type>()
|
||||
if constexpr(type == Type::Object) {
|
||||
m_data.obj = new ModelObject;
|
||||
oxReturnError(m_data.obj->setType(type));
|
||||
@ -959,7 +1177,7 @@ constexpr Error ModelValue::set(const T &v) noexcept {
|
||||
}
|
||||
auto &value = getValue<type>(*this);
|
||||
if constexpr(type == Type::Vector || type == Type::Object ||
|
||||
type == Type::Union || type == Type::String) {
|
||||
type == Type::Union || type == Type::String || type == Type::InlineArray) {
|
||||
safeDelete(&value);
|
||||
}
|
||||
value = v;
|
||||
@ -974,10 +1192,10 @@ constexpr Error ModelValue::set(T &&v) noexcept {
|
||||
}
|
||||
auto &value = getValue<type>(*this);
|
||||
if constexpr(type == Type::Vector || type == Type::Object ||
|
||||
type == Type::Union || type == Type::String) {
|
||||
type == Type::Union || type == Type::String || type == Type::InlineArray) {
|
||||
safeDelete(&value);
|
||||
}
|
||||
value = ox::forward<T>(v);
|
||||
value = std::move(v);
|
||||
return OxError(0);
|
||||
}
|
||||
|
||||
@ -1016,6 +1234,9 @@ constexpr ModelValue &ModelValue::operator=(const ModelValue &other) noexcept {
|
||||
case Type::Vector:
|
||||
m_data.vec = new ModelValueVector(*other.m_data.vec);
|
||||
break;
|
||||
case Type::InlineArray:
|
||||
m_data.array = new ModelValueArray(*other.m_data.array);
|
||||
break;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@ -1056,6 +1277,10 @@ constexpr ModelValue &ModelValue::operator=(ModelValue &&other) noexcept {
|
||||
m_data.vec = other.m_data.vec;
|
||||
other.m_data.vec = new ModelValueVector;
|
||||
break;
|
||||
case Type::InlineArray:
|
||||
m_data.array = other.m_data.array;
|
||||
other.m_data.array = new ModelValueArray;
|
||||
break;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@ -1085,6 +1310,9 @@ constexpr void ModelValue::freeResources() noexcept {
|
||||
case Type::Vector:
|
||||
safeDelete(m_data.vec);
|
||||
break;
|
||||
case Type::InlineArray:
|
||||
safeDelete(m_data.array);
|
||||
break;
|
||||
}
|
||||
m_type = Type::Undefined;
|
||||
}
|
||||
|
2
deps/ox/src/ox/model/test/tests.cpp
vendored
2
deps/ox/src/ox/model/test/tests.cpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
|
2
deps/ox/src/ox/model/typenamecatcher.hpp
vendored
2
deps/ox/src/ox/model/typenamecatcher.hpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
|
19
deps/ox/src/ox/model/types.hpp
vendored
19
deps/ox/src/ox/model/types.hpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@ -131,7 +131,12 @@ template<typename T, std::size_t sz>
|
||||
constexpr bool isBareArray_v<T[sz]> = true;
|
||||
|
||||
template<typename T>
|
||||
constexpr bool isArray_v = false;
|
||||
consteval bool isArray(T*) noexcept {
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr bool isArray_v = isArray(static_cast<T*>(nullptr));
|
||||
|
||||
template<typename T>
|
||||
constexpr bool isArray_v<T[]> = true;
|
||||
@ -142,6 +147,16 @@ constexpr bool isArray_v<T[sz]> = true;
|
||||
template<typename T, std::size_t sz>
|
||||
constexpr bool isArray_v<Array<T, sz>> = true;
|
||||
|
||||
template<typename T, std::size_t sz>
|
||||
consteval bool isArray(T[sz]) noexcept {
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T, std::size_t sz>
|
||||
consteval bool isArray(Array<T, sz>) noexcept {
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr bool isSmartPtr_v = false;
|
||||
|
||||
|
4
deps/ox/src/ox/model/walk.hpp
vendored
4
deps/ox/src/ox/model/walk.hpp
vendored
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/oc/oc.hpp
vendored
2
deps/ox/src/ox/oc/oc.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/oc/read.hpp
vendored
2
deps/ox/src/ox/oc/read.hpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
|
2
deps/ox/src/ox/oc/test/tests.cpp
vendored
2
deps/ox/src/ox/oc/test/tests.cpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
|
6
deps/ox/src/ox/oc/write.hpp
vendored
6
deps/ox/src/ox/oc/write.hpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@ -27,7 +27,7 @@ class OrganicClawWriter {
|
||||
friend Result<Buffer> writeOC(const auto &val) noexcept;
|
||||
|
||||
protected:
|
||||
Json::Value m_json;
|
||||
Json::Value m_json{Json::Value(Json::objectValue)};
|
||||
Json::ArrayIndex m_fieldIt = 0;
|
||||
int m_unionIdx = -1;
|
||||
|
||||
@ -215,7 +215,7 @@ Error OrganicClawWriter::field(const char *key, const T *val) noexcept {
|
||||
OrganicClawWriter w;
|
||||
ModelHandlerInterface<OrganicClawWriter, OpType::Write> handler{&w};
|
||||
oxReturnError(model(&handler, val));
|
||||
if (!w.m_json.isNull()) {
|
||||
if (!w.m_json.empty() || m_json.isArray()) {
|
||||
value(key) = w.m_json;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
/*
|
||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
9
deps/ox/src/ox/preloader/platspecs.hpp
vendored
9
deps/ox/src/ox/preloader/platspecs.hpp
vendored
@ -1,10 +1,15 @@
|
||||
/*
|
||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ox/std/serialize.hpp>
|
||||
#include <ox/std/string.hpp>
|
||||
#include <ox/std/typetraits.hpp>
|
||||
|
||||
#include "alignmentcatcher.hpp"
|
||||
@ -47,7 +52,7 @@ constexpr std::size_t alignOf(const T &v) noexcept {
|
||||
typename PlatSpec::PtrType p = 0;
|
||||
return PlatSpec::alignOf(p);
|
||||
} else {
|
||||
AlignmentCatcher<NativePlatSpec> c;
|
||||
AlignmentCatcher<PlatSpec> c;
|
||||
oxAssert(model(c.interface(), &v), "Could not get alignment for type");
|
||||
return c.biggestAlignment;
|
||||
}
|
||||
|
6
deps/ox/src/ox/preloader/preloader.cpp
vendored
6
deps/ox/src/ox/preloader/preloader.cpp
vendored
@ -1,5 +1,9 @@
|
||||
/*
|
||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "preloader.hpp"
|
||||
|
82
deps/ox/src/ox/preloader/preloader.hpp
vendored
82
deps/ox/src/ox/preloader/preloader.hpp
vendored
@ -1,5 +1,9 @@
|
||||
/*
|
||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@ -10,10 +14,12 @@
|
||||
#include <ox/std/error.hpp>
|
||||
#include <ox/std/memops.hpp>
|
||||
#include <ox/std/memory.hpp>
|
||||
#include <ox/std/string.hpp>
|
||||
#include <ox/std/types.hpp>
|
||||
#include <ox/std/typetraits.hpp>
|
||||
#include <ox/std/units.hpp>
|
||||
#include <ox/model/modelhandleradaptor.hpp>
|
||||
#include <ox/model/modelvalue.hpp>
|
||||
|
||||
#include "platspecs.hpp"
|
||||
|
||||
@ -58,6 +64,7 @@ class Preloader: public ModelHandlerBase<Preloader<PlatSpec>, OpType::Reflect> {
|
||||
restore(pRestore), seekdir(pSeekdir) {}
|
||||
};
|
||||
ox::Vector<AllocStackItem, 8> m_allocStack;
|
||||
ox::Vector<size_t> m_allocStart{};
|
||||
|
||||
constexpr Preloader() noexcept: m_writer(&m_buff) {}
|
||||
|
||||
@ -101,9 +108,9 @@ class Preloader: public ModelHandlerBase<Preloader<PlatSpec>, OpType::Reflect> {
|
||||
template<typename T>
|
||||
constexpr ox::Error field(CRStringView, const T **val, std::size_t cnt) noexcept;
|
||||
|
||||
constexpr ox::Result<std::size_t> startAlloc(std::size_t sz) noexcept;
|
||||
constexpr ox::Result<std::size_t> startAlloc(size_t sz, size_t align) noexcept;
|
||||
|
||||
constexpr ox::Result<std::size_t> startAlloc(std::size_t sz, std::size_t restore) noexcept;
|
||||
constexpr ox::Result<std::size_t> startAlloc(size_t sz, size_t align, std::size_t restore) noexcept;
|
||||
|
||||
constexpr ox::Error endAlloc() noexcept;
|
||||
|
||||
@ -125,6 +132,8 @@ class Preloader: public ModelHandlerBase<Preloader<PlatSpec>, OpType::Reflect> {
|
||||
|
||||
constexpr ox::Error fieldVector(CRStringView, const auto *val, ox::VectorMemMap<PlatSpec> vecVal) noexcept;
|
||||
|
||||
constexpr ox::Error fieldArray(CRStringView name, ox::ModelValueArray const*val) noexcept;
|
||||
|
||||
constexpr bool unionCheckAndIt() noexcept;
|
||||
};
|
||||
|
||||
@ -165,15 +174,19 @@ constexpr ox::Error Preloader<PlatSpec>::field(CRStringView name, const T *val)
|
||||
}
|
||||
oxReturnError(pad(val));
|
||||
if constexpr(ox::is_integral_v<T>) {
|
||||
//oxDebugf("Preloader::field(name, val): {}", name);
|
||||
return ox::serialize(&m_writer, PlatSpec::correctEndianness(*val));
|
||||
return ox::serialize(m_writer, PlatSpec::correctEndianness(*val));
|
||||
} else if constexpr(ox::is_pointer_v<T>) {
|
||||
const PtrType a = startAlloc(sizeOf<PlatSpec>(*val), m_writer.tellp()) + PlatSpec::RomStart;
|
||||
const PtrType a = startAlloc(sizeOf<PlatSpec>(val), alignOf<PlatSpec>(*val), m_writer.tellp()) + PlatSpec::RomStart;
|
||||
oxReturnError(field(name, *val));
|
||||
oxReturnError(endAlloc());
|
||||
return ox::serialize(&m_writer, PlatSpec::correctEndianness(a));
|
||||
} else if constexpr(ox::isVector_v<T> || ox::is_same_v<T, ox::ModelValueVector>) {
|
||||
return ox::serialize(m_writer, PlatSpec::correctEndianness(a));
|
||||
} else if constexpr(ox::isVector_v<T>) {
|
||||
return fieldVector(name, val);
|
||||
} else if constexpr(ox::is_same_v<T, ox::ModelValueVector>) {
|
||||
val->types();
|
||||
return fieldVector(name, val);
|
||||
} else if constexpr(ox::is_same_v<T, ox::ModelValueArray>) {
|
||||
return fieldArray(name, val);
|
||||
} else {
|
||||
m_unionIdx.emplace_back(-1);
|
||||
const auto out = preload<PlatSpec, T>(this, val);
|
||||
@ -199,7 +212,7 @@ constexpr ox::Error Preloader<PlatSpec>::field(CRStringView, const ox::BasicStri
|
||||
const auto restore = m_writer.tellp();
|
||||
std::size_t a = 0;
|
||||
if (sz && sz >= SmallStringSize) {
|
||||
oxReturnError(ox::allocate(&m_writer, sz).moveTo(a));
|
||||
oxReturnError(ox::allocate(m_writer, sz).moveTo(a));
|
||||
} else {
|
||||
a = restore;
|
||||
}
|
||||
@ -207,7 +220,7 @@ constexpr ox::Error Preloader<PlatSpec>::field(CRStringView, const ox::BasicStri
|
||||
oxReturnError(m_writer.seekp(a));
|
||||
oxReturnError(m_writer.write(val->data(), sz));
|
||||
oxReturnError(m_writer.seekp(restore));
|
||||
oxReturnError(serialize(&m_writer, vecVal));
|
||||
oxReturnError(serialize(m_writer, vecVal));
|
||||
m_ptrs.emplace_back(restore + offsetof(VecMap, items), vecVal.items);
|
||||
return {};
|
||||
}
|
||||
@ -218,6 +231,7 @@ constexpr ox::Error Preloader<PlatSpec>::field(CRStringView name, const ox::Arra
|
||||
if (!unionCheckAndIt()) {
|
||||
return {};
|
||||
}
|
||||
oxReturnError(pad(&(*val)[0]));
|
||||
// serialize the Array elements
|
||||
if constexpr(sz) {
|
||||
m_unionIdx.emplace_back(-1);
|
||||
@ -235,28 +249,40 @@ constexpr ox::Error Preloader<PlatSpec>::field(CRStringView, const T **val, std:
|
||||
if (!unionCheckAndIt()) {
|
||||
return {};
|
||||
}
|
||||
if (cnt) {
|
||||
oxReturnError(pad(*val));
|
||||
// serialize the array
|
||||
m_unionIdx.emplace_back(-1);
|
||||
for (std::size_t i = 0; i < cnt; ++i) {
|
||||
oxReturnError(this->interface()->field(nullptr, &val[i]));
|
||||
}
|
||||
m_unionIdx.pop_back();
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
template<typename PlatSpec>
|
||||
constexpr ox::Result<std::size_t> Preloader<PlatSpec>::startAlloc(std::size_t sz) noexcept {
|
||||
oxRequire(a, ox::allocate(&m_writer, sz));
|
||||
constexpr ox::Result<std::size_t> Preloader<PlatSpec>::startAlloc(size_t sz, size_t align) noexcept {
|
||||
m_allocStack.emplace_back(static_cast<typename PlatSpec::PtrType>(m_writer.tellp()));
|
||||
oxReturnError(m_writer.seekp(0, ox::ios_base::end));
|
||||
const auto padding = m_writer.tellp() % align;
|
||||
oxRequireM(a, ox::allocate(m_writer, sz + padding));
|
||||
a += padding;
|
||||
oxReturnError(m_writer.seekp(a));
|
||||
m_allocStart.push_back(a);
|
||||
return a;
|
||||
}
|
||||
|
||||
template<typename PlatSpec>
|
||||
constexpr ox::Result<std::size_t> Preloader<PlatSpec>::startAlloc(std::size_t sz, std::size_t restore) noexcept {
|
||||
oxRequire(a, ox::allocate(&m_writer, sz));
|
||||
constexpr ox::Result<std::size_t> Preloader<PlatSpec>::startAlloc(
|
||||
std::size_t sz, size_t align, std::size_t restore) noexcept {
|
||||
m_allocStack.emplace_back(restore, ox::ios_base::beg);
|
||||
oxReturnError(m_writer.seekp(0, ox::ios_base::end));
|
||||
const auto padding = m_writer.tellp() % align;
|
||||
oxRequireM(a, ox::allocate(m_writer, sz + padding));
|
||||
a += padding;
|
||||
oxReturnError(m_writer.seekp(a));
|
||||
m_allocStart.push_back(a);
|
||||
return a;
|
||||
}
|
||||
|
||||
@ -268,6 +294,7 @@ constexpr ox::Error Preloader<PlatSpec>::endAlloc() noexcept {
|
||||
const auto &si = *m_allocStack.back().unwrap();
|
||||
oxReturnError(m_writer.seekp(static_cast<ox::ssize_t>(si.restore), si.seekdir));
|
||||
m_allocStack.pop_back();
|
||||
m_allocStart.pop_back();
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -275,8 +302,9 @@ template<typename PlatSpec>
|
||||
constexpr ox::Error Preloader<PlatSpec>::offsetPtrs(std::size_t offset) noexcept {
|
||||
for (const auto &p : m_ptrs) {
|
||||
oxReturnError(m_writer.seekp(p.loc));
|
||||
const auto val = PlatSpec::template correctEndianness<typename PlatSpec::PtrType>(static_cast<typename PlatSpec::PtrType>(p.value + offset));
|
||||
oxReturnError(ox::serialize(&m_writer, val));
|
||||
const auto val = PlatSpec::template correctEndianness<typename PlatSpec::PtrType>(
|
||||
static_cast<typename PlatSpec::PtrType>(p.value + offset));
|
||||
oxReturnError(ox::serialize(m_writer, val));
|
||||
}
|
||||
oxReturnError(m_writer.seekp(0, ox::ios_base::end));
|
||||
return {};
|
||||
@ -295,7 +323,8 @@ constexpr ox::Error Preloader<PlatSpec>::pad(const T *v) noexcept {
|
||||
}
|
||||
|
||||
template<typename PlatSpec>
|
||||
constexpr ox::Error Preloader<PlatSpec>::fieldVector(CRStringView name, const ox::ModelValueVector *val) noexcept {
|
||||
constexpr ox::Error Preloader<PlatSpec>::fieldVector(
|
||||
CRStringView name, const ox::ModelValueVector *val) noexcept {
|
||||
// serialize the Vector
|
||||
ox::VectorMemMap<PlatSpec> vecVal{
|
||||
.size = PlatSpec::correctEndianness(static_cast<typename PlatSpec::size_t>(val->size())),
|
||||
@ -327,7 +356,11 @@ constexpr ox::Error Preloader<PlatSpec>::fieldVector(
|
||||
// serialize the Vector elements
|
||||
if (val->size()) {
|
||||
const auto sz = sizeOf<PlatSpec>(&(*val)[0]) * val->size();
|
||||
oxRequire(p, ox::allocate(&m_writer, sz));
|
||||
const auto align = alignOf<PlatSpec>((*val)[0]);
|
||||
oxReturnError(m_writer.seekp(0, ox::ios_base::end));
|
||||
const auto padding = m_writer.tellp() % align;
|
||||
oxRequireM(p, ox::allocate(m_writer, sz + padding));
|
||||
p += padding;
|
||||
oxReturnError(m_writer.seekp(p));
|
||||
m_unionIdx.emplace_back(-1);
|
||||
for (std::size_t i = 0; i < val->size(); ++i) {
|
||||
@ -341,11 +374,22 @@ constexpr ox::Error Preloader<PlatSpec>::fieldVector(
|
||||
vecVal.items = 0;
|
||||
}
|
||||
// serialize the Vector
|
||||
oxReturnError(serialize(&m_writer, vecVal));
|
||||
oxReturnError(serialize(m_writer, vecVal));
|
||||
m_ptrs.emplace_back(m_writer.tellp() - PtrSize, vecVal.items);
|
||||
return {};
|
||||
}
|
||||
|
||||
template<typename PlatSpec>
|
||||
constexpr ox::Error Preloader<PlatSpec>::fieldArray(CRStringView, ox::ModelValueArray const*val) noexcept {
|
||||
oxDebugf("array size: {}", val->size());
|
||||
oxDebugf("array sizeOf: {}", sizeOf<PlatSpec>(val));
|
||||
oxReturnError(pad(&(*val)[0]));
|
||||
for (auto const&v : *val) {
|
||||
oxReturnError(this->interface()->field({}, &v));
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
template<typename PlatSpec>
|
||||
constexpr bool Preloader<PlatSpec>::unionCheckAndIt() noexcept {
|
||||
auto &u = *m_unionIdx.back().unwrap();
|
||||
|
6
deps/ox/src/ox/preloader/sizecatcher.hpp
vendored
6
deps/ox/src/ox/preloader/sizecatcher.hpp
vendored
@ -1,5 +1,9 @@
|
||||
/*
|
||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -1,5 +1,9 @@
|
||||
/*
|
||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/std/algorithm.hpp
vendored
2
deps/ox/src/ox/std/algorithm.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
4
deps/ox/src/ox/std/array.hpp
vendored
4
deps/ox/src/ox/std/array.hpp
vendored
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/std/assert.cpp
vendored
2
deps/ox/src/ox/std/assert.cpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "stacktrace.hpp"
|
||||
|
2
deps/ox/src/ox/std/assert.hpp
vendored
2
deps/ox/src/ox/std/assert.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/std/basestringview.hpp
vendored
2
deps/ox/src/ox/std/basestringview.hpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
|
2
deps/ox/src/ox/std/bit.cpp
vendored
2
deps/ox/src/ox/std/bit.cpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "bit.hpp"
|
||||
|
4
deps/ox/src/ox/std/bit.hpp
vendored
4
deps/ox/src/ox/std/bit.hpp
vendored
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
4
deps/ox/src/ox/std/bounds.hpp
vendored
4
deps/ox/src/ox/std/bounds.hpp
vendored
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/std/bstring.hpp
vendored
2
deps/ox/src/ox/std/bstring.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/std/buffer.cpp
vendored
2
deps/ox/src/ox/std/buffer.cpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "error.hpp"
|
||||
|
4
deps/ox/src/ox/std/buffer.hpp
vendored
4
deps/ox/src/ox/std/buffer.hpp
vendored
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/std/buildinfo.cpp
vendored
2
deps/ox/src/ox/std/buildinfo.cpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
namespace ox::buildinfo {
|
||||
|
2
deps/ox/src/ox/std/buildinfo.hpp
vendored
2
deps/ox/src/ox/std/buildinfo.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
namespace ox::buildinfo {
|
||||
|
2
deps/ox/src/ox/std/byteswap.cpp
vendored
2
deps/ox/src/ox/std/byteswap.cpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "byteswap.hpp"
|
||||
|
4
deps/ox/src/ox/std/byteswap.hpp
vendored
4
deps/ox/src/ox/std/byteswap.hpp
vendored
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/std/cstringview.hpp
vendored
2
deps/ox/src/ox/std/cstringview.hpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
|
2
deps/ox/src/ox/std/cstrops.hpp
vendored
2
deps/ox/src/ox/std/cstrops.hpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
|
4
deps/ox/src/ox/std/def.hpp
vendored
4
deps/ox/src/ox/std/def.hpp
vendored
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/std/defer.hpp
vendored
2
deps/ox/src/ox/std/defer.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/std/defines.hpp
vendored
2
deps/ox/src/ox/std/defines.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/std/error.hpp
vendored
2
deps/ox/src/ox/std/error.hpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
|
2
deps/ox/src/ox/std/fmt.cpp
vendored
2
deps/ox/src/ox/std/fmt.cpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "fmt.hpp"
|
||||
|
2
deps/ox/src/ox/std/fmt.hpp
vendored
2
deps/ox/src/ox/std/fmt.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/std/hardware.hpp
vendored
2
deps/ox/src/ox/std/hardware.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/std/hashmap.hpp
vendored
2
deps/ox/src/ox/std/hashmap.hpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
|
2
deps/ox/src/ox/std/heapmgr.cpp
vendored
2
deps/ox/src/ox/std/heapmgr.cpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "assert.hpp"
|
||||
|
2
deps/ox/src/ox/std/heapmgr.hpp
vendored
2
deps/ox/src/ox/std/heapmgr.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "types.hpp"
|
||||
|
2
deps/ox/src/ox/std/initializerlist.hpp
vendored
2
deps/ox/src/ox/std/initializerlist.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
4
deps/ox/src/ox/std/iterator.hpp
vendored
4
deps/ox/src/ox/std/iterator.hpp
vendored
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2015 - 2023 gary@drinkingtea.net
|
||||
* Copyright 2015 - 2022 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
2
deps/ox/src/ox/std/math.cpp
vendored
2
deps/ox/src/ox/std/math.cpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "math.hpp"
|
||||
|
2
deps/ox/src/ox/std/math.hpp
vendored
2
deps/ox/src/ox/std/math.hpp
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user