Let's just use 1 PD_API header

This commit is contained in:
2026-01-25 20:57:14 +01:00
parent 337c016824
commit fb46f4d36a
63 changed files with 289 additions and 459 deletions

View File

@@ -36,12 +36,12 @@ namespace BitUtil {
* @param v 32 bit unsigned int
* @return true if its a single bit number
*/
PD_CORE_API bool IsSingleBit(u32 v);
PD_API bool IsSingleBit(u32 v);
/**
* Get the Next Power of two Number
* @param v Current Number
* @return Next Number thats a Pow of 2
*/
PD_CORE_API u32 GetPow2(u32 v);
PD_API u32 GetPow2(u32 v);
} // namespace BitUtil
} // namespace PD

View File

@@ -27,7 +27,7 @@ SOFTWARE.
#include <pd/core/strings.hpp>
namespace PD {
class PD_CORE_API Color {
class PD_API Color {
public:
/**
* Default Constructor (all variables are set to 0)

View File

@@ -42,7 +42,7 @@ SOFTWARE.
#include <vector>
/** Dynamic Lib loading */
#include <pd/core/pd_p_api.hpp>
#include <pd/pd_p_api.hpp>
/** Memory Management */

View File

@@ -35,28 +35,28 @@ namespace IO {
* @param path Path to the File
* @return 8Bit FileBuffer
*/
PD_CORE_API std::vector<u8> LoadFile2Mem(const std::string& path);
PD_API std::vector<u8> LoadFile2Mem(const std::string& path);
/**
* Load a File into a std::string
* @param path Path to the File
* @return std::string file content
*/
PD_CORE_API std::string LoadFile2Str(const std::string& path);
PD_API std::string LoadFile2Str(const std::string& path);
/**
* Hash a 8Bit Memory Buffer
* @param data 8Bit input Buffer
* @return 32Bit Hash
*/
PD_CORE_API u32 HashMemory(const std::vector<u8>& data);
PD_API u32 HashMemory(const std::vector<u8>& data);
/**
* Function to decrompress RLE buffer
* @param data Data buffer to decompress
*/
PD_CORE_API void DecompressRLE(std::vector<u8>& data);
PD_API void DecompressRLE(std::vector<u8>& data);
/**
* Function to compress data with RLE Algorithm
* @param data Data buf
*/
PD_CORE_API void CompressRLE(std::vector<u8>& data);
PD_API void CompressRLE(std::vector<u8>& data);
} // namespace IO
} // namespace PD

View File

@@ -41,7 +41,7 @@ constexpr float Radians(float v) { return v * (Numbers::Tau / 360.0f); }
* @note That this is not a full Matrix Library
*/
struct PD_CORE_API Mat4 {
struct PD_API Mat4 {
std::array<float, 16> m;
constexpr Mat4() : m{} {}
constexpr static Mat4 Diagonal(float x, float y, float z, float w) {

View File

@@ -1,51 +0,0 @@
#pragma once
/*
MIT License
Copyright (c) 2024 - 2025 René Amthor (tobid7)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/** Generated with ppam */
#ifdef _WIN32 // Windows (MSVC Tested)
#ifdef PD_CORE_BUILD_SHARED
#define PD_CORE_API __declspec(dllexport)
#else
#define PD_CORE_API __declspec(dllimport)
#endif
#elif defined(__APPLE__) // macOS (untested yet)
#ifdef PD_CORE_BUILD_SHARED
#define PD_CORE_API __attribute__((visibility("default")))
#else
#define PD_CORE_API
#endif
#elif defined(__linux__) // Linux (untested yet)
#ifdef PD_CORE_BUILD_SHARED
#define PD_CORE_API __attribute__((visibility("default")))
#else
#define PD_CORE_API
#endif
#elif defined(__3DS__) // 3ds Specific
// Only Static supported
#define PD_CORE_API
#else
#define PD_CORE_API
#endif

20
include/pd/core/strings.hpp Executable file → Normal file
View File

@@ -43,47 +43,47 @@ constexpr int HexChar2Int(char c) {
* @param exts List of Extensions to check for
* @return true if one of the extensions is found in the String
*/
PD_CORE_API bool StringEndsWith(const std::string& str,
const std::vector<std::string>& exts);
PD_API bool StringEndsWith(const std::string& str,
const std::vector<std::string>& exts);
/**
* Function to Create a wstring of a string
* @param s Input String to Convert
* @return Result wstring
* @note Returns Empty if it has an error
*/
PD_CORE_API std::wstring MakeWstring(const std::string& s);
PD_API std::wstring MakeWstring(const std::string& s);
/**
* Generate a Formatted String by an Nanoseconds Input
* @param nanos Nanoseconds Input
* @return Result String
*/
PD_CORE_API const std::string FormatNanos(unsigned long long nanos);
PD_API const std::string FormatNanos(unsigned long long nanos);
/**
* Generate a Formatted String by an Milliseconds Input
* @param millis Milliseconds Input
* @return Result String
*/
PD_CORE_API const std::string FormatMillis(unsigned long long millis);
PD_API const std::string FormatMillis(unsigned long long millis);
/**
* Create a formatted String by an input bytes value
* @param bytes value in bytes
* @result Formatted String for example `2.5MB`
*/
PD_CORE_API const std::string FormatBytes(unsigned long long bytes);
PD_API const std::string FormatBytes(unsigned long long bytes);
/**
* Extract the Filename out of a Path
* @param path Path to extract from
* @param saperators Path Split Chars
* @return extracted filename
*/
PD_CORE_API const std::string GetFileName(
const std::string& path, const std::string& saperators = "/\\");
PD_API const std::string GetFileName(const std::string& path,
const std::string& saperators = "/\\");
/**
* Remove Extension from a Path / Filename
* @param path Input Path
* @return Path without Extension
*/
PD_CORE_API const std::string PathRemoveExtension(const std::string& path);
PD_API const std::string PathRemoveExtension(const std::string& path);
/**
* Function to Convert a Type to a hex value
* @tparam T Type
@@ -101,7 +101,7 @@ inline const std::string ToHex(const T& v) {
* @param s String to hash
* @return 32Bit Hash
*/
PD_CORE_API u32 FastHash(const std::string& s);
PD_API u32 FastHash(const std::string& s);
/**
* Function to Generate a Compiler Name and Version String
* Based on their Macros

View File

@@ -29,7 +29,7 @@ namespace PD {
/**
* Timer class
*/
class PD_CORE_API Timer {
class PD_API Timer {
public:
/**
* Constructor

View File

@@ -218,12 +218,12 @@ class Res {
* Begin a Trace
* @param id Name of the Trace
*/
PD_CORE_API void Beg(const std::string& id);
PD_API void Beg(const std::string& id);
/**
* End a Trace
* @param id Name of the Trace
*/
PD_CORE_API void End(const std::string& id);
PD_API void End(const std::string& id);
/**
* Collect Start end end of the trace by tracking
* when the Scope object goes out of scope