Renamed data_types sub-folder to data

This commit is contained in:
OmniaX-Dev 2026-03-20 23:21:32 +01:00
parent e04ae605a0
commit 77c2cff1ca
28 changed files with 80 additions and 39 deletions

View file

@ -42,9 +42,9 @@ list(APPEND OSTD_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/src/ostd/vendor/midifile/MidiMessage.cpp ${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/vendor/midifile/Options.cpp
# data_types # data
${CMAKE_CURRENT_LIST_DIR}/src/ostd/data_types/BaseObject.cpp ${CMAKE_CURRENT_LIST_DIR}/src/ostd/data/BaseObject.cpp
${CMAKE_CURRENT_LIST_DIR}/src/ostd/data_types/Color.cpp ${CMAKE_CURRENT_LIST_DIR}/src/ostd/data/Color.cpp
# io # io
${CMAKE_CURRENT_LIST_DIR}/src/ostd/io/Console.cpp ${CMAKE_CURRENT_LIST_DIR}/src/ostd/io/Console.cpp

View file

@ -1 +1 @@
2025 2027

View file

@ -37,14 +37,14 @@ fi
mkdir -p $RELEASE_DIR/include/ostd/vendor mkdir -p $RELEASE_DIR/include/ostd/vendor
mkdir -p $RELEASE_DIR/include/ostd/vendor/midifile mkdir -p $RELEASE_DIR/include/ostd/vendor/midifile
mkdir -p $RELEASE_DIR/include/ostd/data_types mkdir -p $RELEASE_DIR/include/ostd/data
mkdir -p $RELEASE_DIR/include/ostd/io mkdir -p $RELEASE_DIR/include/ostd/io
mkdir -p $RELEASE_DIR/include/ostd/math mkdir -p $RELEASE_DIR/include/ostd/math
mkdir -p $RELEASE_DIR/include/ostd/string mkdir -p $RELEASE_DIR/include/ostd/string
mkdir -p $RELEASE_DIR/include/ostd/utils mkdir -p $RELEASE_DIR/include/ostd/utils
mkdir -p $RELEASE_DIR/include/ogfx/ mkdir -p $RELEASE_DIR/include/ogfx/
find ../src/ostd -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ostd \; find ../src/ostd -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ostd \;
find ../src/ostd/data_types -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ostd/data_types \; find ../src/ostd/data -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ostd/data \;
find ../src/ostd/io -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ostd/io \; find ../src/ostd/io -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ostd/io \;
find ../src/ostd/math -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ostd/math \; find ../src/ostd/math -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ostd/math \;
find ../src/ostd/string -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ostd/string \; find ../src/ostd/string -maxdepth 1 -name "*.h*" -exec cp {} $RELEASE_DIR/include/ostd/string \;

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include <ostd/data_types/Types.hpp> #include <ostd/data/Types.hpp>
#include <ostd/math/Geometry.hpp> #include <ostd/math/Geometry.hpp>
#include <ogfx/Image.hpp> #include <ogfx/Image.hpp>

View file

@ -20,7 +20,7 @@
#pragma once #pragma once
#include <ostd/data_types/BaseObject.hpp> #include <ostd/data/BaseObject.hpp>
#include <ogfx/SDLInclude.hpp> #include <ogfx/SDLInclude.hpp>
#include <ostd/math/Geometry.hpp> #include <ostd/math/Geometry.hpp>

View file

@ -22,7 +22,7 @@
#include <ostd/io/IOHandlers.hpp> #include <ostd/io/IOHandlers.hpp>
#include <ostd/string/String.hpp> #include <ostd/string/String.hpp>
#include <ostd/data_types/Color.hpp> #include <ostd/data/Color.hpp>
#include <ogfx/SDLInclude.hpp> #include <ogfx/SDLInclude.hpp>
#include <unordered_map> #include <unordered_map>

View file

@ -21,8 +21,8 @@
#pragma once #pragma once
#include <cstdint> #include <cstdint>
#include <ostd/data_types/Types.hpp> #include <ostd/data/Types.hpp>
#include <ostd/data_types/BaseObject.hpp> #include <ostd/data/BaseObject.hpp>
#include <ostd/string/String.hpp> #include <ostd/string/String.hpp>
namespace ostd namespace ostd

View file

@ -20,8 +20,8 @@
#pragma once #pragma once
#include <ostd/data_types/BaseObject.hpp> #include <ostd/data/BaseObject.hpp>
#include <ostd/data_types/Types.hpp> #include <ostd/data/Types.hpp>
#define ERROR_DATA() String(CPP_STR(__LINE__)), String(__FILE__) #define ERROR_DATA() String(CPP_STR(__LINE__)), String(__FILE__)

View file

@ -22,8 +22,8 @@
#include <filesystem> #include <filesystem>
#include <vector> #include <vector>
#include <ostd/data_types/BaseObject.hpp> #include <ostd/data/BaseObject.hpp>
#include <ostd/data_types/Types.hpp> #include <ostd/data/Types.hpp>
namespace ostd namespace ostd
{ {

View file

@ -295,10 +295,8 @@ namespace ostd
return ePathStatus::ExistingDirectory; return ePathStatus::ExistingDirectory;
if (fileExists(path)) if (fileExists(path))
return ePathStatus::ExistingFile; return ePathStatus::ExistingFile;
if (isValidDirectoryCreationPath(path)) if (isValidDirectoryCreationPath(path) && isValidFileCreationPath(path))
return ePathStatus::ValidNewDirectory; return ePathStatus::ValidNewPath;
if (isValidFileCreationPath(path))
return ePathStatus::ValidNewFile;
return ePathStatus::Invalid; return ePathStatus::Invalid;
} }
@ -325,6 +323,45 @@ namespace ostd
return true; return true;
} }
bool FileSystem::writeTextFile(const ostd::String& filePath, const std::vector<ostd::String>& lines, bool truncate)
{
namespace fs = std::filesystem;
ePathStatus status = getPathStatus(filePath);
if (status == ePathStatus::Invalid || status == ePathStatus::ExistingDirectory)
{
OX_ERROR("Invalid file path for writing: '%s'", filePath.c_str());
return false;
}
if (!ensureFile(filePath, truncate))
return false;
try
{
std::ofstream ofs(filePath.cpp_str(), std::ios::app);
if (!ofs)
{
OX_ERROR("Failed to open file for writing: '%s'", filePath.c_str());
return false;
}
for (const auto& line : lines)
ofs << line.cpp_str() << '\n';
return true;
}
catch (const fs::filesystem_error& e)
{
OX_ERROR("Filesystem error writing file '%s': %s", filePath.c_str(), e.what());
return false;
}
}
bool FileSystem::writeTextFileRaw(const ostd::String& filePath, const ostd::String& lines, bool truncate)
{
auto _lines = lines.tokenize("\n", false, true).getRawData();
return writeTextFile(filePath, _lines, truncate);
}
bool FileSystem::loadFileFromHppResource(String output_file_path, const char* resource_buffer, unsigned int size) bool FileSystem::loadFileFromHppResource(String output_file_path, const char* resource_buffer, unsigned int size)
{ {
unsigned char ext_len = resource_buffer[0]; unsigned char ext_len = resource_buffer[0];

View file

@ -28,7 +28,7 @@ namespace ostd
{ {
class FileSystem class FileSystem
{ {
public: enum class ePathStatus { Invalid = 0, ExistingDirectory, ValidNewDirectory, ExistingFile, ValidNewFile }; public: enum class ePathStatus { Invalid = 0, ExistingDirectory, ExistingFile, ValidNewPath };
public: public:
static std::vector<std::filesystem::path> listFilesInDirectory(const String& directoryPath); static std::vector<std::filesystem::path> listFilesInDirectory(const String& directoryPath);
@ -55,6 +55,9 @@ namespace ostd
static bool readTextFile(String fileName, std::vector<String>& outLines); static bool readTextFile(String fileName, std::vector<String>& outLines);
static bool readTextFileRaw(String fileName, String& outString); static bool readTextFileRaw(String fileName, String& outString);
static bool writeTextFile(const ostd::String& filePath, const std::vector<ostd::String>& lines, bool truncate = true);
static bool writeTextFileRaw(const ostd::String& filePath, const ostd::String& lines, bool truncate = true);
static bool loadFileFromHppResource(String output_file_path, const char* resource_buffer, unsigned int size); static bool loadFileFromHppResource(String output_file_path, const char* resource_buffer, unsigned int size);
}; };
} }

View file

@ -20,7 +20,7 @@
#pragma once #pragma once
#include <ostd/data_types/Types.hpp> #include <ostd/data/Types.hpp>
#include <ostd/math/Geometry.hpp> #include <ostd/math/Geometry.hpp>
#include <ostd/string/String.hpp> #include <ostd/string/String.hpp>
#include <ostd/string/TextStyleParser.hpp> #include <ostd/string/TextStyleParser.hpp>

View file

@ -22,7 +22,7 @@
#include <ostd/math/Geometry.hpp> #include <ostd/math/Geometry.hpp>
#include <ostd/string/String.hpp> #include <ostd/string/String.hpp>
#include <ostd/data_types/Color.hpp> #include <ostd/data/Color.hpp>
#include <ostd/vendor/nlohmann/json.hpp> // IWYU pragma: keep #include <ostd/vendor/nlohmann/json.hpp> // IWYU pragma: keep
namespace ostd namespace ostd

View file

@ -20,7 +20,7 @@
#pragma once #pragma once
#include <ostd/data_types/Types.hpp> #include <ostd/data/Types.hpp>
#include <ostd/string/String.hpp> #include <ostd/string/String.hpp>
#include <ostd/io/IOHandlers.hpp> #include <ostd/io/IOHandlers.hpp>

View file

@ -3,7 +3,7 @@
#include "Logger.hpp" #include "Logger.hpp"
#include "IOHandlers.hpp" #include "IOHandlers.hpp"
#include "../vendor/TermColor.hpp" #include "../vendor/TermColor.hpp"
#include "../data_types/BaseObject.hpp" #include "../data/BaseObject.hpp"
#include "../string/TextStyleParser.hpp" #include "../string/TextStyleParser.hpp"
#include "../string/String.hpp" #include "../string/String.hpp"
#include "io/Console.hpp" #include "io/Console.hpp"

View file

@ -20,9 +20,9 @@
#pragma once #pragma once
#include <ostd/data_types/Types.hpp> #include <ostd/data/Types.hpp>
#include <ostd/data_types/Bitfields.hpp> #include <ostd/data/Bitfields.hpp>
#include <ostd/data_types/BaseObject.hpp> #include <ostd/data/BaseObject.hpp>
namespace ostd namespace ostd
{ {

View file

@ -22,10 +22,10 @@
#include <ostd/utils/Defines.hpp> #include <ostd/utils/Defines.hpp>
#include <ostd/data_types/BaseObject.hpp> #include <ostd/data/BaseObject.hpp>
#include <ostd/data_types/Bitfields.hpp> #include <ostd/data/Bitfields.hpp>
#include <ostd/data_types/Color.hpp> #include <ostd/data/Color.hpp>
#include <ostd/data_types/Types.hpp> #include <ostd/data/Types.hpp>
#include <ostd/io/Errors.hpp> #include <ostd/io/Errors.hpp>
#include <ostd/io/File.hpp> #include <ostd/io/File.hpp>
@ -33,9 +33,11 @@
#include <ostd/io/IOHandlers.hpp> #include <ostd/io/IOHandlers.hpp>
#include <ostd/io/Json.hpp> #include <ostd/io/Json.hpp>
#include <ostd/io/Logger.hpp> #include <ostd/io/Logger.hpp>
#include <ostd/io/Memory.hpp>
#include <ostd/io/Serial.hpp> #include <ostd/io/Serial.hpp>
#include <ostd/math/Geometry.hpp> #include <ostd/math/Geometry.hpp>
#include <ostd/math/MathUtils.hpp>
#include <ostd/math/Random.hpp> #include <ostd/math/Random.hpp>
#include <ostd/string/String.hpp> #include <ostd/string/String.hpp>
@ -43,4 +45,3 @@
#include <ostd/utils/Signals.hpp> #include <ostd/utils/Signals.hpp>
#include <ostd/utils/Time.hpp> #include <ostd/utils/Time.hpp>
#include <ostd/utils/Utils.hpp>

View file

@ -22,7 +22,7 @@
#include <cstring> #include <cstring>
#include <filesystem> #include <filesystem>
#include <ostd/data_types/Types.hpp> #include <ostd/data/Types.hpp>
#define STR_BOOL(b) (b ? "true" : "false") #define STR_BOOL(b) (b ? "true" : "false")

View file

@ -20,7 +20,7 @@
#pragma once #pragma once
#include <ostd/data_types/Color.hpp> #include <ostd/data/Color.hpp>
namespace ostd namespace ostd
{ {

View file

@ -22,7 +22,7 @@
#include <vector> #include <vector>
#include <memory> #include <memory>
#include <ostd/data_types/BaseObject.hpp> #include <ostd/data/BaseObject.hpp>
#include <ostd/math/Geometry.hpp> #include <ostd/math/Geometry.hpp>
namespace ostd namespace ostd

View file

@ -1,5 +1,5 @@
#include "Signals.hpp" #include "Signals.hpp"
#include "../data_types/BaseObject.hpp" #include "../data/BaseObject.hpp"
#include "../io/Logger.hpp" #include "../io/Logger.hpp"
namespace ostd namespace ostd

View file

@ -20,8 +20,8 @@
#pragma once #pragma once
#include <ostd/data_types/Types.hpp> #include <ostd/data/Types.hpp>
#include <ostd/data_types/BaseObject.hpp> #include <ostd/data/BaseObject.hpp>
#include <vector> #include <vector>
namespace ostd namespace ostd

View file

@ -20,7 +20,7 @@
#pragma once #pragma once
#include <ostd/data_types/Types.hpp> #include <ostd/data/Types.hpp>
#include <ostd/string/String.hpp> #include <ostd/string/String.hpp>
#include <functional> #include <functional>