[0.3.2000] - Big file restructure
This commit is contained in:
parent
1b09fc172f
commit
a110b0912f
73 changed files with 1355 additions and 1639 deletions
|
|
@ -2,7 +2,7 @@
|
|||
#-----------------------------------------------------------------------------------------
|
||||
set(PROJ_NAME omnia-framework)
|
||||
set(MAJOR_VER 0)
|
||||
set(MINOR_VER 2)
|
||||
set(MINOR_VER 3)
|
||||
#-----------------------------------------------------------------------------------------
|
||||
|
||||
#Setup
|
||||
|
|
@ -42,33 +42,41 @@ list(APPEND OSTD_SOURCE_FILES
|
|||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/vendor/midifile/MidiMessage.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/vendor/midifile/Options.cpp
|
||||
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/BaseObject.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/Color.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/Console.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/Errors.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/File.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/FileSystem.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/Geometry.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/Json.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/Keyboard.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/Logger.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/Logic.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/md5.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/Midi.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/OutputHandlers.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/PathFinder.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/QuadTree.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/ShuntingYard.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/Signals.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/Random.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/Serial.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/SineWave.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/Spline.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/StringEditor.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/String.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/TextStyleParser.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/Time.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/Utils.cpp
|
||||
# data_types
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/data_types/BaseObject.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/data_types/Color.cpp
|
||||
|
||||
# io
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/io/Console.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/io/Errors.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/io/File.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/io/FileSystem.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/io/Json.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/io/Keyboard.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/io/Logger.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/io/Midi.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/io/OutputHandlers.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/io/Serial.cpp
|
||||
|
||||
# math
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/math/Geometry.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/math/ShuntingYard.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/math/Random.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/math/SineWave.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/math/Spline.cpp
|
||||
|
||||
# string
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/string/String.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/string/TextStyleParser.cpp
|
||||
|
||||
# utils
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/utils/Logic.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/utils/md5.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/utils/PathFinder.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/utils/QuadTree.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/utils/Signals.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/utils/Time.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/utils/Utils.cpp
|
||||
)
|
||||
list(APPEND OGFX_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ogfx/FontUtils.cpp
|
||||
|
|
@ -101,8 +109,12 @@ target_include_directories(${TEST_TARGET} PUBLIC ${INCLUDE_DIRS})
|
|||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
add_compile_options(-O3 -MMD -MP -Wall -ggdb -fsanitize=address)
|
||||
target_compile_definitions(${OMNIA_STD_LIB} PUBLIC OX_DEBUG_BUILD)
|
||||
target_compile_definitions(${OMNIA_GFX_LIB} PUBLIC OX_DEBUG_BUILD)
|
||||
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
add_compile_options(-MMD -MP -Wall)
|
||||
target_compile_definitions(${OMNIA_STD_LIB} PUBLIC OX_RELEASE_BUILD)
|
||||
target_compile_definitions(${OMNIA_GFX_LIB} PUBLIC OX_RELEASE_BUILD)
|
||||
endif()
|
||||
#-----------------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
1974
|
||||
2001
|
||||
|
|
|
|||
|
|
@ -1,7 +1,27 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ogfx/FontUtils.hpp>
|
||||
#include <ostd/Geometry.hpp>
|
||||
#include <ostd/math/Geometry.hpp>
|
||||
#include <ogfx/Image.hpp>
|
||||
|
||||
namespace ogfx
|
||||
|
|
|
|||
|
|
@ -1,8 +1,28 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ogfx/SDLInclude.hpp>
|
||||
#include <ostd/Signals.hpp>
|
||||
#include <ostd/IOHandlers.hpp>
|
||||
#include <ostd/utils/Signals.hpp>
|
||||
#include <ostd/io/IOHandlers.hpp>
|
||||
|
||||
namespace ogfx
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,28 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/BaseObject.hpp>
|
||||
#include <ostd/data_types/BaseObject.hpp>
|
||||
#include <ogfx/SDLInclude.hpp>
|
||||
#include <ostd/Geometry.hpp>
|
||||
#include <ostd/math/Geometry.hpp>
|
||||
|
||||
namespace ogfx
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "PixelRenderer.hpp"
|
||||
#include "WindowBase.hpp"
|
||||
#include <ostd/Utils.hpp>
|
||||
#include "../ostd/utils/Utils.hpp"
|
||||
|
||||
namespace ogfx
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,28 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/IOHandlers.hpp>
|
||||
#include <ostd/String.hpp>
|
||||
#include <ostd/Color.hpp>
|
||||
#include <ostd/io/IOHandlers.hpp>
|
||||
#include <ostd/string/String.hpp>
|
||||
#include <ostd/data_types/Color.hpp>
|
||||
#include <ogfx/SDLInclude.hpp>
|
||||
#include <unordered_map>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "RawTextInput.hpp"
|
||||
#include <ogfx/WindowBase.hpp>
|
||||
#include <ostd/Logger.hpp>
|
||||
#include <ostd/io/Logger.hpp>
|
||||
|
||||
namespace ogfx
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,28 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ogfx/BasicRenderer.hpp>
|
||||
#include <ostd/Utils.hpp>
|
||||
#include <ostd/utils/Utils.hpp>
|
||||
|
||||
namespace ogfx
|
||||
{
|
||||
namespace gui
|
||||
|
|
|
|||
|
|
@ -1,3 +1,23 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "WindowBase.hpp"
|
||||
#include "Time.hpp"
|
||||
#include "../ostd/utils/Time.hpp"
|
||||
|
||||
namespace ogfx
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,29 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ogfx/SDLInclude.hpp>
|
||||
#include <ostd/Signals.hpp>
|
||||
#include <ostd/IOHandlers.hpp>
|
||||
#include <ostd/Time.hpp>
|
||||
#include <ostd/utils/Signals.hpp>
|
||||
#include <ostd/utils/Time.hpp>
|
||||
#include <ostd/io/IOHandlers.hpp>
|
||||
|
||||
namespace ogfx
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "WindowBaseOutputHandler.hpp"
|
||||
#include "BasicRenderer.hpp"
|
||||
#include "TextStyleParser.hpp"
|
||||
#include "../string/TextStyleParser.hpp"
|
||||
|
||||
namespace ogfx
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,27 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/IOHandlers.hpp>
|
||||
#include <ostd/TextStyleParser.hpp>
|
||||
#include <ostd/io/IOHandlers.hpp>
|
||||
#include <ostd/string/TextStyleParser.hpp>
|
||||
#include <ogfx/BasicRenderer.hpp>
|
||||
|
||||
namespace ogfx
|
||||
|
|
|
|||
|
|
@ -1,86 +0,0 @@
|
|||
#ifndef __DEFINES_HPP__
|
||||
#define __DEFINES_HPP__
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#define WINDOWS_OS
|
||||
#ifdef _WIN32_WINNT
|
||||
#undef _WIN32_WINNT
|
||||
#endif
|
||||
#define _WIN32_WINNT 0x0501
|
||||
#elif defined(__APPLE__)
|
||||
#define MAC_OS
|
||||
#else
|
||||
#define LINUX_OS
|
||||
#endif
|
||||
|
||||
//Basic constants
|
||||
#if !defined(BUILD_NR)
|
||||
#define BUILD_NR 0
|
||||
#endif
|
||||
#if !defined(MAJ_V)
|
||||
#define MAJ_V 0
|
||||
#endif
|
||||
#if !defined(MIN_V)
|
||||
#define MIN_V 0
|
||||
#endif
|
||||
#if !defined(VERSION_STR)
|
||||
#define VERSION_STR "0.0.0"
|
||||
#endif
|
||||
#if !defined(NULL)
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#define PI 3.1415926535898f
|
||||
#define TWO_PI PI * 2.0f
|
||||
#define HALF_PI PI / 2.0f
|
||||
#define QUARTER_PI PI / 4.0f
|
||||
#define DEG_TO_RAD(deg) (float)(deg * (PI / 180.0f))
|
||||
#define RAD_TO_DEG(rad) (float)(rad * (180.0f / PI))
|
||||
|
||||
//Game Time constants
|
||||
#define TM_R_SECONDS_FOR_G_MINUTE 1
|
||||
#define TM_G_MINUTES_FOR_G_HOUR 60
|
||||
#define TM_G_HOURS_FOR_G_DAY 24
|
||||
#define TM_G_DAYS_FOR_G_LONG_MONTH 31
|
||||
#define TM_G_DAYS_FOR_G_MEDIUM_MONTH 30
|
||||
#define TM_G_DAYS_FOR_G_SHORT_MONTH 28
|
||||
|
||||
//Macro functions
|
||||
#define ERROR_DATA() String(CPP_STR(__LINE__)), String(__FILE__)
|
||||
#define STR_BOOL(b) (b ? "true" : "false")
|
||||
#define INT_BOOL(i) (i == 0 ? false : true)
|
||||
#define ZERO(n) (n > 0 ? n : 0)
|
||||
#define FRAND() ((float)(rand() % 10000)) / 10000.0f
|
||||
#define RANDOM(min, max) rand() % (max - min + 1) + min
|
||||
#define LERP(n1, n2, f) (n2 - n1) * f + n1
|
||||
#define CAP(n, max) (n > max ? max : n)
|
||||
#define CAPD(n, min) (n < min ? min : n)
|
||||
#define CAPB(n, min, max) (n < min ? min : (n > max ? max : n))
|
||||
#define MAX(n1, n2) std::max(n1, n2)
|
||||
#define MIN(n1, n2) std::min(n1, n2)
|
||||
#define PROPORTION(w, x, y) ((x * w) / y)
|
||||
#define CONVERT_1D_2D(i, width) ostd::IPoint(i % width, i / width)
|
||||
#define CONVERT_2D_1D(x, y, width) (x + width * y)
|
||||
#define PRINT(data) std::cout << data
|
||||
#define PRINTLN(data) std::cout << data << "\n"
|
||||
#define NEWLN() std::cout << "\n"
|
||||
#define STDVEC_CONTAINS(vec, elem) (std::find(vec.begin(), vec.end(), elem) != vec.end())
|
||||
|
||||
//Memory management macros
|
||||
#define new_sh(type) std::make_shared<type>
|
||||
#define sh_ptr(type) std::shared_ptr<type>
|
||||
#define new_un(type) std::make_unique<type>
|
||||
#define un_ptr(type) std::unique_ptr<type>
|
||||
|
||||
#define OX_NO_ERROR 0x00000000
|
||||
#define OX_WINDOW_ERR_MASK 0x00000000
|
||||
#define OX_SHADER_ERR_MASK 0x00001000
|
||||
#define OX_GLBUFFERS_ERR_MASK 0x00002000
|
||||
#define OX_TEXTURE_ERR_MASK 0x00003000
|
||||
#define OX_GFX_APPLICATION_2D_ERR_MASK 0x00004000
|
||||
#define OX_BITMAPFONT_ERR_MASK 0x00005000
|
||||
#define OX_RENDERER2D_ERR_MASK 0x00006000
|
||||
#define OX_RENDERTARGET_ERR_MASK 0x00007000
|
||||
#define OX_RENDERER2D_TEXT_ERR_MASK 0x00008000
|
||||
|
||||
#endif
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
#ifndef __ERRORS_HPP__
|
||||
#define __ERRORS_HPP__
|
||||
|
||||
#include <ostd/BaseObject.hpp>
|
||||
#include <ostd/Utils.hpp>
|
||||
#include <ostd/Types.hpp>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
struct tErrorLevel
|
||||
{
|
||||
inline static constexpr uint8_t NoError = 0x00;
|
||||
inline static constexpr uint8_t Warning = 0x01;
|
||||
inline static constexpr uint8_t Error = 0x02;
|
||||
inline static constexpr uint8_t Fatal = 0x03;
|
||||
};
|
||||
|
||||
class RuntimeError : public BaseObject
|
||||
{
|
||||
public:
|
||||
inline RuntimeError(void) { invalidate(); }
|
||||
inline RuntimeError(uint8_t group, uint64_t code, uint8_t level, const String& msg) { create(group, code, level, msg); }
|
||||
RuntimeError& create(uint8_t group, uint64_t code, uint8_t level, const String& msg);
|
||||
|
||||
void fire(const String& extraMessage = "", OutputHandlerBase* outputHandler = nullptr, BaseObject& userData = BaseObject::InvalidRef(), int32_t _line_num = 0, const String& _file_name = "");
|
||||
|
||||
private:
|
||||
uint8_t m_errGroup { 0x00 };
|
||||
uint8_t m_errLevel { tErrorLevel::NoError };
|
||||
uint64_t m_errCode { 0x0000000000000000 };
|
||||
String m_message { "" };
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
#ifndef __LOGIC_HPP__
|
||||
#define __LOGIC_HPP__
|
||||
|
||||
#include <map>
|
||||
#include <ostd/String.hpp>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
enum class eLogicOp
|
||||
{
|
||||
AND = 0,
|
||||
OR,
|
||||
NOT,
|
||||
XOR,
|
||||
|
||||
NAND,
|
||||
NOR,
|
||||
XNOR,
|
||||
|
||||
O_PARENTH = 125,
|
||||
C_PARENTH = 126,
|
||||
NONE = 127
|
||||
};
|
||||
|
||||
class LogicEvaluator
|
||||
{
|
||||
public:
|
||||
static bool eval(String exp);
|
||||
|
||||
private:
|
||||
static bool applyOp(bool a, bool b, eLogicOp op);
|
||||
static eLogicOp parseOp(char op);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,504 +0,0 @@
|
|||
#include "Utils.hpp"
|
||||
#include "Color.hpp"
|
||||
#include "BaseObject.hpp"
|
||||
#include "Logger.hpp"
|
||||
#include "TextStyleParser.hpp"
|
||||
#include "IOHandlers.hpp"
|
||||
#include "String.hpp"
|
||||
|
||||
#include "vendor/TermColor.hpp"
|
||||
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
std::ostream &operator<<(std::ostream &os, ConsoleColors::tConsoleColor const &col)
|
||||
{
|
||||
if (col.background)
|
||||
{
|
||||
if (col.name == "red") os << termcolor::on_red;
|
||||
else if (col.name == "brightred") os << termcolor::on_bright_red;
|
||||
else if (col.name == "green") os << termcolor::on_green;
|
||||
else if (col.name == "brightgreen") os << termcolor::on_bright_green;
|
||||
else if (col.name == "blue") os << termcolor::on_blue;
|
||||
else if (col.name == "brightblue") os << termcolor::on_bright_blue;
|
||||
else if (col.name == "magenta") os << termcolor::on_magenta;
|
||||
else if (col.name == "brightmagenta") os << termcolor::on_bright_magenta;
|
||||
else if (col.name == "cyan") os << termcolor::on_cyan;
|
||||
else if (col.name == "brightcyan") os << termcolor::on_bright_cyan;
|
||||
else if (col.name == "yellow") os << termcolor::on_yellow;
|
||||
else if (col.name == "brightyellow") os << termcolor::on_bright_yellow;
|
||||
else if (col.name == "black") os << termcolor::on_grey;
|
||||
else if (col.name == "darkgray") os << termcolor::on_bright_grey;
|
||||
else if (col.name == "brightgray") os << termcolor::on_white;
|
||||
else if (col.name == "white") os << termcolor::on_bright_white;
|
||||
return os;
|
||||
}
|
||||
if (col.name == "red") os << termcolor::red;
|
||||
else if (col.name == "brightred") os << termcolor::bright_red;
|
||||
else if (col.name == "green") os << termcolor::green;
|
||||
else if (col.name == "brightgreen") os << termcolor::bright_green;
|
||||
else if (col.name == "blue") os << termcolor::blue;
|
||||
else if (col.name == "brightblue") os << termcolor::bright_blue;
|
||||
else if (col.name == "magenta") os << termcolor::magenta;
|
||||
else if (col.name == "brightmagenta") os << termcolor::bright_magenta;
|
||||
else if (col.name == "cyan") os << termcolor::cyan;
|
||||
else if (col.name == "brightcyan") os << termcolor::bright_cyan;
|
||||
else if (col.name == "yellow") os << termcolor::yellow;
|
||||
else if (col.name == "brightyellow") os << termcolor::bright_yellow;
|
||||
else if (col.name == "black") os << termcolor::grey;
|
||||
else if (col.name == "darkgray") os << termcolor::bright_grey;
|
||||
else if (col.name == "brightgray") os << termcolor::white;
|
||||
else if (col.name == "white") os << termcolor::bright_white;
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::bg(const ConsoleColors::tConsoleColor& color)
|
||||
{
|
||||
std::cout << color.asBackground();
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::bg(const String& color)
|
||||
{
|
||||
std::cout << ConsoleColors::getFromName(color, true);
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::fg(const ConsoleColors::tConsoleColor& color)
|
||||
{
|
||||
std::cout << color.asForeground();
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::fg(const String& color)
|
||||
{
|
||||
std::cout << ConsoleColors::getFromName(color, false);
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::pChar(char c)
|
||||
{
|
||||
std::cout << (char)c;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::pStyled(const String& styled)
|
||||
{
|
||||
return pStyled(TextStyleParser::parse(styled));
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::pStyled(const TextStyleParser::tStyledString& styled)
|
||||
{
|
||||
std::cout << styled;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::pStyled(TextStyleBuilder::IRichStringBase& styled)
|
||||
{
|
||||
std::cout << styled;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::pObject(const BaseObject& bo)
|
||||
{
|
||||
std::cout << bo;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(const String& se)
|
||||
{
|
||||
std::cout << se;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(uint8_t i)
|
||||
{
|
||||
std::cout << (uint8_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(int8_t i)
|
||||
{
|
||||
std::cout << (int8_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(uint16_t i)
|
||||
{
|
||||
std::cout << (uint16_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(int16_t i)
|
||||
{
|
||||
std::cout << (int16_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(uint32_t i)
|
||||
{
|
||||
std::cout << (uint32_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(int32_t i)
|
||||
{
|
||||
std::cout << (int32_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(uint64_t i)
|
||||
{
|
||||
std::cout << (uint64_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(int64_t i)
|
||||
{
|
||||
std::cout << (int64_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(float f, uint8_t precision)
|
||||
{
|
||||
if (precision == 0)
|
||||
{
|
||||
std::cout << f;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ios cout_state(nullptr);
|
||||
std::cout << std::fixed << std::setprecision(precision) << f;
|
||||
std::cout.copyfmt(cout_state);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(double f, uint8_t precision)
|
||||
{
|
||||
if (precision == 0)
|
||||
{
|
||||
std::cout << f;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ios cout_state(nullptr);
|
||||
std::cout << std::fixed << std::setprecision(precision) << f;
|
||||
std::cout.copyfmt(cout_state);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::nl(void)
|
||||
{
|
||||
std::cout << "\n";
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::flush(void)
|
||||
{
|
||||
std::cout << std::flush;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::reset(void)
|
||||
{
|
||||
std::cout << termcolor::reset;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::clear(void)
|
||||
{
|
||||
Utils::clearConsole();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace legacy
|
||||
{
|
||||
IOutputHandler& ConsoleOutputHandler::col(String color)
|
||||
{
|
||||
StringEditor cse = color;
|
||||
cse.toLower().trim();
|
||||
if (cse.startsWith("@[") && cse.endsWith("]"))
|
||||
{
|
||||
OX_WARN("ox::ConsoleOutputHandler::col(ox::String): RGB Colors not supported for standard console output: %s", cse.c_str());
|
||||
return *this;
|
||||
}
|
||||
|
||||
//RED
|
||||
if (cse.str() == ConsoleCol::Red) std::cout << termcolor::red;
|
||||
else if (cse.str() == ConsoleCol::BrightRed) std::cout << termcolor::bright_red;
|
||||
else if (cse.str() == ConsoleCol::OnRed) std::cout << termcolor::on_red;
|
||||
else if (cse.str() == ConsoleCol::OnBrightRed) std::cout << termcolor::on_bright_red;
|
||||
//GREEN
|
||||
else if (cse.str() == ConsoleCol::Green) std::cout << termcolor::green;
|
||||
else if (cse.str() == ConsoleCol::BrightGreen) std::cout << termcolor::bright_green;
|
||||
else if (cse.str() == ConsoleCol::OnGreen) std::cout << termcolor::on_green;
|
||||
else if (cse.str() == ConsoleCol::OnBrightGreen) std::cout << termcolor::on_bright_green;
|
||||
//BLUE
|
||||
else if (cse.str() == ConsoleCol::Blue) std::cout << termcolor::blue;
|
||||
else if (cse.str() == ConsoleCol::BrightBlue) std::cout << termcolor::bright_blue;
|
||||
else if (cse.str() == ConsoleCol::OnBlue) std::cout << termcolor::on_blue;
|
||||
else if (cse.str() == ConsoleCol::OnBrightBlue) std::cout << termcolor::on_bright_blue;
|
||||
//MAGENTA
|
||||
else if (cse.str() == ConsoleCol::Magenta) std::cout << termcolor::magenta;
|
||||
else if (cse.str() == ConsoleCol::BrightMagenta) std::cout << termcolor::bright_magenta;
|
||||
else if (cse.str() == ConsoleCol::OnMagenta) std::cout << termcolor::on_magenta;
|
||||
else if (cse.str() == ConsoleCol::OnBrightMagenta) std::cout << termcolor::on_bright_magenta;
|
||||
//CYAN
|
||||
else if (cse.str() == ConsoleCol::Cyan || cse.str() == "aqua") std::cout << termcolor::cyan;
|
||||
else if (cse.str() == ConsoleCol::BrightCyan) std::cout << termcolor::bright_cyan;
|
||||
else if (cse.str() == ConsoleCol::OnCyan || cse.str() == "o-aqua") std::cout << termcolor::on_cyan;
|
||||
else if (cse.str() == ConsoleCol::OnBrightCyan) std::cout << termcolor::on_bright_cyan;
|
||||
//YELLOW
|
||||
else if (cse.str() == ConsoleCol::Yellow) std::cout << termcolor::yellow;
|
||||
else if (cse.str() == ConsoleCol::BrightYellow) std::cout << termcolor::bright_yellow;
|
||||
else if (cse.str() == ConsoleCol::OnYellow) std::cout << termcolor::on_yellow;
|
||||
else if (cse.str() == ConsoleCol::OnBrightYellow) std::cout << termcolor::on_bright_yellow;
|
||||
//GRAY
|
||||
else if (cse.str() == ConsoleCol::Black || cse.str() == "black") std::cout << termcolor::grey;
|
||||
else if (cse.str() == ConsoleCol::BrightGray) std::cout << termcolor::bright_grey;
|
||||
else if (cse.str() == ConsoleCol::OnBlack || cse.str() == "o-black") std::cout << termcolor::on_grey;
|
||||
else if (cse.str() == ConsoleCol::OnBrightGray) std::cout << termcolor::on_bright_grey;
|
||||
//WHITE
|
||||
else if (cse.str() == ConsoleCol::Gray) std::cout << termcolor::white;
|
||||
else if (cse.str() == ConsoleCol::White || cse.str() == "b-lgray") std::cout << termcolor::bright_white;
|
||||
else if (cse.str() == ConsoleCol::onGray) std::cout << termcolor::on_white;
|
||||
else if (cse.str() == ConsoleCol::OnWhite || cse.str() == "o-white") std::cout << termcolor::on_bright_white;
|
||||
else
|
||||
OX_WARN("ox::ConsoleOutputHandler::col(ox::String): Unknown color string: %s", cse.c_str());
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& ConsoleOutputHandler::col(const Color& color)
|
||||
{
|
||||
StringEditor cse = "@[";
|
||||
cse.addi(color.r).add(", ");
|
||||
cse.addi(color.g).add(", ");
|
||||
cse.addi(color.b).add(", ");
|
||||
cse.addi(color.a).add("]");
|
||||
return col(cse.str());
|
||||
}
|
||||
|
||||
IOutputHandler& ConsoleOutputHandler::p(char c)
|
||||
{
|
||||
std::cout << (char)c;
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& ConsoleOutputHandler::p(const StringEditor& se)
|
||||
{
|
||||
std::cout << se;
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& ConsoleOutputHandler::pi(uint8_t i)
|
||||
{
|
||||
std::cout << (int64_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& ConsoleOutputHandler::pi(int8_t i)
|
||||
{
|
||||
std::cout << (int64_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& ConsoleOutputHandler::pi(uint16_t i)
|
||||
{
|
||||
std::cout << (int64_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& ConsoleOutputHandler::pi(int16_t i)
|
||||
{
|
||||
std::cout << (int64_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& ConsoleOutputHandler::pi(uint32_t i)
|
||||
{
|
||||
std::cout << (int64_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& ConsoleOutputHandler::pi(int32_t i)
|
||||
{
|
||||
std::cout << (int64_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& ConsoleOutputHandler::pi(uint64_t i)
|
||||
{
|
||||
std::cout << (uint64_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& ConsoleOutputHandler::pi(int64_t i)
|
||||
{
|
||||
std::cout << (int64_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& ConsoleOutputHandler::pf(float f, uint8_t precision)
|
||||
{
|
||||
if (precision == 0)
|
||||
{
|
||||
std::cout << f;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ios cout_state(nullptr);
|
||||
std::cout << std::fixed << std::setprecision(precision) << f;
|
||||
std::cout.copyfmt(cout_state);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& ConsoleOutputHandler::pf(double f, uint8_t precision)
|
||||
{
|
||||
if (precision == 0)
|
||||
{
|
||||
std::cout << f;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ios cout_state(nullptr);
|
||||
std::cout << std::fixed << std::setprecision(precision) << f;
|
||||
std::cout.copyfmt(cout_state);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& ConsoleOutputHandler::pStyled(const StringEditor& styled)
|
||||
{
|
||||
return pStyled(TextStyleParser::parse(styled.str()));
|
||||
}
|
||||
|
||||
IOutputHandler& ConsoleOutputHandler::pStyled(const TextStyleParser::tStyledString& styled)
|
||||
{
|
||||
std::cout << styled;
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& ConsoleOutputHandler::pStyled(const TextStyleBuilder::IRichStringBase& styled)
|
||||
{
|
||||
std::cout << styled.getStyledString();
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& ConsoleOutputHandler::nl(void)
|
||||
{
|
||||
std::cout << "\n";
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& ConsoleOutputHandler::flush(void)
|
||||
{
|
||||
std::cout << std::endl;
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& ConsoleOutputHandler::reset(void)
|
||||
{
|
||||
std::cout << termcolor::reset;
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& ConsoleOutputHandler::clear(void)
|
||||
{
|
||||
Utils::clearConsole();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
IOutputHandler& BufferedOutputHandler::p(char c)
|
||||
{
|
||||
m_buffer.add(c);
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& BufferedOutputHandler::p(const StringEditor& se)
|
||||
{
|
||||
m_buffer.add(se.str());
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& BufferedOutputHandler::pi(uint8_t i)
|
||||
{
|
||||
m_buffer.addi(i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& BufferedOutputHandler::pi(int8_t i)
|
||||
{
|
||||
m_buffer.addi(i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& BufferedOutputHandler::pi(uint16_t i)
|
||||
{
|
||||
m_buffer.addi(i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& BufferedOutputHandler::pi(int16_t i)
|
||||
{
|
||||
m_buffer.addi(i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& BufferedOutputHandler::pi(uint32_t i)
|
||||
{
|
||||
m_buffer.addi(i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& BufferedOutputHandler::pi(int32_t i)
|
||||
{
|
||||
m_buffer.addi(i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& BufferedOutputHandler::pi(uint64_t i)
|
||||
{
|
||||
m_buffer.addi(i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& BufferedOutputHandler::pi(int64_t i)
|
||||
{
|
||||
m_buffer.addi(i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& BufferedOutputHandler::pf(float f, uint8_t precision)
|
||||
{
|
||||
m_buffer.addf(f);
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& BufferedOutputHandler::pf(double f, uint8_t precision)
|
||||
{
|
||||
m_buffer.addf(f);
|
||||
return *this;
|
||||
}
|
||||
|
||||
IOutputHandler& BufferedOutputHandler::nl(void)
|
||||
{
|
||||
m_buffer.add("\n");
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
#ifndef __QUAD_TREE_HPP__
|
||||
#define __QUAD_TREE_HPP__
|
||||
|
||||
#include <ostd/BaseObject.hpp>
|
||||
#include <ostd/Geometry.hpp>
|
||||
#include <ostd/Defines.hpp>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
class QuadTree : public BaseObject
|
||||
{
|
||||
public: struct tElement
|
||||
{
|
||||
Vec2 pos;
|
||||
void* data;
|
||||
tElement(void);
|
||||
tElement(Vec2 position, void* userData);
|
||||
};
|
||||
public:
|
||||
inline QuadTree(void) : m_points(nullptr), m_sw(nullptr), m_nw(nullptr),
|
||||
m_se(nullptr),m_ne(nullptr), m_subdivided(false),
|
||||
m_capacity(0), m_currentSize(0)
|
||||
{ invalidate(); }
|
||||
inline QuadTree(Rectangle bounds, uint16_t capacity) { create(bounds, capacity); }
|
||||
inline ~QuadTree(void) { destroy(); }
|
||||
void destroy(void);
|
||||
void create(Rectangle bounds, uint16_t capacity);
|
||||
void subdivide(void);
|
||||
bool insert(Vec2 point, void* data = nullptr);
|
||||
void query(Rectangle range, std::vector<tElement*>& list);
|
||||
|
||||
private:
|
||||
tElement* m_points;
|
||||
uint16_t m_currentSize;
|
||||
uint16_t m_capacity;
|
||||
Rectangle m_bounds;
|
||||
bool m_subdivided;
|
||||
un_ptr(QuadTree) m_nw;
|
||||
un_ptr(QuadTree) m_sw;
|
||||
un_ptr(QuadTree) m_ne;
|
||||
un_ptr(QuadTree) m_se;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,331 +0,0 @@
|
|||
#include "Utils.hpp"
|
||||
#include "String.hpp"
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
namespace legacy
|
||||
{
|
||||
String StringEditor::Tokens::next(void)
|
||||
{
|
||||
if (!hasNext()) return Tokens::END;
|
||||
return m_tokens[m_current_index++];
|
||||
}
|
||||
|
||||
String StringEditor::Tokens::previous(void)
|
||||
{
|
||||
if (!hasPrevious()) return Tokens::END;
|
||||
return m_tokens[--m_current_index];
|
||||
}
|
||||
|
||||
StringEditor& StringEditor::ltrim(void)
|
||||
{
|
||||
m_data.erase(m_data.begin(), std::find_if(m_data.begin(), m_data.end(), [](unsigned char ch) {
|
||||
return !std::isspace(ch);
|
||||
}));
|
||||
return *this;
|
||||
}
|
||||
StringEditor& StringEditor::rtrim(void)
|
||||
{
|
||||
m_data.erase(std::find_if(m_data.rbegin(), m_data.rend(), [](unsigned char ch) {
|
||||
return !std::isspace(ch);
|
||||
}).base(), m_data.end());
|
||||
return *this;
|
||||
}
|
||||
StringEditor& StringEditor::trim(void)
|
||||
{
|
||||
return ltrim().rtrim();
|
||||
}
|
||||
StringEditor& StringEditor::toLower(void)
|
||||
{
|
||||
std::transform(m_data.begin(), m_data.end(), m_data.begin(), [](unsigned char c){ return std::tolower(c); });
|
||||
return *this;
|
||||
}
|
||||
StringEditor& StringEditor::toUpper(void)
|
||||
{
|
||||
std::transform(m_data.begin(), m_data.end(), m_data.begin(), [](unsigned char c){ return std::toupper(c); });
|
||||
return *this;
|
||||
}
|
||||
StringEditor& StringEditor::addPadding(char c, uint32_t count)
|
||||
{
|
||||
for (uint16_t i = 0; i < count; i++)
|
||||
m_data += c;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// StringEditor& StringEditor::add(const StringEditor& se)
|
||||
// {
|
||||
// m_data += se.m_data;
|
||||
// return *this;
|
||||
// }
|
||||
|
||||
StringEditor& StringEditor::add(String str)
|
||||
{
|
||||
m_data += str;
|
||||
return *this;
|
||||
}
|
||||
|
||||
StringEditor& StringEditor::add(char c)
|
||||
{
|
||||
m_data += c;
|
||||
return *this;
|
||||
}
|
||||
|
||||
StringEditor& StringEditor::addi(uint8_t i)
|
||||
{
|
||||
m_data += std::to_string(i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
StringEditor& StringEditor::addi(int8_t i)
|
||||
{
|
||||
m_data += std::to_string(i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
StringEditor& StringEditor::addi(uint16_t i)
|
||||
{
|
||||
m_data += std::to_string(i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
StringEditor& StringEditor::addi(int16_t i)
|
||||
{
|
||||
m_data += std::to_string(i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
StringEditor& StringEditor::addi(uint32_t i)
|
||||
{
|
||||
m_data += std::to_string(i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
StringEditor& StringEditor::addi(int32_t i)
|
||||
{
|
||||
m_data += std::to_string(i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
StringEditor& StringEditor::addi(uint64_t i)
|
||||
{
|
||||
m_data += std::to_string(i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
StringEditor& StringEditor::addi(int64_t i)
|
||||
{
|
||||
m_data += std::to_string(i);
|
||||
return *this;
|
||||
}
|
||||
|
||||
StringEditor& StringEditor::addf(float f)
|
||||
{
|
||||
m_data += std::to_string(f);
|
||||
return *this;
|
||||
}
|
||||
|
||||
StringEditor& StringEditor::addf(double f)
|
||||
{
|
||||
m_data += std::to_string(f);
|
||||
return *this;
|
||||
}
|
||||
|
||||
StringEditor& StringEditor::reverse(void)
|
||||
{
|
||||
std::reverse(m_data.begin(), m_data.end());
|
||||
return *this;
|
||||
}
|
||||
|
||||
StringEditor& StringEditor::replaceAll(String what, String with)
|
||||
{
|
||||
while (contains(what))
|
||||
replaceFirst(what, with);
|
||||
return *this;
|
||||
}
|
||||
|
||||
StringEditor& StringEditor::replaceFirst(String what, String with)
|
||||
{
|
||||
int32_t index = indexOf(what);
|
||||
if (index == -1) return *this;
|
||||
m_data.replace(index, what.length(), with);
|
||||
return *this;
|
||||
}
|
||||
|
||||
StringEditor& StringEditor::regexReplace(String regex_pattern, String replace_with, bool case_insensitive)
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::regex rgx(regex_pattern, (case_insensitive ? boost::regex_constants::icase : boost::regex_constants::normal));
|
||||
m_data = boost::regex_replace(m_data, rgx, replace_with);
|
||||
return *this;
|
||||
}
|
||||
catch(const boost::regex_error& err)
|
||||
{
|
||||
std::cerr << err.what() << '\n'; //TODO: Better error handling
|
||||
return *this;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
StringEditor& StringEditor::put(uint32_t index, char c)
|
||||
{
|
||||
if (index < m_data.length())
|
||||
m_data[index] = c;
|
||||
return *this;
|
||||
}
|
||||
|
||||
int64_t StringEditor::toInt(void)
|
||||
{
|
||||
if (!isNumeric(false)) return 0;
|
||||
return Utils::strToInt(m_data);
|
||||
}
|
||||
|
||||
float StringEditor::toFloat(void)
|
||||
{
|
||||
if (!isNumeric(true)) return 0;
|
||||
return std::stof(m_data);
|
||||
}
|
||||
|
||||
double StringEditor::toDouble(void)
|
||||
{
|
||||
if (!isNumeric(true)) return 0;
|
||||
return std::stod(m_data);
|
||||
}
|
||||
|
||||
bool StringEditor::isNumeric(bool decimal)
|
||||
{
|
||||
if (decimal)
|
||||
{
|
||||
std::istringstream iss(m_data);
|
||||
double f;
|
||||
iss >> std::noskipws >> f;
|
||||
return iss.eof() && !iss.fail();
|
||||
}
|
||||
return Utils::isInt(m_data);
|
||||
}
|
||||
|
||||
bool StringEditor::contains(char c)
|
||||
{
|
||||
return m_data.find(c) != std::string::npos;
|
||||
}
|
||||
|
||||
bool StringEditor::contains(String str)
|
||||
{
|
||||
return m_data.find(str) != std::string::npos;
|
||||
}
|
||||
|
||||
bool StringEditor::startsWith(String str)
|
||||
{
|
||||
return m_data.starts_with(str);
|
||||
}
|
||||
|
||||
bool StringEditor::endsWith(String str)
|
||||
{
|
||||
return m_data.ends_with(str);
|
||||
}
|
||||
|
||||
String StringEditor::getReverse(void)
|
||||
{
|
||||
StringEditor se(m_data);
|
||||
return se.reverse().str();
|
||||
}
|
||||
|
||||
uint32_t StringEditor::count(String str)
|
||||
{
|
||||
Tokens tok = tokenize(str, false, true);
|
||||
if (tok.count() < 1) return 0;
|
||||
return tok.count() - 1;
|
||||
}
|
||||
|
||||
int32_t StringEditor::indexOf(char c, uint32_t start)
|
||||
{
|
||||
String cc = "";
|
||||
cc += c;
|
||||
int32_t pos = m_data.find(cc.c_str(), start);
|
||||
if (pos == std::string::npos) return -1;
|
||||
return pos;
|
||||
}
|
||||
|
||||
int32_t StringEditor::indexOf(String str, uint32_t start)
|
||||
{
|
||||
int32_t pos = m_data.find(str.c_str(), start);
|
||||
if (pos == std::string::npos) return -1;
|
||||
return pos;
|
||||
}
|
||||
|
||||
int32_t StringEditor::lastIndexOf(char c)
|
||||
{
|
||||
StringEditor se(m_data);
|
||||
se.reverse();
|
||||
int32_t pos = se.indexOf(c);
|
||||
if (pos < 0) return -1;
|
||||
return len() - pos - 1;
|
||||
}
|
||||
|
||||
int32_t StringEditor::lastIndexOf(String str)
|
||||
{
|
||||
StringEditor se(m_data);
|
||||
se.reverse();
|
||||
StringEditor se2(str);
|
||||
int32_t pos = se.indexOf(se2.reverse().str());
|
||||
if (pos < 0) return -1;
|
||||
return len() - pos - str.length();
|
||||
}
|
||||
|
||||
String StringEditor::substr(uint32_t start, int32_t end)
|
||||
{
|
||||
if (end < 0) return m_data.substr(start);
|
||||
return m_data.substr(start, end - start);
|
||||
}
|
||||
|
||||
StringEditor::Tokens StringEditor::tokenize(String delimiter, bool trim_tokens, bool allow_white_space_only_tokens)
|
||||
{
|
||||
Tokens tokens;
|
||||
int32_t sindex = 0;
|
||||
int32_t eindex = 0;
|
||||
StringEditor __token = "";
|
||||
while ((eindex = indexOf(delimiter, sindex)) != -1)
|
||||
{
|
||||
__token = substr(sindex, eindex);
|
||||
if (trim_tokens)
|
||||
{
|
||||
__token.trim();
|
||||
if (__token.str() != "")
|
||||
tokens.m_tokens.push_back(__token.str());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (allow_white_space_only_tokens && __token.str() != "")
|
||||
tokens.m_tokens.push_back(__token.str());
|
||||
else if (!allow_white_space_only_tokens && StringEditor(__token).trim().str() != "")
|
||||
tokens.m_tokens.push_back(__token.str());
|
||||
}
|
||||
sindex = eindex + delimiter.length();
|
||||
}
|
||||
__token = substr(sindex);
|
||||
if (trim_tokens)
|
||||
{
|
||||
__token.trim();
|
||||
if (__token.str() != "")
|
||||
tokens.m_tokens.push_back(__token.str());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (allow_white_space_only_tokens && __token.str() != "")
|
||||
tokens.m_tokens.push_back(__token.str());
|
||||
else if (!allow_white_space_only_tokens && StringEditor(__token).trim().str() != "")
|
||||
tokens.m_tokens.push_back(__token.str());
|
||||
}
|
||||
return tokens;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const StringEditor& val)
|
||||
{
|
||||
out << val.str();
|
||||
return out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
#include "BaseObject.hpp"
|
||||
#include "Utils.hpp"
|
||||
#include "Defines.hpp"
|
||||
#include "Signals.hpp"
|
||||
#include "IOHandlers.hpp"
|
||||
#include "../utils/Signals.hpp"
|
||||
#include "../io/IOHandlers.hpp"
|
||||
#include "../utils/Utils.hpp"
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -1,11 +1,28 @@
|
|||
#ifndef __BASE_OBJECT_HPP__
|
||||
#define __BASE_OBJECT_HPP__
|
||||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include <ostd/String.hpp>
|
||||
#include <ostd/string/String.hpp>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -65,7 +82,3 @@ namespace ostd
|
|||
static BaseObject s_invalid_obj;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,24 @@
|
|||
#ifndef __BITFIELDS_HPP__
|
||||
#define __BITFIELDS_HPP__
|
||||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
|
@ -907,8 +926,4 @@ namespace ostd
|
|||
}
|
||||
}
|
||||
};
|
||||
} // namesoace ox
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
#include "Color.hpp"
|
||||
#include <cmath>
|
||||
|
||||
#include "Utils.hpp"
|
||||
#include "Logger.hpp"
|
||||
#include "IOHandlers.hpp"
|
||||
#include "../utils/Utils.hpp"
|
||||
#include "../io/Logger.hpp"
|
||||
#include "../io/IOHandlers.hpp"
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -1,10 +1,29 @@
|
|||
#ifndef __COLOR_HPP__
|
||||
#define __COLOR_HPP__
|
||||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <ostd/Types.hpp>
|
||||
#include <ostd/BaseObject.hpp>
|
||||
#include <ostd/String.hpp>
|
||||
#include <ostd/data_types/Types.hpp>
|
||||
#include <ostd/data_types/BaseObject.hpp>
|
||||
#include <ostd/string/String.hpp>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -61,7 +80,3 @@ namespace ostd
|
|||
uint8_t a;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,24 @@
|
|||
#ifndef __TYPES_HPP__
|
||||
#define __TYPES_HPP__
|
||||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
|
|
@ -7,10 +26,6 @@
|
|||
|
||||
namespace ostd
|
||||
{
|
||||
namespace legacy
|
||||
{
|
||||
typedef std::string String;
|
||||
}
|
||||
typedef std::string cpp_string;
|
||||
|
||||
typedef int64_t QWord;
|
||||
|
|
@ -49,7 +64,3 @@ namespace ostd
|
|||
|
||||
typedef std::vector<Byte> ByteStream;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
#include "Utils.hpp"
|
||||
#include "Console.hpp"
|
||||
|
||||
#include <ostd/vendor/TermColor.hpp>
|
||||
#include "../vendor/TermColor.hpp"
|
||||
#include "../utils/Utils.hpp"
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -1,10 +1,29 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/Utils.hpp>
|
||||
#include <ostd/Geometry.hpp>
|
||||
#include <ostd/IOHandlers.hpp>
|
||||
|
||||
#include "String.hpp"
|
||||
#include <ostd/utils/Utils.hpp>
|
||||
#include <ostd/math/Geometry.hpp>
|
||||
#include <ostd/io/IOHandlers.hpp>
|
||||
#include <ostd/string/String.hpp>
|
||||
|
||||
#ifndef WINDOWS_OS
|
||||
#include <termios.h>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include "Errors.hpp"
|
||||
#include "Logger.hpp"
|
||||
#include "String.hpp"
|
||||
#include "../string/String.hpp"
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
55
src/ostd/io/Errors.hpp
Executable file
55
src/ostd/io/Errors.hpp
Executable file
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/data_types/BaseObject.hpp>
|
||||
#include <ostd/data_types/Types.hpp>
|
||||
#include <ostd/utils/Utils.hpp>
|
||||
|
||||
#define ERROR_DATA() String(CPP_STR(__LINE__)), String(__FILE__)
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
struct tErrorLevel
|
||||
{
|
||||
inline static constexpr uint8_t NoError = 0x00;
|
||||
inline static constexpr uint8_t Warning = 0x01;
|
||||
inline static constexpr uint8_t Error = 0x02;
|
||||
inline static constexpr uint8_t Fatal = 0x03;
|
||||
};
|
||||
|
||||
class RuntimeError : public BaseObject
|
||||
{
|
||||
public:
|
||||
inline RuntimeError(void) { invalidate(); }
|
||||
inline RuntimeError(uint8_t group, uint64_t code, uint8_t level, const String& msg) { create(group, code, level, msg); }
|
||||
RuntimeError& create(uint8_t group, uint64_t code, uint8_t level, const String& msg);
|
||||
|
||||
void fire(const String& extraMessage = "", OutputHandlerBase* outputHandler = nullptr, BaseObject& userData = BaseObject::InvalidRef(), int32_t _line_num = 0, const String& _file_name = "");
|
||||
|
||||
private:
|
||||
uint8_t m_errGroup { 0x00 };
|
||||
uint8_t m_errLevel { tErrorLevel::NoError };
|
||||
uint64_t m_errCode { 0x0000000000000000 };
|
||||
String m_message { "" };
|
||||
|
||||
};
|
||||
}
|
||||
|
|
@ -1,10 +1,8 @@
|
|||
#include "File.hpp"
|
||||
#include "Utils.hpp"
|
||||
#include "String.hpp"
|
||||
|
||||
#include <fstream>
|
||||
#include <ios>
|
||||
#include <iterator>
|
||||
#include "../string/String.hpp"
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -1,10 +1,29 @@
|
|||
#ifndef __FILE_HPP__
|
||||
#define __FILE_HPP__
|
||||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/BaseObject.hpp>
|
||||
#include <ostd/Types.hpp>
|
||||
#include <filesystem>
|
||||
#include <vector>
|
||||
#include <ostd/data_types/BaseObject.hpp>
|
||||
#include <ostd/data_types/Types.hpp>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -38,5 +57,3 @@ namespace ostd
|
|||
String m_buffer { "" };
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "Utils.hpp"
|
||||
#include "../utils/Utils.hpp"
|
||||
#include "Logger.hpp"
|
||||
|
||||
namespace ostd
|
||||
|
|
@ -1,9 +1,29 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/Types.hpp>
|
||||
#include <ostd/Geometry.hpp>
|
||||
#include <ostd/String.hpp>
|
||||
#include <ostd/TextStyleParser.hpp>
|
||||
#include <ostd/data_types/Types.hpp>
|
||||
#include <ostd/math/Geometry.hpp>
|
||||
#include <ostd/string/String.hpp>
|
||||
#include <ostd/string/TextStyleParser.hpp>
|
||||
|
||||
namespace ogfx
|
||||
{
|
||||
|
|
@ -193,149 +213,4 @@ namespace ostd
|
|||
OutputHandlerBase& reset(void) override;
|
||||
OutputHandlerBase& clear(void) override;
|
||||
};
|
||||
|
||||
|
||||
namespace legacy
|
||||
{
|
||||
struct ConsoleCol
|
||||
{
|
||||
inline static constexpr const char* Red = "red";
|
||||
inline static constexpr const char* BrightRed = "b-red";
|
||||
inline static constexpr const char* OnRed = "o-red";
|
||||
inline static constexpr const char* OnBrightRed = "ob-red";
|
||||
|
||||
inline static constexpr const char* Green = "green";
|
||||
inline static constexpr const char* BrightGreen = "b-green";
|
||||
inline static constexpr const char* OnGreen = "o-green";
|
||||
inline static constexpr const char* OnBrightGreen = "ob-green";
|
||||
|
||||
inline static constexpr const char* Blue = "blue";
|
||||
inline static constexpr const char* BrightBlue = "b-blue";
|
||||
inline static constexpr const char* OnBlue = "o-blue";
|
||||
inline static constexpr const char* OnBrightBlue = "ob-blue";
|
||||
|
||||
inline static constexpr const char* Magenta = "magenta";
|
||||
inline static constexpr const char* BrightMagenta = "b-magenta";
|
||||
inline static constexpr const char* OnMagenta = "o-magenta";
|
||||
inline static constexpr const char* OnBrightMagenta = "ob-magenta";
|
||||
|
||||
inline static constexpr const char* Cyan = "cyan";
|
||||
inline static constexpr const char* BrightCyan = "b-cyan";
|
||||
inline static constexpr const char* OnCyan = "o-cyan";
|
||||
inline static constexpr const char* OnBrightCyan = "ob-cyan";
|
||||
|
||||
inline static constexpr const char* Yellow = "yellow";
|
||||
inline static constexpr const char* BrightYellow = "b-yellow";
|
||||
inline static constexpr const char* OnYellow = "o-yellow";
|
||||
inline static constexpr const char* OnBrightYellow = "ob-yellow";
|
||||
|
||||
inline static constexpr const char* Black = "gray";
|
||||
inline static constexpr const char* BrightGray = "b-gray";
|
||||
inline static constexpr const char* OnBlack = "o-gray";
|
||||
inline static constexpr const char* OnBrightGray = "ob-gray";
|
||||
|
||||
inline static constexpr const char* Gray = "lgray";
|
||||
inline static constexpr const char* White = "white";
|
||||
inline static constexpr const char* onGray = "o-lgray";
|
||||
inline static constexpr const char* OnWhite = "o-white";
|
||||
};
|
||||
|
||||
class IOutputHandler
|
||||
{
|
||||
public:
|
||||
virtual ~IOutputHandler(void) = default;
|
||||
virtual IOutputHandler& col(String color) = 0;
|
||||
virtual IOutputHandler& col(const Color& color) = 0;
|
||||
//virtual IOutputHandler& p(String str) = 0;
|
||||
virtual IOutputHandler& p(char c) = 0;
|
||||
virtual IOutputHandler& p(const StringEditor& se) = 0;
|
||||
//virtual IOutputHandler& p(const BaseObject& bo) = 0;
|
||||
virtual IOutputHandler& pi(uint8_t i) = 0;
|
||||
virtual IOutputHandler& pi(int8_t i) = 0;
|
||||
virtual IOutputHandler& pi(uint16_t i) = 0;
|
||||
virtual IOutputHandler& pi(int16_t i) = 0;
|
||||
virtual IOutputHandler& pi(uint32_t i) = 0;
|
||||
virtual IOutputHandler& pi(int32_t i) = 0;
|
||||
virtual IOutputHandler& pi(uint64_t i) = 0;
|
||||
virtual IOutputHandler& pi(int64_t i) = 0;
|
||||
virtual IOutputHandler& pf(float f, uint8_t precision = 0) = 0;
|
||||
virtual IOutputHandler& pf(double f, uint8_t precision = 0) = 0;
|
||||
virtual IOutputHandler& pStyled(const StringEditor& styled) = 0;
|
||||
virtual IOutputHandler& pStyled(const TextStyleParser::tStyledString& styled) = 0;
|
||||
virtual IOutputHandler& pStyled(const TextStyleBuilder::IRichStringBase& styled) = 0;
|
||||
virtual IOutputHandler& nl(void) = 0;
|
||||
virtual IOutputHandler& flush(void) = 0;
|
||||
virtual IOutputHandler& reset(void) = 0;
|
||||
|
||||
virtual IOutputHandler& bgcol(const Color& color) = 0;
|
||||
virtual IOutputHandler& bgcol(String color) = 0;
|
||||
virtual IOutputHandler& resetColors(void) = 0;
|
||||
virtual IOutputHandler& clear(void) = 0;
|
||||
};
|
||||
|
||||
class ConsoleOutputHandler : public IOutputHandler
|
||||
{
|
||||
public:
|
||||
IOutputHandler& col(String color) override;
|
||||
IOutputHandler& col(const Color& color) override;
|
||||
inline IOutputHandler& bgcol(const Color& color) override { return *this; }
|
||||
inline IOutputHandler& bgcol(String color) override { return *this; }
|
||||
inline IOutputHandler& resetColors(void) override { return *this; }
|
||||
//IOutputHandler& p(String str);
|
||||
IOutputHandler& p(char c) override;
|
||||
IOutputHandler& p(const StringEditor& se) override;
|
||||
//IOutputHandler& p(const BaseObject& bo);
|
||||
IOutputHandler& pi(uint8_t i) override;
|
||||
IOutputHandler& pi(int8_t i) override;
|
||||
IOutputHandler& pi(uint16_t i) override;
|
||||
IOutputHandler& pi(int16_t i) override;
|
||||
IOutputHandler& pi(uint32_t i) override;
|
||||
IOutputHandler& pi(int32_t i) override;
|
||||
IOutputHandler& pi(uint64_t i) override;
|
||||
IOutputHandler& pi(int64_t i) override;
|
||||
IOutputHandler& pf(float f, uint8_t precision = 0) override;
|
||||
IOutputHandler& pf(double f, uint8_t precision = 0) override;
|
||||
IOutputHandler& pStyled(const StringEditor& styled) override;
|
||||
IOutputHandler& pStyled(const TextStyleParser::tStyledString& styled) override;
|
||||
IOutputHandler& pStyled(const TextStyleBuilder::IRichStringBase& styled) override;
|
||||
IOutputHandler& nl(void) override;
|
||||
IOutputHandler& flush(void) override;
|
||||
IOutputHandler& reset(void) override;
|
||||
IOutputHandler& clear(void) override;
|
||||
};
|
||||
|
||||
class BufferedOutputHandler : public IOutputHandler
|
||||
{
|
||||
public:
|
||||
inline IOutputHandler& col(String color) override { return *this; }
|
||||
inline IOutputHandler& col(const Color& color) override { return *this; }
|
||||
inline IOutputHandler& bgcol(const Color& color) override { return *this; }
|
||||
inline IOutputHandler& bgcol(String color) override { return *this; }
|
||||
inline IOutputHandler& resetColors(void) override { return *this; }
|
||||
IOutputHandler& p(char c) override;
|
||||
IOutputHandler& p(const StringEditor& se) override;
|
||||
IOutputHandler& pi(uint8_t i) override;
|
||||
IOutputHandler& pi(int8_t i) override;
|
||||
IOutputHandler& pi(uint16_t i) override;
|
||||
IOutputHandler& pi(int16_t i) override;
|
||||
IOutputHandler& pi(uint32_t i) override;
|
||||
IOutputHandler& pi(int32_t i) override;
|
||||
IOutputHandler& pi(uint64_t i) override;
|
||||
IOutputHandler& pi(int64_t i) override;
|
||||
IOutputHandler& pf(float f, uint8_t precision = 0) override;
|
||||
IOutputHandler& pf(double f, uint8_t precision = 0) override;
|
||||
IOutputHandler& pStyled(const StringEditor& styled) override { return *this; };
|
||||
inline IOutputHandler& pStyled(const TextStyleParser::tStyledString& styled) override { return *this; }
|
||||
inline IOutputHandler& pStyled(const TextStyleBuilder::IRichStringBase& styled) override { return *this; };
|
||||
IOutputHandler& nl(void) override;
|
||||
inline IOutputHandler& flush(void) override { return *this; }
|
||||
inline IOutputHandler& reset(void) override { return *this; }
|
||||
|
||||
inline IOutputHandler& clear(void) override { m_buffer = ""; return *this; }
|
||||
inline const StringEditor& getBuffer(void) { return m_buffer; }
|
||||
|
||||
private:
|
||||
StringEditor m_buffer;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,9 @@
|
|||
#include "Json.hpp"
|
||||
#include <fstream>
|
||||
#include <ostd/File.hpp>
|
||||
#include <ostd/Geometry.hpp>
|
||||
#include <ostd/Logger.hpp>
|
||||
#include <ostd/String.hpp>
|
||||
#include <ostd/Utils.hpp>
|
||||
#include "../io/File.hpp"
|
||||
#include "../io/Logger.hpp"
|
||||
#include "../math/Geometry.hpp"
|
||||
#include "../string/String.hpp"
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -455,7 +454,7 @@ namespace ostd
|
|||
}
|
||||
}
|
||||
};
|
||||
} // namespace detail
|
||||
}
|
||||
|
||||
|
||||
static inline bool __navigate_json_path(const ostd::String& path, json*& outSource, ostd::String& outName)
|
||||
|
|
@ -1,8 +1,28 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/Geometry.hpp>
|
||||
#include <ostd/String.hpp>
|
||||
#include <ostd/Color.hpp>
|
||||
#include <ostd/math/Geometry.hpp>
|
||||
#include <ostd/string/String.hpp>
|
||||
#include <ostd/data_types/Color.hpp>
|
||||
#include <ostd/vendor/nlohmann/json.hpp> // IWYU pragma: keep
|
||||
|
||||
namespace ostd
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
#include "Console.hpp"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
namespace ostd
|
||||
|
|
@ -186,4 +185,3 @@ namespace ostd
|
|||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
#include "Logger.hpp"
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include "vendor/TermColor.hpp"
|
||||
#include "IOHandlers.hpp"
|
||||
|
||||
namespace ostd
|
||||
|
|
@ -1,7 +1,26 @@
|
|||
#ifndef __LOGGER_HPP__
|
||||
#define __LOGGER_HPP__
|
||||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
#include <ostd/String.hpp>
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/string/String.hpp>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -34,7 +53,7 @@ namespace ostd
|
|||
#define OX_LOG_DEBUG_ENABLED 1
|
||||
#define OX_LOG_TRACE_ENABLED 1
|
||||
|
||||
#if OX_RELEASE == 1
|
||||
#if OX_RELEASE_BUILD == 1
|
||||
#define OX_LOG_DEBUG_ENABLED 0
|
||||
#define OX_LOG_TRACE_ENABLED 0
|
||||
#endif
|
||||
|
|
@ -61,5 +80,3 @@ namespace ostd
|
|||
#else
|
||||
#define OX_TRACE(message, ...)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,11 +1,9 @@
|
|||
#include "Midi.hpp"
|
||||
#include <ostd/vendor/midifile/MidiFile.h>
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <array>
|
||||
|
||||
|
||||
#include "../vendor/midifile/MidiFile.h"
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -1,7 +1,27 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/String.hpp>
|
||||
#include <ostd/Defines.hpp>
|
||||
#include <ostd/string/String.hpp>
|
||||
#include <ostd/utils/Utils.hpp>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
216
src/ostd/io/OutputHandlers.cpp
Executable file
216
src/ostd/io/OutputHandlers.cpp
Executable file
|
|
@ -0,0 +1,216 @@
|
|||
#include "../utils/Utils.hpp"
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include "Logger.hpp"
|
||||
#include "IOHandlers.hpp"
|
||||
#include "../vendor/TermColor.hpp"
|
||||
#include "../data_types/BaseObject.hpp"
|
||||
#include "../string/TextStyleParser.hpp"
|
||||
#include "../string/String.hpp"
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
std::ostream &operator<<(std::ostream &os, ConsoleColors::tConsoleColor const &col)
|
||||
{
|
||||
if (col.background)
|
||||
{
|
||||
if (col.name == "red") os << termcolor::on_red;
|
||||
else if (col.name == "brightred") os << termcolor::on_bright_red;
|
||||
else if (col.name == "green") os << termcolor::on_green;
|
||||
else if (col.name == "brightgreen") os << termcolor::on_bright_green;
|
||||
else if (col.name == "blue") os << termcolor::on_blue;
|
||||
else if (col.name == "brightblue") os << termcolor::on_bright_blue;
|
||||
else if (col.name == "magenta") os << termcolor::on_magenta;
|
||||
else if (col.name == "brightmagenta") os << termcolor::on_bright_magenta;
|
||||
else if (col.name == "cyan") os << termcolor::on_cyan;
|
||||
else if (col.name == "brightcyan") os << termcolor::on_bright_cyan;
|
||||
else if (col.name == "yellow") os << termcolor::on_yellow;
|
||||
else if (col.name == "brightyellow") os << termcolor::on_bright_yellow;
|
||||
else if (col.name == "black") os << termcolor::on_grey;
|
||||
else if (col.name == "darkgray") os << termcolor::on_bright_grey;
|
||||
else if (col.name == "brightgray") os << termcolor::on_white;
|
||||
else if (col.name == "white") os << termcolor::on_bright_white;
|
||||
return os;
|
||||
}
|
||||
if (col.name == "red") os << termcolor::red;
|
||||
else if (col.name == "brightred") os << termcolor::bright_red;
|
||||
else if (col.name == "green") os << termcolor::green;
|
||||
else if (col.name == "brightgreen") os << termcolor::bright_green;
|
||||
else if (col.name == "blue") os << termcolor::blue;
|
||||
else if (col.name == "brightblue") os << termcolor::bright_blue;
|
||||
else if (col.name == "magenta") os << termcolor::magenta;
|
||||
else if (col.name == "brightmagenta") os << termcolor::bright_magenta;
|
||||
else if (col.name == "cyan") os << termcolor::cyan;
|
||||
else if (col.name == "brightcyan") os << termcolor::bright_cyan;
|
||||
else if (col.name == "yellow") os << termcolor::yellow;
|
||||
else if (col.name == "brightyellow") os << termcolor::bright_yellow;
|
||||
else if (col.name == "black") os << termcolor::grey;
|
||||
else if (col.name == "darkgray") os << termcolor::bright_grey;
|
||||
else if (col.name == "brightgray") os << termcolor::white;
|
||||
else if (col.name == "white") os << termcolor::bright_white;
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::bg(const ConsoleColors::tConsoleColor& color)
|
||||
{
|
||||
std::cout << color.asBackground();
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::bg(const String& color)
|
||||
{
|
||||
std::cout << ConsoleColors::getFromName(color, true);
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::fg(const ConsoleColors::tConsoleColor& color)
|
||||
{
|
||||
std::cout << color.asForeground();
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::fg(const String& color)
|
||||
{
|
||||
std::cout << ConsoleColors::getFromName(color, false);
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::pChar(char c)
|
||||
{
|
||||
std::cout << (char)c;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::pStyled(const String& styled)
|
||||
{
|
||||
return pStyled(TextStyleParser::parse(styled));
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::pStyled(const TextStyleParser::tStyledString& styled)
|
||||
{
|
||||
std::cout << styled;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::pStyled(TextStyleBuilder::IRichStringBase& styled)
|
||||
{
|
||||
std::cout << styled;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::pObject(const BaseObject& bo)
|
||||
{
|
||||
std::cout << bo;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(const String& se)
|
||||
{
|
||||
std::cout << se;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(uint8_t i)
|
||||
{
|
||||
std::cout << (uint8_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(int8_t i)
|
||||
{
|
||||
std::cout << (int8_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(uint16_t i)
|
||||
{
|
||||
std::cout << (uint16_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(int16_t i)
|
||||
{
|
||||
std::cout << (int16_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(uint32_t i)
|
||||
{
|
||||
std::cout << (uint32_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(int32_t i)
|
||||
{
|
||||
std::cout << (int32_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(uint64_t i)
|
||||
{
|
||||
std::cout << (uint64_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(int64_t i)
|
||||
{
|
||||
std::cout << (int64_t)i;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(float f, uint8_t precision)
|
||||
{
|
||||
if (precision == 0)
|
||||
{
|
||||
std::cout << f;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ios cout_state(nullptr);
|
||||
std::cout << std::fixed << std::setprecision(precision) << f;
|
||||
std::cout.copyfmt(cout_state);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::p(double f, uint8_t precision)
|
||||
{
|
||||
if (precision == 0)
|
||||
{
|
||||
std::cout << f;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ios cout_state(nullptr);
|
||||
std::cout << std::fixed << std::setprecision(precision) << f;
|
||||
std::cout.copyfmt(cout_state);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::nl(void)
|
||||
{
|
||||
std::cout << "\n";
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::flush(void)
|
||||
{
|
||||
std::cout << std::flush;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::reset(void)
|
||||
{
|
||||
std::cout << termcolor::reset;
|
||||
return *this;
|
||||
}
|
||||
|
||||
OutputHandlerBase& ConsoleOutputHandler::clear(void)
|
||||
{
|
||||
Utils::clearConsole();
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
#include "Serial.hpp"
|
||||
#include "vendor/TermColor.hpp"
|
||||
#include "Utils.hpp"
|
||||
#include "../utils/Utils.hpp"
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -454,5 +453,5 @@ namespace ostd
|
|||
{
|
||||
return Utils::saveByteStreamToFile(getData(), filePath);
|
||||
}
|
||||
} // namespace serial
|
||||
} // namesoace ostd
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,28 @@
|
|||
#ifndef __SERIAL_HPP__
|
||||
#define __SERIAL_HPP__
|
||||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
#include <ostd/Types.hpp>
|
||||
#include <ostd/Bitfields.hpp>
|
||||
#include <ostd/BaseObject.hpp>
|
||||
#include <unordered_map>
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/data_types/Types.hpp>
|
||||
#include <ostd/data_types/Bitfields.hpp>
|
||||
#include <ostd/data_types/BaseObject.hpp>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -70,7 +88,5 @@ namespace ostd
|
|||
public:
|
||||
inline static constexpr uint64_t DefaultMaxSize = 512;
|
||||
};
|
||||
} //namespace serial
|
||||
} // namespace ostd
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
#include "Geometry.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include "String.hpp"
|
||||
#include "../string/String.hpp"
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -1,10 +1,47 @@
|
|||
#ifndef __GEOMETRY_HPP__
|
||||
#define __GEOMETRY_HPP__
|
||||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <ostd/String.hpp>
|
||||
#include <ostd/string/String.hpp>
|
||||
|
||||
#define PI 3.1415926535898f
|
||||
#define TWO_PI PI * 2.0f
|
||||
#define HALF_PI PI / 2.0f
|
||||
#define QUARTER_PI PI / 4.0f
|
||||
#define DEG_TO_RAD(deg) (float)(deg * (PI / 180.0f))
|
||||
#define RAD_TO_DEG(rad) (float)(rad * (180.0f / PI))
|
||||
|
||||
#define LERP(n1, n2, f) (n2 - n1) * f + n1
|
||||
#define CAP(n, max) (n > max ? max : n)
|
||||
#define CAPD(n, min) (n < min ? min : n)
|
||||
#define CAPB(n, min, max) (n < min ? min : (n > max ? max : n))
|
||||
#define MAX(n1, n2) std::max(n1, n2)
|
||||
#define MIN(n1, n2) std::min(n1, n2)
|
||||
#define PROPORTION(w, x, y) ((x * w) / y)
|
||||
|
||||
#define CONVERT_1D_2D(i, width) ostd::IPoint(i % width, i / width)
|
||||
#define CONVERT_2D_1D(x, y, width) (x + width * y)
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -404,5 +441,3 @@ namespace ostd
|
|||
typedef Line<int16_t> I16Line;
|
||||
typedef Line<int8_t> I8Line;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,9 +1,28 @@
|
|||
#ifndef __RANDOM_HPP__
|
||||
#define __RANDOM_HPP__
|
||||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <random>
|
||||
#include <climits>
|
||||
#include <ostd/Geometry.hpp>
|
||||
#include <ostd/math/Geometry.hpp>
|
||||
#include <ostd/vendor/FastNoiseLite.hpp>
|
||||
|
||||
namespace ostd
|
||||
|
|
@ -87,5 +106,3 @@ namespace ostd
|
|||
inline static RandomGenerator s_gen;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,24 +1,11 @@
|
|||
// --- ---
|
||||
// This file uses the following materials.
|
||||
// (1) Wikipedia article [Shunting-yard algorithm](https://en.wikipedia.org/wiki/Shunting-yard_algorithm),
|
||||
// which is released under the [Creative Commons Attribution-Share-Alike License 3.0](https://creativecommons.org/licenses/by-sa/3.0/).
|
||||
// (2) [Implementation notes for unary operators in Shunting-Yard algorithm](https://stackoverflow.com/a/5240912) by Austin Taylor
|
||||
// which is released under the [Creative Commons Attribution-Share-Alike License 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
|
||||
// --- ---
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include "../utils/Utils.hpp"
|
||||
#include "../string/String.hpp"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <tuple>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "String.hpp"
|
||||
#include "Utils.hpp"
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
||||
|
|
@ -1,10 +1,28 @@
|
|||
#ifndef __SINE_WAVE_HPP__
|
||||
#define __SINE_WAVE_HPP__
|
||||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
|
||||
#include <ostd/Defines.hpp>
|
||||
#include <ostd/math/Geometry.hpp>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -35,5 +53,3 @@ namespace ostd
|
|||
std::vector<AdditiveWave> additiveWaves;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
#include "Spline.hpp"
|
||||
#include "WindowBase.hpp"
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -9,36 +8,36 @@ namespace ostd
|
|||
|
||||
void Spline::handleSignal(tSignal& signal)
|
||||
{
|
||||
if (!isEditable()) return;
|
||||
if (isUsingCustomEventHandler() && m_eventHandlerCallback)
|
||||
{
|
||||
m_eventHandlerCallback(signal);
|
||||
return;
|
||||
}
|
||||
if (signal.ID == tBuiltinSignals::MousePressed)
|
||||
{
|
||||
ogfx::MouseEventData& evt = static_cast<ogfx::MouseEventData&>(signal.userData);
|
||||
for (auto& node : m_points)
|
||||
{
|
||||
if (ostd::Rectangle(node.position.x - 20, node.position.y - 20, 40, 40).contains((float)evt.position_x, (float)evt.position_y))
|
||||
{
|
||||
m_selectedNode = &node;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (signal.ID == tBuiltinSignals::MouseReleased)
|
||||
{
|
||||
if (m_selectedNode != nullptr)
|
||||
updateTotalLength();
|
||||
m_selectedNode = nullptr;
|
||||
}
|
||||
else if (signal.ID == tBuiltinSignals::MouseMoved)
|
||||
{
|
||||
ogfx::MouseEventData& evt = static_cast<ogfx::MouseEventData&>(signal.userData);
|
||||
if (m_selectedNode != nullptr)
|
||||
m_selectedNode->position = { (float)evt.position_x, (float)evt.position_y };
|
||||
}
|
||||
// if (!isEditable()) return;
|
||||
// if (isUsingCustomEventHandler() && m_eventHandlerCallback)
|
||||
// {
|
||||
// m_eventHandlerCallback(signal);
|
||||
// return;
|
||||
// }
|
||||
// if (signal.ID == tBuiltinSignals::MousePressed)
|
||||
// {
|
||||
// ogfx::MouseEventData& evt = static_cast<ogfx::MouseEventData&>(signal.userData);
|
||||
// for (auto& node : m_points)
|
||||
// {
|
||||
// if (ostd::Rectangle(node.position.x - 20, node.position.y - 20, 40, 40).contains((float)evt.position_x, (float)evt.position_y))
|
||||
// {
|
||||
// m_selectedNode = &node;
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else if (signal.ID == tBuiltinSignals::MouseReleased)
|
||||
// {
|
||||
// if (m_selectedNode != nullptr)
|
||||
// updateTotalLength();
|
||||
// m_selectedNode = nullptr;
|
||||
// }
|
||||
// else if (signal.ID == tBuiltinSignals::MouseMoved)
|
||||
// {
|
||||
// ogfx::MouseEventData& evt = static_cast<ogfx::MouseEventData&>(signal.userData);
|
||||
// if (m_selectedNode != nullptr)
|
||||
// m_selectedNode->position = { (float)evt.position_x, (float)evt.position_y };
|
||||
// }
|
||||
}
|
||||
|
||||
tSplineNode Spline::getPoint(float t)
|
||||
|
|
@ -1,30 +1,28 @@
|
|||
/*
|
||||
License
|
||||
~~~~~~~
|
||||
Copyright (C) 2018 Javidx9
|
||||
GNU GPLv3 https://github.com/OneLoneCoder/videos/blob/master/LICENSE
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
Author
|
||||
~~~~~~
|
||||
Twitter: @javidx9
|
||||
Blog: www.onelonecoder.com
|
||||
Original works located at:
|
||||
https://www.github.com/onelonecoder
|
||||
https://www.onelonecoder.com
|
||||
https://www.youtube.com/javidx9
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
Videos Explaining Splines:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
https://youtu.be/9_aJGUTePYo
|
||||
https://youtu.be/DzjtU4WLYNs
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __SPLINE_HPP__
|
||||
#define __SPLINE_HPP__
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <ostd/Geometry.hpp>
|
||||
#include <ostd/Signals.hpp>
|
||||
#include <ostd/math/Geometry.hpp>
|
||||
#include <ostd/utils/Signals.hpp>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -34,7 +32,6 @@ namespace ostd
|
|||
float length;
|
||||
};
|
||||
|
||||
class RenderCore;
|
||||
class Spline : public BaseObject
|
||||
{
|
||||
public:
|
||||
|
|
@ -79,5 +76,3 @@ namespace ostd
|
|||
DrawCallback m_drawCallback { nullptr };
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
45
src/ostd/ostd.hpp
Normal file
45
src/ostd/ostd.hpp
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/utils/Defines.hpp>
|
||||
|
||||
#include <ostd/data_types/BaseObject.hpp>
|
||||
#include <ostd/data_types/Bitfields.hpp>
|
||||
#include <ostd/data_types/Color.hpp>
|
||||
#include <ostd/data_types/Types.hpp>
|
||||
|
||||
#include <ostd/io/Errors.hpp>
|
||||
#include <ostd/io/File.hpp>
|
||||
#include <ostd/io/IOHandlers.hpp>
|
||||
#include <ostd/io/Json.hpp>
|
||||
#include <ostd/io/Logger.hpp>
|
||||
#include <ostd/io/Serial.hpp>
|
||||
|
||||
#include <ostd/math/Geometry.hpp>
|
||||
#include <ostd/math/Random.hpp>
|
||||
|
||||
#include <ostd/string/String.hpp>
|
||||
#include <ostd/string/TextStyleParser.hpp>
|
||||
|
||||
#include <ostd/utils/Signals.hpp>
|
||||
#include <ostd/utils/Time.hpp>
|
||||
#include <ostd/utils/Utils.hpp>
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
#include "Utils.hpp"
|
||||
#include "String.hpp"
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include <boost/regex.hpp>
|
||||
#include "../utils/Utils.hpp"
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -1,8 +1,28 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/Types.hpp>
|
||||
#include <cstring>
|
||||
#include <filesystem>
|
||||
#include <ostd/data_types/Types.hpp>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -148,115 +168,6 @@ namespace ostd
|
|||
private:
|
||||
ostd::cpp_string m_data;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace legacy
|
||||
{
|
||||
class StringEditor
|
||||
{
|
||||
public: class Tokens
|
||||
{
|
||||
public:
|
||||
inline bool hasNext(void) { return m_tokens.size() > 0 && m_current_index < m_tokens.size(); }
|
||||
inline bool hasPrevious(void) { return m_tokens.size() > 0 && m_current_index > 0; }
|
||||
String next(void);
|
||||
String previous(void);
|
||||
inline uint32_t count(void) { return m_tokens.size(); }
|
||||
inline std::vector<String> getRawData(void) { return m_tokens; }
|
||||
inline uint32_t getCurrentIndex(void) { return m_current_index; }
|
||||
inline void cycle(void) { m_current_index = 0; }
|
||||
|
||||
inline auto begin(void) { return m_tokens.begin(); }
|
||||
inline auto end(void) { return m_tokens.end(); }
|
||||
inline auto cbegin(void) const { return m_tokens.begin(); }
|
||||
inline auto cend(void) const { return m_tokens.end(); }
|
||||
inline auto begin(void) const { return m_tokens.begin(); }
|
||||
inline auto end(void) const { return m_tokens.end(); }
|
||||
|
||||
private:
|
||||
inline Tokens(void) { m_current_index = 0; }
|
||||
|
||||
private:
|
||||
std::vector<String> m_tokens;
|
||||
uint32_t m_current_index;
|
||||
|
||||
public:
|
||||
inline static const String END = "%END%";
|
||||
|
||||
friend class StringEditor;
|
||||
};
|
||||
|
||||
public:
|
||||
inline StringEditor(void) { m_data = ""; }
|
||||
inline StringEditor(const String& str) { m_data = str; }
|
||||
inline StringEditor(const char* str) { m_data = str; }
|
||||
inline String str(void) const { return m_data; }
|
||||
inline uint32_t len(void) const { return m_data.length(); }
|
||||
inline StringEditor& clr(void) { m_data = ""; return *this; }
|
||||
inline const char* c_str(void) const { return m_data.c_str(); }
|
||||
inline char at(uint32_t index) const { return m_data[index]; }
|
||||
inline char operator[](uint32_t index) const { return m_data[index]; }
|
||||
inline StringEditor& set(String str) { m_data = str; return *this; }
|
||||
|
||||
StringEditor& ltrim(void);
|
||||
StringEditor& rtrim(void);
|
||||
StringEditor& trim(void);
|
||||
|
||||
StringEditor& toLower(void);
|
||||
StringEditor& toUpper(void);
|
||||
|
||||
StringEditor& addPadding(char c = ' ', uint32_t count = 10);
|
||||
//StringEditor& add(const StringEditor& se);
|
||||
StringEditor& add(String str);
|
||||
StringEditor& add(char c);
|
||||
StringEditor& addi(uint8_t i);
|
||||
StringEditor& addi(int8_t i);
|
||||
StringEditor& addi(uint16_t i);
|
||||
StringEditor& addi(int16_t i);
|
||||
StringEditor& addi(uint32_t i);
|
||||
StringEditor& addi(int32_t i);
|
||||
StringEditor& addi(uint64_t i);
|
||||
StringEditor& addi(int64_t i);
|
||||
StringEditor& addf(float f);
|
||||
StringEditor& addf(double f);
|
||||
|
||||
StringEditor& reverse(void);
|
||||
StringEditor& replaceAll(String what, String with);
|
||||
StringEditor& replaceFirst(String what, String with);
|
||||
StringEditor& regexReplace(String regex_pattern, String replace_with, bool case_insensitive = false);
|
||||
|
||||
StringEditor& put(uint32_t index, char c);
|
||||
|
||||
int64_t toInt(void);
|
||||
float toFloat(void);
|
||||
double toDouble(void);
|
||||
bool isNumeric(bool decimal = false);
|
||||
bool contains(char c);
|
||||
bool contains(String str);
|
||||
bool startsWith(String str);
|
||||
bool endsWith(String str);
|
||||
String getReverse(void);
|
||||
|
||||
uint32_t count(String str);
|
||||
|
||||
int32_t indexOf(char c, uint32_t start = 0);
|
||||
int32_t indexOf(String str, uint32_t start = 0);
|
||||
int32_t lastIndexOf(char c);
|
||||
int32_t lastIndexOf(String str);
|
||||
|
||||
String substr(uint32_t start, int32_t end = -1);
|
||||
Tokens tokenize(String delimiter = " ", bool trim_tokens = true, bool allow_white_space_only_tokens = false);
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& out, const StringEditor& val);
|
||||
|
||||
private:
|
||||
String m_data;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include "TextStyleParser.hpp"
|
||||
#include "IOHandlers.hpp"
|
||||
#include "../io/IOHandlers.hpp"
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -1,6 +1,26 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/Color.hpp>
|
||||
#include <ostd/data_types/Color.hpp>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
56
src/ostd/utils/Defines.hpp
Executable file
56
src/ostd/utils/Defines.hpp
Executable file
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#define WINDOWS_OS
|
||||
#ifdef _WIN32_WINNT
|
||||
#undef _WIN32_WINNT
|
||||
#endif
|
||||
#define _WIN32_WINNT 0x0501
|
||||
#elif defined(__APPLE__)
|
||||
#define MAC_OS
|
||||
#else
|
||||
#define LINUX_OS
|
||||
#endif
|
||||
|
||||
//Basic constants
|
||||
#if !defined(BUILD_NR)
|
||||
#define BUILD_NR 0
|
||||
#endif
|
||||
#if !defined(MAJ_V)
|
||||
#define MAJ_V 0
|
||||
#endif
|
||||
#if !defined(MIN_V)
|
||||
#define MIN_V 0
|
||||
#endif
|
||||
#if !defined(VERSION_STR)
|
||||
#define VERSION_STR "0.0.0"
|
||||
#endif
|
||||
#if !defined(NULL)
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#ifndef OX_DEBUG_BUILD
|
||||
#ifndef OX_RELEASE_BUILD
|
||||
#define OX_RELEASE_BUILD
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
#include "Logic.hpp"
|
||||
#include "Utils.hpp"
|
||||
#include "String.hpp"
|
||||
#include "../string/String.hpp"
|
||||
#ifndef __APPLE__
|
||||
#include <bits/stdc++.h>
|
||||
#endif
|
||||
52
src/ostd/utils/Logic.hpp
Executable file
52
src/ostd/utils/Logic.hpp
Executable file
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/string/String.hpp>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
enum class eLogicOp
|
||||
{
|
||||
AND = 0,
|
||||
OR,
|
||||
NOT,
|
||||
XOR,
|
||||
|
||||
NAND,
|
||||
NOR,
|
||||
XNOR,
|
||||
|
||||
O_PARENTH = 125,
|
||||
C_PARENTH = 126,
|
||||
NONE = 127
|
||||
};
|
||||
|
||||
class LogicEvaluator
|
||||
{
|
||||
public:
|
||||
static bool eval(String exp);
|
||||
|
||||
private:
|
||||
static bool applyOp(bool a, bool b, eLogicOp op);
|
||||
static eLogicOp parseOp(char op);
|
||||
};
|
||||
}
|
||||
|
|
@ -1,5 +1,24 @@
|
|||
#ifndef __PATH_FINDER_HPP__
|
||||
#define __PATH_FINDER_HPP__
|
||||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
|
@ -79,5 +98,3 @@ namespace ostd
|
|||
bool m_initialized;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
#include "QuadTree.hpp"
|
||||
#include <memory>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -50,16 +51,16 @@ namespace ostd
|
|||
{
|
||||
if (m_subdivided) return;
|
||||
auto center = m_bounds.getCenter();
|
||||
m_nw = new_un(QuadTree)(Rectangle(
|
||||
m_nw = std::make_unique<QuadTree>(Rectangle(
|
||||
m_bounds.x, m_bounds.y, m_bounds.w / 2, m_bounds.h / 2
|
||||
), m_capacity);
|
||||
m_ne = new_un(QuadTree)(Rectangle(
|
||||
m_ne = std::make_unique<QuadTree>(Rectangle(
|
||||
center.x, m_bounds.y, m_bounds.w / 2, m_bounds.h / 2
|
||||
), m_capacity);
|
||||
m_sw = new_un(QuadTree)(Rectangle(
|
||||
m_sw = std::make_unique<QuadTree>(Rectangle(
|
||||
m_bounds.x, center.y, m_bounds.w / 2, m_bounds.h / 2
|
||||
), m_capacity);
|
||||
m_se = new_un(QuadTree)(Rectangle(
|
||||
m_se = std::make_unique<QuadTree>(Rectangle(
|
||||
center.x, center.y, m_bounds.w / 2, m_bounds.h / 2
|
||||
), m_capacity);
|
||||
m_subdivided = true;
|
||||
63
src/ostd/utils/QuadTree.hpp
Executable file
63
src/ostd/utils/QuadTree.hpp
Executable file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <ostd/data_types/BaseObject.hpp>
|
||||
#include <ostd/math/Geometry.hpp>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
class QuadTree : public BaseObject
|
||||
{
|
||||
public: struct tElement
|
||||
{
|
||||
Vec2 pos;
|
||||
void* data;
|
||||
tElement(void);
|
||||
tElement(Vec2 position, void* userData);
|
||||
};
|
||||
public:
|
||||
inline QuadTree(void) : m_points(nullptr), m_sw(nullptr), m_nw(nullptr),
|
||||
m_se(nullptr),m_ne(nullptr), m_subdivided(false),
|
||||
m_capacity(0), m_currentSize(0)
|
||||
{ invalidate(); }
|
||||
inline QuadTree(Rectangle bounds, uint16_t capacity) { create(bounds, capacity); }
|
||||
inline ~QuadTree(void) { destroy(); }
|
||||
void destroy(void);
|
||||
void create(Rectangle bounds, uint16_t capacity);
|
||||
void subdivide(void);
|
||||
bool insert(Vec2 point, void* data = nullptr);
|
||||
void query(Rectangle range, std::vector<tElement*>& list);
|
||||
|
||||
private:
|
||||
tElement* m_points;
|
||||
uint16_t m_currentSize;
|
||||
uint16_t m_capacity;
|
||||
Rectangle m_bounds;
|
||||
bool m_subdivided;
|
||||
std::unique_ptr<QuadTree> m_nw;
|
||||
std::unique_ptr<QuadTree> m_sw;
|
||||
std::unique_ptr<QuadTree> m_ne;
|
||||
std::unique_ptr<QuadTree> m_se;
|
||||
};
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include "Signals.hpp"
|
||||
#include "BaseObject.hpp"
|
||||
#include "Logger.hpp"
|
||||
#include "../data_types/BaseObject.hpp"
|
||||
#include "../io/Logger.hpp"
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -1,8 +1,27 @@
|
|||
#ifndef __SIGNALS_HPP__
|
||||
#define __SIGNALS_HPP__
|
||||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
#include <ostd/Types.hpp>
|
||||
#include <ostd/BaseObject.hpp>
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/data_types/Types.hpp>
|
||||
#include <ostd/data_types/BaseObject.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace ostd
|
||||
|
|
@ -107,7 +126,4 @@ namespace ostd
|
|||
validate();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,9 +1,37 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/Types.hpp>
|
||||
#include <ostd/String.hpp>
|
||||
#include <ostd/data_types/Types.hpp>
|
||||
#include <ostd/string/String.hpp>
|
||||
#include <functional>
|
||||
|
||||
//Game Time constants
|
||||
#define TM_R_SECONDS_FOR_G_MINUTE 1
|
||||
#define TM_G_MINUTES_FOR_G_HOUR 60
|
||||
#define TM_G_HOURS_FOR_G_DAY 24
|
||||
#define TM_G_DAYS_FOR_G_LONG_MONTH 31
|
||||
#define TM_G_DAYS_FOR_G_MEDIUM_MONTH 30
|
||||
#define TM_G_DAYS_FOR_G_SHORT_MONTH 28
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
enum class eTimeUnits
|
||||
|
|
@ -1,10 +1,4 @@
|
|||
#include "Utils.hpp"
|
||||
#include "String.hpp"
|
||||
#include "Defines.hpp"
|
||||
#include "IOHandlers.hpp"
|
||||
|
||||
#include "vendor/TermColor.hpp"
|
||||
|
||||
#include <bitset>
|
||||
#include <chrono>
|
||||
#include <algorithm>
|
||||
|
|
@ -16,6 +10,9 @@
|
|||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include "../vendor/TermColor.hpp"
|
||||
#include "../string/String.hpp"
|
||||
#include "../io/IOHandlers.hpp"
|
||||
|
||||
#define __get_local_time() \
|
||||
std::time_t __cur_t = std::time(0); \
|
||||
|
|
@ -1,13 +1,33 @@
|
|||
#ifndef __DATATYPES__HPP__
|
||||
#define __DATATYPES__HPP__
|
||||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
#include <cstdint>
|
||||
#include <ostd/Types.hpp>
|
||||
#include <ostd/TextStyleParser.hpp>
|
||||
#include <ostd/Defines.hpp>
|
||||
#include <ostd/Time.hpp>
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include <cstdint>
|
||||
#include <ostd/data_types/Types.hpp>
|
||||
#include <ostd/string/TextStyleParser.hpp>
|
||||
#include <ostd/utils/Time.hpp>
|
||||
|
||||
#define STR_BOOL(b) (b ? "true" : "false")
|
||||
#define STDVEC_CONTAINS(vec, elem) (std::find(vec.begin(), vec.end(), elem) != vec.end())
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
@ -90,5 +110,3 @@ namespace ostd
|
|||
inline static uint64_t s_startTime_ms;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
#include "Utils.hpp"
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <cstdint>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#include "Utils.hpp"
|
||||
|
||||
// Rotation amounts
|
||||
namespace {
|
||||
constexpr uint32_t S11 = 7;
|
||||
23
src/test.cpp
23
src/test.cpp
|
|
@ -1,3 +1,23 @@
|
|||
/*
|
||||
OmniaFramework - A collection of useful functionality
|
||||
Copyright (C) 2025 OmniaX-Dev
|
||||
|
||||
This file is part of OmniaFramework.
|
||||
|
||||
OmniaFramework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OmniaFramework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OmniaFramework. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// #include <ostd/String.hpp>
|
||||
// #include <ostd/IOHandlers.hpp>
|
||||
// #include <ostd/Logger.hpp>
|
||||
|
|
@ -5,8 +25,7 @@
|
|||
|
||||
#include <ogfx/WindowBase.hpp>
|
||||
#include <ogfx/RawTextInput.hpp>
|
||||
#include <ostd/Signals.hpp>
|
||||
|
||||
#include <ostd/ostd.hpp>
|
||||
|
||||
ostd::ConsoleOutputHandler out;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue