Renamed data_types sub-folder to data
This commit is contained in:
parent
e04ae605a0
commit
77c2cff1ca
28 changed files with 80 additions and 39 deletions
|
|
@ -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/Options.cpp
|
||||
|
||||
# data_types
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/data_types/BaseObject.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/data_types/Color.cpp
|
||||
# data
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/data/BaseObject.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/data/Color.cpp
|
||||
|
||||
# io
|
||||
${CMAKE_CURRENT_LIST_DIR}/src/ostd/io/Console.cpp
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
2025
|
||||
2027
|
||||
|
|
|
|||
|
|
@ -37,14 +37,14 @@ fi
|
|||
|
||||
mkdir -p $RELEASE_DIR/include/ostd/vendor
|
||||
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/math
|
||||
mkdir -p $RELEASE_DIR/include/ostd/string
|
||||
mkdir -p $RELEASE_DIR/include/ostd/utils
|
||||
mkdir -p $RELEASE_DIR/include/ogfx/
|
||||
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/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 \;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <ostd/data_types/Types.hpp>
|
||||
#include <ostd/data/Types.hpp>
|
||||
#include <ostd/math/Geometry.hpp>
|
||||
#include <ogfx/Image.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/data_types/BaseObject.hpp>
|
||||
#include <ostd/data/BaseObject.hpp>
|
||||
#include <ogfx/SDLInclude.hpp>
|
||||
#include <ostd/math/Geometry.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <ostd/io/IOHandlers.hpp>
|
||||
#include <ostd/string/String.hpp>
|
||||
#include <ostd/data_types/Color.hpp>
|
||||
#include <ostd/data/Color.hpp>
|
||||
#include <ogfx/SDLInclude.hpp>
|
||||
#include <unordered_map>
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <ostd/data_types/Types.hpp>
|
||||
#include <ostd/data_types/BaseObject.hpp>
|
||||
#include <ostd/data/Types.hpp>
|
||||
#include <ostd/data/BaseObject.hpp>
|
||||
#include <ostd/string/String.hpp>
|
||||
|
||||
namespace ostd
|
||||
|
|
@ -20,8 +20,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/data_types/BaseObject.hpp>
|
||||
#include <ostd/data_types/Types.hpp>
|
||||
#include <ostd/data/BaseObject.hpp>
|
||||
#include <ostd/data/Types.hpp>
|
||||
|
||||
#define ERROR_DATA() String(CPP_STR(__LINE__)), String(__FILE__)
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
#include <filesystem>
|
||||
#include <vector>
|
||||
#include <ostd/data_types/BaseObject.hpp>
|
||||
#include <ostd/data_types/Types.hpp>
|
||||
#include <ostd/data/BaseObject.hpp>
|
||||
#include <ostd/data/Types.hpp>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
|
|||
|
|
@ -295,10 +295,8 @@ namespace ostd
|
|||
return ePathStatus::ExistingDirectory;
|
||||
if (fileExists(path))
|
||||
return ePathStatus::ExistingFile;
|
||||
if (isValidDirectoryCreationPath(path))
|
||||
return ePathStatus::ValidNewDirectory;
|
||||
if (isValidFileCreationPath(path))
|
||||
return ePathStatus::ValidNewFile;
|
||||
if (isValidDirectoryCreationPath(path) && isValidFileCreationPath(path))
|
||||
return ePathStatus::ValidNewPath;
|
||||
return ePathStatus::Invalid;
|
||||
}
|
||||
|
||||
|
|
@ -325,6 +323,45 @@ namespace ostd
|
|||
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)
|
||||
{
|
||||
unsigned char ext_len = resource_buffer[0];
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace ostd
|
|||
{
|
||||
class FileSystem
|
||||
{
|
||||
public: enum class ePathStatus { Invalid = 0, ExistingDirectory, ValidNewDirectory, ExistingFile, ValidNewFile };
|
||||
public: enum class ePathStatus { Invalid = 0, ExistingDirectory, ExistingFile, ValidNewPath };
|
||||
|
||||
public:
|
||||
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 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);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/data_types/Types.hpp>
|
||||
#include <ostd/data/Types.hpp>
|
||||
#include <ostd/math/Geometry.hpp>
|
||||
#include <ostd/string/String.hpp>
|
||||
#include <ostd/string/TextStyleParser.hpp>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <ostd/math/Geometry.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
|
||||
|
||||
namespace ostd
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/data_types/Types.hpp>
|
||||
#include <ostd/data/Types.hpp>
|
||||
#include <ostd/string/String.hpp>
|
||||
#include <ostd/io/IOHandlers.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "Logger.hpp"
|
||||
#include "IOHandlers.hpp"
|
||||
#include "../vendor/TermColor.hpp"
|
||||
#include "../data_types/BaseObject.hpp"
|
||||
#include "../data/BaseObject.hpp"
|
||||
#include "../string/TextStyleParser.hpp"
|
||||
#include "../string/String.hpp"
|
||||
#include "io/Console.hpp"
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/data_types/Types.hpp>
|
||||
#include <ostd/data_types/Bitfields.hpp>
|
||||
#include <ostd/data_types/BaseObject.hpp>
|
||||
#include <ostd/data/Types.hpp>
|
||||
#include <ostd/data/Bitfields.hpp>
|
||||
#include <ostd/data/BaseObject.hpp>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,10 +22,10 @@
|
|||
|
||||
#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/data/BaseObject.hpp>
|
||||
#include <ostd/data/Bitfields.hpp>
|
||||
#include <ostd/data/Color.hpp>
|
||||
#include <ostd/data/Types.hpp>
|
||||
|
||||
#include <ostd/io/Errors.hpp>
|
||||
#include <ostd/io/File.hpp>
|
||||
|
|
@ -33,9 +33,11 @@
|
|||
#include <ostd/io/IOHandlers.hpp>
|
||||
#include <ostd/io/Json.hpp>
|
||||
#include <ostd/io/Logger.hpp>
|
||||
#include <ostd/io/Memory.hpp>
|
||||
#include <ostd/io/Serial.hpp>
|
||||
|
||||
#include <ostd/math/Geometry.hpp>
|
||||
#include <ostd/math/MathUtils.hpp>
|
||||
#include <ostd/math/Random.hpp>
|
||||
|
||||
#include <ostd/string/String.hpp>
|
||||
|
|
@ -43,4 +45,3 @@
|
|||
|
||||
#include <ostd/utils/Signals.hpp>
|
||||
#include <ostd/utils/Time.hpp>
|
||||
#include <ostd/utils/Utils.hpp>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <cstring>
|
||||
#include <filesystem>
|
||||
#include <ostd/data_types/Types.hpp>
|
||||
#include <ostd/data/Types.hpp>
|
||||
|
||||
#define STR_BOOL(b) (b ? "true" : "false")
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/data_types/Color.hpp>
|
||||
#include <ostd/data/Color.hpp>
|
||||
|
||||
namespace ostd
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <ostd/data_types/BaseObject.hpp>
|
||||
#include <ostd/data/BaseObject.hpp>
|
||||
#include <ostd/math/Geometry.hpp>
|
||||
|
||||
namespace ostd
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "Signals.hpp"
|
||||
#include "../data_types/BaseObject.hpp"
|
||||
#include "../data/BaseObject.hpp"
|
||||
#include "../io/Logger.hpp"
|
||||
|
||||
namespace ostd
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/data_types/Types.hpp>
|
||||
#include <ostd/data_types/BaseObject.hpp>
|
||||
#include <ostd/data/Types.hpp>
|
||||
#include <ostd/data/BaseObject.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace ostd
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <ostd/data_types/Types.hpp>
|
||||
#include <ostd/data/Types.hpp>
|
||||
#include <ostd/string/String.hpp>
|
||||
#include <functional>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue