Compare commits
29 Commits
Author | SHA1 | Date | |
---|---|---|---|
3343f8ca28 | |||
3b8159b75f | |||
62e7580d3a | |||
11170006e9 | |||
37e3ca9360 | |||
daca00603a | |||
1f5299ad1b | |||
dfa260b87c | |||
fc8b771026 | |||
0b77c074cf | |||
5007a1047a | |||
25860dc32a | |||
d870599a60 | |||
9bd3e1cd8d | |||
681c0d09be | |||
25762b0c29 | |||
6afa08df82 | |||
0a995a3f2c | |||
c607b20bad | |||
2e705627ac | |||
86a35fd668 | |||
8d4420528a | |||
3970b8d402 | |||
6522994a1f | |||
01a21032a5 | |||
4d7e7596b6 | |||
97b5300e48 | |||
8e7cc39000 | |||
1b70383448 |
@@ -8,6 +8,9 @@ on:
|
||||
jobs:
|
||||
Windows-AMD64-Build:
|
||||
runs-on: windows-x86_64
|
||||
defaults:
|
||||
run:
|
||||
shell: powershell
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
@@ -19,8 +22,10 @@ jobs:
|
||||
- name: Building/Compiling/Installing Project
|
||||
run: |
|
||||
cd ${{ gitea.workspace }}
|
||||
cmake -A x64 -DCMAKE_BUILD_TYPE=Release --preset=default .
|
||||
vcpkg install
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -A x64 -DCMAKE_BUILD_TYPE=Release ..
|
||||
cmake --build . --config Release
|
||||
cmake --install .
|
||||
|
||||
@@ -28,10 +33,12 @@ jobs:
|
||||
run: |
|
||||
cd ${{ gitea.workspace }}
|
||||
mkdir bin
|
||||
mv build/Release/EHS_Dyn.dll bin
|
||||
mv build/Release/StrToHash.exe bin
|
||||
mv build/Release/zlib1.dll bin
|
||||
mkdir lib
|
||||
mv build/Release/EHS.lib lib
|
||||
mv build/Release/EHS_Stc.lib lib
|
||||
mv build/Release/EHS_Dyn.lib lib
|
||||
|
||||
- name: Zipping Binaries
|
||||
run: |
|
||||
@@ -58,7 +65,7 @@ jobs:
|
||||
|
||||
- name: Installing Dependencies
|
||||
run: |
|
||||
sudo pacman -S --noconfirm doxygen zip alsa-lib libxcb xcb-util-cursor
|
||||
sudo pacman -S --noconfirm doxygen zip alsa-lib libxcb xcb-util-cursor pipewire
|
||||
|
||||
- name: Generating Documentation
|
||||
run: |
|
||||
@@ -73,10 +80,12 @@ jobs:
|
||||
|
||||
- name: Creating Appropriate Directories
|
||||
run: |
|
||||
cd ${{ gitea.workspace }}
|
||||
mkdir bin
|
||||
mv libEHS_Dyn.so bin
|
||||
mv StrToHash bin
|
||||
mkdir lib
|
||||
mv libEHS.a lib
|
||||
mv libEHS_Stc.a lib
|
||||
|
||||
- name: Zipping Binaries
|
||||
run: zip -r ehs-linux-amd64.zip include bin lib docs LICENSE RADME.md
|
||||
@@ -100,7 +109,7 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Installing Dependencies
|
||||
run: sudo apt install -y doxygen zip libasound2-dev libxcb1-dev libxcb-xinput-dev libxcb-cursor-dev
|
||||
run: sudo apt install -y doxygen zip libasound2-dev libxcb1-dev libxcb-xinput-dev libxcb-cursor-dev libpipewire-0.3-dev
|
||||
|
||||
- name: Generating Documentation
|
||||
run: |
|
||||
@@ -115,10 +124,12 @@ jobs:
|
||||
|
||||
- name: Creating Appropriate Directories
|
||||
run: |
|
||||
cd ${{ gitea.workspace }}
|
||||
mkdir bin
|
||||
mv libEHS_Dyn.so bin
|
||||
mv StrToHash bin
|
||||
mkdir lib
|
||||
mv libEHS.a lib
|
||||
mv libEHS_Stc.a lib
|
||||
|
||||
- name: Zipping Binaries
|
||||
run: zip -r ehs-linux-aarch64.zip include bin lib docs LICENSE README.md
|
||||
|
@@ -13,7 +13,8 @@ project(EHS CXX C)
|
||||
|
||||
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
|
||||
set(IS_OS_WINDOWS TRUE)
|
||||
set(USER_HOME_DIRECTORY $ENV{USERPROFILE})
|
||||
set(USER_HOME_DIRECTORY "$ENV{USERPROFILE}")
|
||||
string(REPLACE "\\" "/" USER_HOME_DIRECTORY "${USER_HOME_DIRECTORY}")
|
||||
message("Building for the Windows operating system.")
|
||||
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
|
||||
set(IS_OS_LINUX TRUE)
|
||||
@@ -207,14 +208,14 @@ elseif (IS_OS_LINUX)
|
||||
src/io/File_UNX.cpp include/ehs/io/File_UNX.h
|
||||
src/io/FileMonitor_UNX.cpp include/ehs/io/FileMonitor_UNX.h
|
||||
src/system/Mutex_PT.cpp include/ehs/system/Mutex_PT.h
|
||||
src/io/audio/AudioDevice_ALSA.cpp include/ehs/io/audio/AudioDevice_ALSA.h
|
||||
src/io/audio/AudioDevice_PW.cpp include/ehs/io/audio/AudioDevice_PW.h
|
||||
src/system/FileSystem.cpp include/ehs/system/FileSystem.h
|
||||
src/system/User.cpp include/ehs/system/User.h
|
||||
src/io/Directory_LNX.cpp include/ehs/io/Directory_LNX.h
|
||||
src/io/Usb_LNX.cpp include/ehs/io/Usb_LNX.h
|
||||
)
|
||||
|
||||
set(LINUX_WINDOW_SYSTEM "Wayland" CACHE STRING "Linux Window System")
|
||||
#set(LINUX_WINDOW_SYSTEM "Wayland" CACHE STRING "Linux Window System")
|
||||
|
||||
if (LINUX_WINDOW_SYSTEM STREQUAL "Wayland")
|
||||
add_compile_definitions(EHS_WS_WAYLAND)
|
||||
@@ -239,23 +240,37 @@ endif()
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||
#message("${CMAKE_CXX_FLAGS}")
|
||||
|
||||
add_library(EHS ${EHS_SOURCES})
|
||||
|
||||
add_library(EHS_Stc STATIC ${EHS_SOURCES})
|
||||
add_library(EHS_Dyn SHARED ${EHS_SOURCES})
|
||||
add_executable(StrToHash src/StrToHash.cpp)
|
||||
|
||||
target_include_directories(EHS PUBLIC ${PROJECT_SOURCE_DIR}/include)
|
||||
target_compile_definitions(EHS_Dyn PRIVATE EHS_LIB_EXPORT)
|
||||
|
||||
target_include_directories(EHS_Stc PUBLIC ${PROJECT_SOURCE_DIR}/include)
|
||||
target_include_directories(EHS_Dyn PUBLIC ${PROJECT_SOURCE_DIR}/include)
|
||||
|
||||
if (IS_OS_LINUX)
|
||||
set(CMAKE_INSTALL_PREFIX "${USER_HOME_DIRECTORY}/.local")
|
||||
install(TARGETS EHS_Dyn LIBRARY DESTINATION "bin")
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(PIPEWIRE REQUIRED libpipewire-0.3)
|
||||
|
||||
target_include_directories(EHS_Stc PRIVATE ${PIPEWIRE_INCLUDE_DIRS})
|
||||
target_include_directories(EHS_Dyn PRIVATE ${PIPEWIRE_INCLUDE_DIRS})
|
||||
elseif (IS_OS_WINDOWS)
|
||||
set(CMAKE_INSTALL_PREFIX "${USER_HOME_DIRECTORY}/EHS")
|
||||
install(TARGETS EHS_Dyn LIBRARY DESTINATION "lib")
|
||||
install(TARGETS EHS_Dyn RUNTIME DESTINATION "bin")
|
||||
|
||||
file(GLOB DLL_FILES "${CMAKE_CURRENT_BINARY_DIR}/*.dll")
|
||||
install(FILES ${DLL_FILES} DESTINATION "bin")
|
||||
endif ()
|
||||
|
||||
install(TARGETS EHS DESTINATION lib)
|
||||
install(TARGETS EHS_Stc DESTINATION "lib")
|
||||
install(TARGETS StrToHash DESTINATION "bin")
|
||||
|
||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include)
|
||||
|
||||
install(TARGETS StrToHash DESTINATION bin)
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/" DESTINATION "include")
|
||||
|
||||
find_package(ZLIB REQUIRED)
|
||||
if (ZLIB_FOUND)
|
||||
@@ -271,16 +286,22 @@ else ()
|
||||
message(STATUS "OpenSSL was not found.")
|
||||
endif ()
|
||||
|
||||
target_link_libraries(EHS OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB)
|
||||
target_link_libraries(EHS_Stc OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB)
|
||||
target_link_libraries(EHS_Dyn OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB)
|
||||
target_link_libraries(StrToHash OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB)
|
||||
|
||||
if (IS_OS_WINDOWS)
|
||||
target_link_libraries(StrToHash ws2_32 avrt EHS)
|
||||
target_link_libraries(EHS_Dyn avrt ws2_32)
|
||||
target_link_libraries(StrToHash ws2_32 avrt EHS_Stc)
|
||||
elseif (IS_OS_LINUX)
|
||||
if (LINUX_WINDOW_SYSTEM STREQUAL "Wayland")
|
||||
target_link_libraries(EHS_Dyn wayland-client)
|
||||
target_link_libraries(StrToHash wayland-client)
|
||||
elseif (LINUX_WINDOW_SYSTEM STREQUAL "XCB")
|
||||
target_link_libraries(EHS_Dyn xcb xcb-cursor xcb-xfixes xcb-xinput)
|
||||
target_link_libraries(StrToHash xcb xcb-cursor xcb-xfixes xcb-xinput)
|
||||
endif ()
|
||||
|
||||
target_link_libraries(StrToHash z asound EHS)
|
||||
target_link_libraries(EHS_Dyn z asound pipewire-0.3)
|
||||
target_link_libraries(StrToHash z asound EHS_Stc)
|
||||
endif ()
|
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"version": 3,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "default",
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"cacheVariables": {
|
||||
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
10
README.md
10
README.md
@@ -74,7 +74,7 @@ Wayland Window System. Wayland support is currently not fully supported yet, use
|
||||
- [vcpkg](https://learn.microsoft.com/en-us/vcpkg/get_started/get-started?pivots=shell-cmd)
|
||||
|
||||
### Building
|
||||
`cmake -A x64 -DCMAKE_BUILD_TYPE=Release --preset=default /path/to/source`
|
||||
`cmake -A x64 -DCMAKE_BUILD_TYPE=Release /path/to/source`
|
||||
|
||||
### Compiling
|
||||
`cmake --build /path/to/build --config Release`
|
||||
@@ -89,12 +89,10 @@ This will require the terminal to be running in administrator mode.
|
||||
#include <ehs/EHS.h>
|
||||
#include <ehs/io/Console.h>
|
||||
|
||||
ehs::Int_32 Main(ehs::Str_8* appName, ehs::Str_8* appVerId, ehs::Version* appVer)
|
||||
int main()
|
||||
{
|
||||
// Simple identifying meta-data for the logger.
|
||||
*appName = "Simple Example App"; // The application's name
|
||||
*appVerId = "Release"; // The app's version prefix; i.e. Alpha, Beta or Release as an example.
|
||||
*appVer = {1, 0, 0}; // The app's version major, minor and patch number.
|
||||
ehs::Initialize("Simple Example App", "Release", {1, 0, 0});
|
||||
|
||||
ehs::Console::Write_8("How old are you?"); // Write to the console in UTF_8 character encoding.
|
||||
|
||||
@@ -110,6 +108,8 @@ ehs::Int_32 Main(ehs::Str_8* appName, ehs::Str_8* appVerId, ehs::Version* appVer
|
||||
|
||||
ehs::Console::Write("Your age is " + ehs::Str_8::FromNum(age) + "."); // Write the console with the age converted back to string.
|
||||
|
||||
ehs::Uninitialize();
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
@@ -5,20 +5,20 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Base64
|
||||
class EHS_LIB_IO Base64
|
||||
{
|
||||
private:
|
||||
static const char ascii[];
|
||||
|
||||
public:
|
||||
static Str_8 Encode(const Str_8 input);
|
||||
static Str_8 Encode(const Str_8 &input);
|
||||
|
||||
static Str_8 Decode(const Str_8 input);
|
||||
static Str_8 Decode(const Str_8 &input);
|
||||
|
||||
private:
|
||||
static char Find(const char c);
|
||||
static char Find(char c);
|
||||
|
||||
static bool IsBase64(const char c);
|
||||
static bool IsBase64(char c);
|
||||
|
||||
};
|
||||
}
|
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class BaseObj
|
||||
class EHS_LIB_IO BaseObj
|
||||
{
|
||||
private:
|
||||
Type* hierarchy;
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Color3
|
||||
class EHS_LIB_IO Color3
|
||||
{
|
||||
public:
|
||||
float r;
|
||||
@@ -13,13 +13,13 @@ namespace ehs
|
||||
|
||||
Color3();
|
||||
|
||||
Color3(const float scalar);
|
||||
Color3(float scalar);
|
||||
|
||||
Color3(const float r, const float g, const float b);
|
||||
Color3(float r, float g, float b);
|
||||
|
||||
Color3(const Color3& color);
|
||||
|
||||
Color3& operator=(const float scalar);
|
||||
Color3& operator=(float scalar);
|
||||
|
||||
Color3& operator=(const Color3& color);
|
||||
|
||||
@@ -27,9 +27,9 @@ namespace ehs
|
||||
|
||||
bool operator!=(const Color3& color) const;
|
||||
|
||||
float operator[](const UInt_64 i) const;
|
||||
float operator[](UInt_64 i) const;
|
||||
|
||||
float& operator[](const UInt_64 i);
|
||||
float& operator[](UInt_64 i);
|
||||
|
||||
Color3& operator*=(const Color3& color);
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Color4
|
||||
class EHS_LIB_IO Color4
|
||||
{
|
||||
public:
|
||||
float r;
|
||||
@@ -15,15 +15,15 @@ namespace ehs
|
||||
|
||||
Color4();
|
||||
|
||||
Color4(const float scalar);
|
||||
Color4(float scalar);
|
||||
|
||||
explicit Color4(const Color3& color);
|
||||
|
||||
Color4(const float r, const float g, const float b, const float a = 1.0f);
|
||||
Color4(float r, float g, float b, float a = 1.0f);
|
||||
|
||||
Color4(const Color4& color);
|
||||
|
||||
Color4& operator=(const float scalar);
|
||||
Color4& operator=(float scalar);
|
||||
|
||||
Color4& operator=(const Color3& color);
|
||||
|
||||
@@ -33,9 +33,9 @@ namespace ehs
|
||||
|
||||
bool operator!=(const Color4& color) const;
|
||||
|
||||
float operator[](const UInt_64 i) const;
|
||||
float operator[](UInt_64 i) const;
|
||||
|
||||
float& operator[](const UInt_64 i);
|
||||
float& operator[](UInt_64 i);
|
||||
|
||||
Color4& operator*=(const Color4& color);
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Data
|
||||
class EHS_LIB_IO Data
|
||||
{
|
||||
public:
|
||||
template<typename T>
|
||||
|
@@ -21,9 +21,9 @@ namespace ehs
|
||||
UINT_8
|
||||
};
|
||||
|
||||
DataType FromAudioBitDepth(UInt_16 bitDepth);
|
||||
EHS_LIB_IO DataType FromAudioBitDepth(UInt_16 bitDepth);
|
||||
|
||||
UInt_8 ToByteDepth(DataType type);
|
||||
EHS_LIB_IO UInt_8 ToByteDepth(DataType type);
|
||||
|
||||
UInt_8 ToBitDepth(DataType type);
|
||||
EHS_LIB_IO UInt_8 ToBitDepth(DataType type);
|
||||
}
|
@@ -19,45 +19,47 @@ namespace ehs
|
||||
SIZE
|
||||
};
|
||||
|
||||
EHS_LIB_IO void Initialize(Str_8 appName, Str_8 appVerId, const Version &appVer);
|
||||
|
||||
EHS_LIB_IO void Uninitialize();
|
||||
|
||||
/// Retrieves the UTF32 C-style string as "Event Horizon Standard"
|
||||
/// @returns The result.
|
||||
const Char_32* GetName_32();
|
||||
EHS_LIB_IO const Char_32* GetName_32();
|
||||
|
||||
/// Retrieves the UTF16 C-style string as "Event Horizon Standard"
|
||||
/// @returns The result.
|
||||
const Char_16* GetName_16();
|
||||
EHS_LIB_IO const Char_16* GetName_16();
|
||||
|
||||
/// Retrieves the UTF8 C-style string as "Event Horizon Standard"
|
||||
/// @returns The result.
|
||||
const Char_8* GetName_8();
|
||||
EHS_LIB_IO const Char_8* GetName_8();
|
||||
|
||||
Str_8 GetAppName_8();
|
||||
EHS_LIB_IO Str_8 GetAppName_8();
|
||||
|
||||
const Char_32* GetAcronym_32();
|
||||
EHS_LIB_IO const Char_32* GetAcronym_32();
|
||||
|
||||
const Char_16* GetAcronym_16();
|
||||
EHS_LIB_IO const Char_16* GetAcronym_16();
|
||||
|
||||
const Char_8* GetAcronym_8();
|
||||
EHS_LIB_IO const Char_8* GetAcronym_8();
|
||||
|
||||
/// Retrieves the version identifier in UTF32.
|
||||
/// @returns The result.
|
||||
const Char_32* GetVersionId_32();
|
||||
EHS_LIB_IO const Char_32* GetVersionId_32();
|
||||
|
||||
/// Retrieves the version identifier in UTF16.
|
||||
/// @returns The result.
|
||||
const Char_16* GetVersionId_16();
|
||||
EHS_LIB_IO const Char_16* GetVersionId_16();
|
||||
|
||||
/// Retrieves the version identifier in UTF8.
|
||||
/// @returns The result.
|
||||
const Char_8* GetVersionId_8();
|
||||
EHS_LIB_IO const Char_8* GetVersionId_8();
|
||||
|
||||
Str_8 GetAppVersionId_8();
|
||||
EHS_LIB_IO Str_8 GetAppVersionId_8();
|
||||
|
||||
/// Retrieves the current Event Horizon Standard version.
|
||||
/// @returns The result.
|
||||
Version GetVersion();
|
||||
EHS_LIB_IO Version GetVersion();
|
||||
|
||||
Version GetAppVersion();
|
||||
EHS_LIB_IO Version GetAppVersion();
|
||||
};
|
||||
|
||||
extern ehs::SInt_32 Main(ehs::Str_8* appName, ehs::Str_8* appVerId, ehs::Version* appVer);
|
@@ -9,7 +9,7 @@ namespace ehs
|
||||
{
|
||||
typedef bool (*GcLogic)(BaseObj*);
|
||||
|
||||
class GC
|
||||
class EHS_LIB_IO GC
|
||||
{
|
||||
private:
|
||||
static Array<GcLogic> logic;
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class HRNG
|
||||
class EHS_LIB_IO HRNG
|
||||
{
|
||||
public:
|
||||
static UInt_64 GenerateSeed_u64();
|
||||
|
@@ -25,7 +25,7 @@ namespace ehs
|
||||
/// A helper class for holding error information and handling them.
|
||||
/// @tparam T The character data type to use.
|
||||
/// @tparam N The number data type to use.
|
||||
class Log
|
||||
class EHS_LIB_IO Log
|
||||
{
|
||||
private:
|
||||
static void DefaultRaisedCb(const Log &log);
|
||||
|
@@ -120,7 +120,7 @@ namespace ehs
|
||||
|
||||
Mat2<T> GetMinor() const
|
||||
{
|
||||
Mat2<T> result(0);
|
||||
Mat2<T> result;
|
||||
result.data[0] = data[3];
|
||||
result.data[1] = data[2];
|
||||
result.data[2] = data[1];
|
||||
@@ -187,7 +187,7 @@ namespace ehs
|
||||
Mat2<T> GetInverse() const
|
||||
{
|
||||
T det = GetDeterminant();
|
||||
if (Math::ComCmp(det, 0.0f))
|
||||
if (Math::ComCmp(det, 0))
|
||||
return {};
|
||||
|
||||
return GetAdjugate() * (1 / det);
|
||||
@@ -196,7 +196,7 @@ namespace ehs
|
||||
void Inverse()
|
||||
{
|
||||
T det = GetDeterminant();
|
||||
if (Math::ComCmp(det, 0.0f))
|
||||
if (Math::ComCmp(det, 0))
|
||||
return;
|
||||
|
||||
Adjugate();
|
||||
@@ -212,6 +212,9 @@ namespace ehs
|
||||
}
|
||||
};
|
||||
|
||||
template class EHS_LIB_IO Mat2<float>;
|
||||
template class EHS_LIB_IO Mat2<double>;
|
||||
|
||||
typedef Mat2<float> Mat2_f;
|
||||
typedef Mat2<double> Mat2_d;
|
||||
}
|
@@ -50,7 +50,7 @@ namespace ehs
|
||||
Mat2<T> result;
|
||||
|
||||
for (UInt_8 i = 0; i < 4; ++i)
|
||||
result.data[i] = data[i / 2 * 4 + i % 2];
|
||||
result[i] = data[i / 2 * 4 + i % 2];
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -234,7 +234,7 @@ namespace ehs
|
||||
Mat3<T> GetInverse() const
|
||||
{
|
||||
T det = GetDeterminant();
|
||||
if (Math::ComCmp(det, 0.0f))
|
||||
if (Math::ComCmp(det, 0))
|
||||
return {};
|
||||
|
||||
return GetAdjugate() * (1 / det);
|
||||
@@ -243,7 +243,7 @@ namespace ehs
|
||||
void Inverse()
|
||||
{
|
||||
T det = GetDeterminant();
|
||||
if (Math::ComCmp(det, 0.0f))
|
||||
if (Math::ComCmp(det, 0))
|
||||
return;
|
||||
|
||||
Adjugate();
|
||||
@@ -317,6 +317,9 @@ namespace ehs
|
||||
}
|
||||
};
|
||||
|
||||
template class EHS_LIB_IO Mat3<float>;
|
||||
template class EHS_LIB_IO Mat3<double>;
|
||||
|
||||
typedef Mat3<float> Mat3_f;
|
||||
typedef Mat3<double> Mat3_d;
|
||||
}
|
@@ -268,7 +268,7 @@ namespace ehs
|
||||
Mat4<T> GetInverse() const
|
||||
{
|
||||
T det = GetDeterminant();
|
||||
if (Math::ComCmp(det, 0.0f))
|
||||
if (Math::ComCmp(det, 0))
|
||||
return {};
|
||||
|
||||
return GetAdjugate() * (1 / det);
|
||||
@@ -277,7 +277,7 @@ namespace ehs
|
||||
void Inverse()
|
||||
{
|
||||
T det = GetDeterminant();
|
||||
if (Math::ComCmp(det, 0.0f))
|
||||
if (Math::ComCmp(det, 0))
|
||||
return;
|
||||
|
||||
Adjugate();
|
||||
@@ -332,14 +332,14 @@ namespace ehs
|
||||
|
||||
static Mat4<T> YawRotate(const T angle)
|
||||
{
|
||||
T radians = Math::Rads(angle);
|
||||
T radians = Math::Rads<T>(angle);
|
||||
|
||||
Mat4<T> result;
|
||||
result.data[0] = Math::Cos(radians);
|
||||
result.data[2] = -Math::Sin(radians);
|
||||
result.data[0] = Math::Cos<T>(radians);
|
||||
result.data[2] = -Math::Sin<T>(radians);
|
||||
result.data[5] = 1;
|
||||
result.data[8] = Math::Sin(radians);
|
||||
result.data[10] = Math::Cos(radians);
|
||||
result.data[8] = Math::Sin<T>(radians);
|
||||
result.data[10] = Math::Cos<T>(radians);
|
||||
result.data[15] = 1;
|
||||
|
||||
return result;
|
||||
@@ -347,7 +347,7 @@ namespace ehs
|
||||
|
||||
static Mat4<T> RollRotate(const T angle)
|
||||
{
|
||||
T radians = Math::Rads(angle);
|
||||
T radians = Math::Rads<T>(angle);
|
||||
|
||||
Mat4<T> result;
|
||||
result.data[0] = Math::Cos(radians);
|
||||
@@ -367,7 +367,7 @@ namespace ehs
|
||||
|
||||
static Mat4<T> RH_Perspective(const T fov, const T aspect, const T zNear, const T zFar)
|
||||
{
|
||||
const float tanHalfFovy = tan(Math::Rads(fov) / 2.0f);
|
||||
const T tanHalfFovy = Math::Tan<T>(Math::Rads(fov) / 2.0f);
|
||||
|
||||
Mat4<T> result;
|
||||
result[0] = 1.0f / (aspect * tanHalfFovy);
|
||||
@@ -380,7 +380,7 @@ namespace ehs
|
||||
|
||||
static Mat4<T> LH_Perspective(const T fov, const T aspect, const T zNear, const T zFar)
|
||||
{
|
||||
const float tanHalfFovy = Math::Tan(Math::Rads(fov) / 2.0f);
|
||||
const T tanHalfFovy = Math::Tan<T>(Math::Rads(fov) / 2.0f);
|
||||
|
||||
Mat4<T> result;
|
||||
result[0] = 1.0f / (aspect * tanHalfFovy);
|
||||
@@ -421,6 +421,9 @@ namespace ehs
|
||||
}
|
||||
};
|
||||
|
||||
template class EHS_LIB_IO Mat4<float>;
|
||||
template class EHS_LIB_IO Mat4<double>;
|
||||
|
||||
typedef Mat4<float> Mat4_f;
|
||||
typedef Mat4<double> Mat4_d;
|
||||
}
|
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Math
|
||||
class EHS_LIB_IO Math
|
||||
{
|
||||
private:
|
||||
static float Sqrt_AVX(const float from);
|
||||
@@ -26,22 +26,22 @@ namespace ehs
|
||||
constexpr static double dblEpsilon = 1e-16;
|
||||
|
||||
/// Absolute tolerance comparison for single precision floats.
|
||||
static bool AbsCmp(const float a, const float b);
|
||||
static bool AbsCmp(float a, float b);
|
||||
|
||||
/// Absolute tolerance comparison for double precision floats.
|
||||
static bool AbsCmp(const double a, const double b);
|
||||
static bool AbsCmp(double a, double b);
|
||||
|
||||
/// Relative tolerance comparison for single precision floats.
|
||||
static bool RelCmp(const float a, const float b);
|
||||
static bool RelCmp(float a, float b);
|
||||
|
||||
/// Relative tolerance comparison for double precision floats.
|
||||
static bool RelCmp(const double a, const double b);
|
||||
static bool RelCmp(double a, double b);
|
||||
|
||||
/// Combined absolute and relative tolerance comparison for single precision floats.
|
||||
static bool ComCmp(const float a, const float b);
|
||||
static bool ComCmp(float a, float b);
|
||||
|
||||
/// Combined absolute and relative tolerance comparison for double precision floats.
|
||||
static bool ComCmp(const double a, const double b);
|
||||
static bool ComCmp(double a, double b);
|
||||
|
||||
template<typename T = float>
|
||||
static T Max(const T a, const T b)
|
||||
|
@@ -10,9 +10,9 @@ namespace ehs
|
||||
void* data;
|
||||
};
|
||||
|
||||
bool HasPtrData(void* data);
|
||||
EHS_LIB_IO bool HasPtrData(void* data);
|
||||
|
||||
void AddPtrData(void* data);
|
||||
EHS_LIB_IO void AddPtrData(void* data);
|
||||
|
||||
bool RemovePtrData(void* data);
|
||||
EHS_LIB_IO bool RemovePtrData(void* data);
|
||||
}
|
@@ -564,7 +564,7 @@ namespace ehs
|
||||
return;
|
||||
}
|
||||
|
||||
Util::Copy(data[dstOffset], src, src.Size(true));
|
||||
Util::Copy(&data[dstOffset], src, src.Size(true));
|
||||
}
|
||||
|
||||
/// Copies a C-style string to the referenced string object.
|
||||
@@ -580,7 +580,7 @@ namespace ehs
|
||||
return;
|
||||
}
|
||||
|
||||
Util::Copy(data[dstOffset], src, srcSize * sizeof(T));
|
||||
Util::Copy(&data[dstOffset], src, srcSize * sizeof(T));
|
||||
}
|
||||
|
||||
/// Copies a C-style string to the referenced string object.
|
||||
@@ -595,7 +595,7 @@ namespace ehs
|
||||
return;
|
||||
}
|
||||
|
||||
Util::Copy(data[dstOffset], src, srcSize * sizeof(T));
|
||||
Util::Copy(&data[dstOffset], src, srcSize * sizeof(T));
|
||||
}
|
||||
|
||||
/// Inserts a string at a specified index.
|
||||
@@ -747,7 +747,7 @@ namespace ehs
|
||||
|
||||
T* result = new T[size + inSize + 1];
|
||||
Util::Copy(result, data, Size(true));
|
||||
Util::Copy(result[size], value, inSize * sizeof(T));
|
||||
Util::Copy(&result[size], value, inSize * sizeof(T));
|
||||
|
||||
result[size + inSize] = 0;
|
||||
|
||||
@@ -1271,8 +1271,11 @@ namespace ehs
|
||||
/// @note Use "IsNum" before this if the string object is not guaranteed to be a number.
|
||||
float ToFloat() const
|
||||
{
|
||||
Str<T, N> ide;
|
||||
ide.Push(46);
|
||||
|
||||
N decPoint = size;
|
||||
Find(".", &decPoint);
|
||||
Find(ide, &decPoint);
|
||||
|
||||
float result = 0.0f;
|
||||
float fraction = 0.0f;
|
||||
@@ -1297,8 +1300,11 @@ namespace ehs
|
||||
/// @note Use "IsNum" before this if the string object is not guaranteed to be a number.
|
||||
double ToDouble() const
|
||||
{
|
||||
Str<T, N> ide;
|
||||
ide.Push(46);
|
||||
|
||||
N decPoint = size;
|
||||
Find(".", &decPoint);
|
||||
Find(ide, &decPoint);
|
||||
|
||||
double result = 0.0f;
|
||||
double fraction = 0.0f;
|
||||
@@ -1323,8 +1329,11 @@ namespace ehs
|
||||
/// @note Use "IsNum" before this if the string object is not guaranteed to be a number.
|
||||
long double ToLDouble() const
|
||||
{
|
||||
Str<T, N> ide;
|
||||
ide.Push(46);
|
||||
|
||||
N decPoint = size;
|
||||
Find(".", &decPoint);
|
||||
Find(ide, &decPoint);
|
||||
|
||||
long double result = 0.0f;
|
||||
long double fraction = 0.0f;
|
||||
@@ -1679,7 +1688,7 @@ namespace ehs
|
||||
|
||||
Str<T, N> result;
|
||||
if (whole < 0)
|
||||
result += "-";
|
||||
result.Push(45);
|
||||
|
||||
result += Str<T, N>::FromNum(whole);
|
||||
|
||||
@@ -1691,7 +1700,7 @@ namespace ehs
|
||||
if (!fraction)
|
||||
return result;
|
||||
|
||||
result += ".";
|
||||
result.Push(46);
|
||||
|
||||
Str<T, N> fResult(maxDecimals);
|
||||
N i = 0;
|
||||
@@ -1721,7 +1730,7 @@ namespace ehs
|
||||
|
||||
Str<T, N> result;
|
||||
if (whole < 0)
|
||||
result += "-";
|
||||
result.Push(45);
|
||||
|
||||
result += Str<T, N>::FromNum(whole);
|
||||
|
||||
@@ -1733,7 +1742,7 @@ namespace ehs
|
||||
if (!fraction)
|
||||
return result;
|
||||
|
||||
result += ".";
|
||||
result.Push(46);
|
||||
|
||||
Str<T, N> fResult(maxDecimals);
|
||||
N i = 0;
|
||||
@@ -1763,7 +1772,7 @@ namespace ehs
|
||||
|
||||
Str<T, N> result;
|
||||
if (whole < 0)
|
||||
result += "-";
|
||||
result.Push(45);
|
||||
|
||||
result += Str<T, N>::FromNum(whole);
|
||||
|
||||
@@ -1775,7 +1784,7 @@ namespace ehs
|
||||
if (!fraction)
|
||||
return result;
|
||||
|
||||
result += ".";
|
||||
result.Push(46);
|
||||
|
||||
Str<T, N> fResult(maxDecimals);
|
||||
N i = 0;
|
||||
@@ -1870,6 +1879,9 @@ namespace ehs
|
||||
/// @returns The character count.
|
||||
static N Len(const T* const str)
|
||||
{
|
||||
if (!str)
|
||||
return 0;
|
||||
|
||||
N count = 0;
|
||||
while (str[count])
|
||||
++count;
|
||||
@@ -1892,6 +1904,10 @@ namespace ehs
|
||||
}
|
||||
};
|
||||
|
||||
template class EHS_LIB_IO Str<Char_32, UInt_64>;
|
||||
template class EHS_LIB_IO Str<Char_16, UInt_64>;
|
||||
template class EHS_LIB_IO Str<Char_8, UInt_64>;
|
||||
|
||||
typedef Str<Char_32, UInt_64> Str_32;
|
||||
typedef Str<Char_16, UInt_64> Str_16;
|
||||
typedef Str<Char_8, UInt_64> Str_8;
|
||||
|
@@ -9,7 +9,7 @@ namespace ehs
|
||||
{
|
||||
typedef void (*TaskCb)(Serializer<UInt_64>*);
|
||||
|
||||
class Task
|
||||
class EHS_LIB_IO Task
|
||||
{
|
||||
private:
|
||||
bool working;
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Type
|
||||
class EHS_LIB_IO Type
|
||||
{
|
||||
private:
|
||||
friend class BaseObj;
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class URI
|
||||
class EHS_LIB_IO URI
|
||||
{
|
||||
public:
|
||||
/// Encodes specialized characters in the URI.
|
||||
|
@@ -13,7 +13,7 @@ namespace ehs
|
||||
};
|
||||
|
||||
/// A helper class for converting between UTF8, 16 and 32.
|
||||
class UTF
|
||||
class EHS_LIB_IO UTF
|
||||
{
|
||||
public:
|
||||
/// Converts the given UTF16 C-style string into UTF32.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Util
|
||||
class EHS_LIB_IO Util
|
||||
{
|
||||
public:
|
||||
static bool Compare(const void* a, const void* b, UInt_64 size);
|
||||
|
@@ -5,7 +5,7 @@
|
||||
namespace ehs
|
||||
{
|
||||
/// A helper class for storing version major, minor and patch.
|
||||
class Version
|
||||
class EHS_LIB_IO Version
|
||||
{
|
||||
public:
|
||||
UInt_32 major;
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Database
|
||||
class EHS_LIB_IO Database
|
||||
{
|
||||
private:
|
||||
UInt_64 hashId;
|
||||
|
@@ -7,7 +7,7 @@ namespace ehs
|
||||
{
|
||||
class DbTable;
|
||||
|
||||
class DbObject
|
||||
class EHS_LIB_IO DbObject
|
||||
{
|
||||
private:
|
||||
friend class DbTable;
|
||||
|
@@ -10,7 +10,7 @@ namespace ehs
|
||||
{
|
||||
class Database;
|
||||
|
||||
class DbTable
|
||||
class EHS_LIB_IO DbTable
|
||||
{
|
||||
private:
|
||||
friend class Database;
|
||||
|
@@ -8,7 +8,7 @@ namespace ehs
|
||||
class DbVarTmpl;
|
||||
class DbObject;
|
||||
|
||||
class DbVar
|
||||
class EHS_LIB_IO DbVar
|
||||
{
|
||||
private:
|
||||
friend class DbObject;
|
||||
|
@@ -8,7 +8,7 @@ namespace ehs
|
||||
{
|
||||
class DbVar;
|
||||
|
||||
class DbVarTmpl
|
||||
class EHS_LIB_IO DbVarTmpl
|
||||
{
|
||||
private:
|
||||
friend class DbTable;
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class BaseDirectory
|
||||
class EHS_LIB_IO BaseDirectory
|
||||
{
|
||||
public:
|
||||
static Array<Str_8> GetAllFiles(const Str_8 &dir);
|
||||
|
@@ -25,7 +25,7 @@ namespace ehs
|
||||
};
|
||||
|
||||
/// A cross-platform wrapper class that handles native file input/output.
|
||||
class BaseFile
|
||||
class EHS_LIB_IO BaseFile
|
||||
{
|
||||
protected:
|
||||
Str_8 path;
|
||||
|
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class BaseFileMonitor
|
||||
class EHS_LIB_IO BaseFileMonitor
|
||||
{
|
||||
protected:
|
||||
Str_8 filePath;
|
||||
|
@@ -18,7 +18,7 @@ namespace ehs
|
||||
I_BEAM
|
||||
};
|
||||
|
||||
class BaseWindow
|
||||
class EHS_LIB_IO BaseWindow
|
||||
{
|
||||
protected:
|
||||
bool created;
|
||||
|
@@ -20,7 +20,7 @@ namespace ehs
|
||||
TWO
|
||||
};
|
||||
|
||||
class COM
|
||||
class EHS_LIB_IO COM
|
||||
{
|
||||
private:
|
||||
UInt_8 port;
|
||||
|
@@ -12,7 +12,7 @@ namespace ehs
|
||||
typedef int ConsoleHdl;
|
||||
#endif
|
||||
|
||||
class Console
|
||||
class EHS_LIB_IO Console
|
||||
{
|
||||
private:
|
||||
static ConsoleHdl hdlOut;
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Directory : public BaseDirectory
|
||||
class EHS_LIB_IO Directory : public BaseDirectory
|
||||
{
|
||||
public:
|
||||
static Array<Str_8> GetAllFiles(const Str_8 &dir);
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Directory : public BaseDirectory
|
||||
class EHS_LIB_IO Directory : public BaseDirectory
|
||||
{
|
||||
public:
|
||||
static Array<Str_8> GetAllFiles(const Str_8 &dir);
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class FileMonitor : public BaseFileMonitor
|
||||
class EHS_LIB_IO FileMonitor : public BaseFileMonitor
|
||||
{
|
||||
private:
|
||||
int hdl;
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class FileMonitor final : public BaseFileMonitor
|
||||
class EHS_LIB_IO FileMonitor final : public BaseFileMonitor
|
||||
{
|
||||
private:
|
||||
Handle hdl;
|
||||
|
@@ -10,7 +10,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class File : public BaseFile
|
||||
class EHS_LIB_IO File : public BaseFile
|
||||
{
|
||||
private:
|
||||
int hdl;
|
||||
|
@@ -10,7 +10,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class File : public BaseFile
|
||||
class EHS_LIB_IO File : public BaseFile
|
||||
{
|
||||
private:
|
||||
HANDLE hdl;
|
||||
|
@@ -10,7 +10,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class FontAtlas : public BaseObj
|
||||
class EHS_LIB_IO FontAtlas : public BaseObj
|
||||
{
|
||||
private:
|
||||
UInt_64 hashId;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Glyph
|
||||
class EHS_LIB_IO Glyph
|
||||
{
|
||||
private:
|
||||
Char_32 code;
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class RIFF
|
||||
class EHS_LIB_IO RIFF
|
||||
{
|
||||
private:
|
||||
Str_8 type;
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class RIFF_Chunk
|
||||
class EHS_LIB_IO RIFF_Chunk
|
||||
{
|
||||
private:
|
||||
Str_8 id;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Resource : public BaseObj
|
||||
class EHS_LIB_IO Resource : public BaseObj
|
||||
{
|
||||
private:
|
||||
ehs::UInt_64 hashId;
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class UsbBase
|
||||
class EHS_LIB_IO UsbBase
|
||||
{
|
||||
private:
|
||||
UInt_32 bus;
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Usb final : public UsbBase
|
||||
class EHS_LIB_IO Usb final : public UsbBase
|
||||
{
|
||||
private:
|
||||
int hdl;
|
||||
|
@@ -14,7 +14,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Window : public BaseWindow
|
||||
class EHS_LIB_IO Window : public BaseWindow
|
||||
{
|
||||
private:
|
||||
UInt_32 owner;
|
||||
@@ -71,13 +71,6 @@ namespace ehs
|
||||
|
||||
void SetIcon(const Str_8& filePath);
|
||||
|
||||
/// Sets the windows client scale.
|
||||
/// @param [in] w The width in pixels.
|
||||
/// @param [in] h The height in pixels.
|
||||
void SetClientSize(const Vec2<UInt_32>& size);
|
||||
|
||||
Vec2<UInt_32> GetClientSize();
|
||||
|
||||
/// Gets the windows native handle for the operating system or other native tasks.
|
||||
/// @returns The window's native handle.
|
||||
HWND GetHdl() const;
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Window : public BaseWindow
|
||||
class EHS_LIB_IO Window : public BaseWindow
|
||||
{
|
||||
protected:
|
||||
wl_display *display;
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Window : public BaseWindow
|
||||
class EHS_LIB_IO Window : public BaseWindow
|
||||
{
|
||||
protected:
|
||||
friend class Input;
|
||||
|
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Audio : public Resource
|
||||
class EHS_LIB_IO Audio : public Resource
|
||||
{
|
||||
private:
|
||||
static Array<AudioCodec> codecs;
|
||||
|
@@ -8,7 +8,7 @@ namespace ehs
|
||||
{
|
||||
class Audio;
|
||||
|
||||
class AudioCodec
|
||||
class EHS_LIB_IO AudioCodec
|
||||
{
|
||||
private:
|
||||
Str_8 id;
|
||||
|
@@ -5,5 +5,5 @@
|
||||
#if defined(EHS_OS_WINDOWS)
|
||||
#include "AudioDevice_W32.h"
|
||||
#elif defined(EHS_OS_LINUX)
|
||||
#include "AudioDevice_ALSA.h"
|
||||
#include "AudioDevice_PW.h"
|
||||
#endif
|
@@ -1,46 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "ehs/EHS.h"
|
||||
#include "BaseAudioDevice.h"
|
||||
|
||||
#include <alsa/asoundlib.h>
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class AudioDevice : public BaseAudioDevice
|
||||
{
|
||||
private:
|
||||
snd_pcm_t* hdl;
|
||||
|
||||
public:
|
||||
~AudioDevice() override;
|
||||
|
||||
AudioDevice();
|
||||
|
||||
AudioDevice(AudioDevice&& device) noexcept;
|
||||
|
||||
AudioDevice(const AudioDevice& device);
|
||||
|
||||
AudioDevice& operator=(AudioDevice&& device) noexcept;
|
||||
|
||||
AudioDevice& operator=(const AudioDevice& device);
|
||||
|
||||
void Release() override;
|
||||
|
||||
void OpenStream() override;
|
||||
|
||||
void CloseStream() override;
|
||||
|
||||
UInt_64 GetAvailFrames() const override;
|
||||
|
||||
Byte* Map(UInt_64* offset, UInt_64* frames) override;
|
||||
|
||||
void UnMap(const UInt_64 offset, const UInt_64 frames) override;
|
||||
|
||||
bool IsValid() const override;
|
||||
|
||||
static AudioDevice GetDefault(const AudioDeviceType type);
|
||||
|
||||
static Array<AudioDevice> Get(const AudioDeviceType type, const AudioDeviceState state);
|
||||
};
|
||||
}
|
67
include/ehs/io/audio/AudioDevice_PW.h
Normal file
67
include/ehs/io/audio/AudioDevice_PW.h
Normal file
@@ -0,0 +1,67 @@
|
||||
#pragma once
|
||||
|
||||
#include "ehs/EHS.h"
|
||||
#include "BaseAudioDevice.h"
|
||||
|
||||
#include <pipewire/pipewire.h>
|
||||
#include <pipewire/loop.h>
|
||||
#include <pipewire/context.h>
|
||||
#include <pipewire/stream.h>
|
||||
#include <spa/param/audio/format-utils.h>
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class EHS_LIB_IO AudioDevice final : public BaseAudioDevice
|
||||
{
|
||||
private:
|
||||
static Array<AudioDevice> devices;
|
||||
static AudioDevice defOut;
|
||||
static AudioDevice defIn;
|
||||
|
||||
UInt_32 id;
|
||||
Str_8 name;
|
||||
pw_loop *loop;
|
||||
pw_context *context;
|
||||
pw_core *core;
|
||||
pw_stream *input;
|
||||
pw_stream *output;
|
||||
|
||||
static void RegistryEventGlobal(void *data, UInt_32 id, UInt_32 permissions, const char *type, UInt_32 version, const spa_dict *props);
|
||||
|
||||
static void RegistryEventGlobalRemove(void *data, UInt_32 id);
|
||||
|
||||
static void OnParamChanged(void *data, UInt_32 id, const spa_pod *param);
|
||||
|
||||
public:
|
||||
~AudioDevice() override;
|
||||
|
||||
AudioDevice();
|
||||
|
||||
AudioDevice(AudioDevice&& device) noexcept;
|
||||
|
||||
AudioDevice(const AudioDevice& device);
|
||||
|
||||
AudioDevice& operator=(AudioDevice&& device) noexcept;
|
||||
|
||||
AudioDevice& operator=(const AudioDevice& device);
|
||||
|
||||
void OpenStream() override;
|
||||
|
||||
void CloseStream() override;
|
||||
|
||||
UInt_64 SendStream(const void *data, UInt_64 size) override;
|
||||
|
||||
UInt_64 ReceiveStream(void *data, UInt_64 size) override;
|
||||
|
||||
bool IsStreaming() const override;
|
||||
|
||||
bool IsValid() const override;
|
||||
|
||||
static AudioDevice GetDefault(AudioDeviceType type);
|
||||
|
||||
static Array<AudioDevice> Get(AudioDeviceType type, AudioDeviceState state);
|
||||
|
||||
private:
|
||||
Str_8 GetCategory() const;
|
||||
};
|
||||
}
|
@@ -12,7 +12,7 @@ struct IMMDevice;
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class AudioDevice : public BaseAudioDevice
|
||||
class EHS_LIB_IO AudioDevice final : public BaseAudioDevice
|
||||
{
|
||||
private:
|
||||
IMMDevice* hdl;
|
||||
@@ -33,17 +33,13 @@ namespace ehs
|
||||
|
||||
AudioDevice& operator=(const AudioDevice& device);
|
||||
|
||||
void Release() override;
|
||||
|
||||
void OpenStream() override;
|
||||
|
||||
void CloseStream() override;
|
||||
|
||||
UInt_64 GetAvailFrames() const override;
|
||||
UInt_64 SendStream(const void *data, UInt_64 outFrameSize) override;
|
||||
|
||||
Byte* Map(UInt_64* offset, UInt_64* frames) override;
|
||||
|
||||
void UnMap(const UInt_64 offset, const UInt_64 frames) override;
|
||||
UInt_64 ReceiveStream(void *data, UInt_64 inFrameSize) override;
|
||||
|
||||
Str_32 GetInterfaceName_32() const;
|
||||
|
||||
@@ -57,10 +53,12 @@ namespace ehs
|
||||
|
||||
Str_8 GetName_8() const;
|
||||
|
||||
bool IsStreaming() const override;
|
||||
|
||||
bool IsValid() const override;
|
||||
|
||||
static AudioDevice GetDefault(const AudioDeviceType type);
|
||||
static AudioDevice GetDefault(AudioDeviceType type);
|
||||
|
||||
static Array<AudioDevice> Get(const AudioDeviceType type, const AudioDeviceState state);
|
||||
static Array<AudioDevice> Get(AudioDeviceType type, AudioDeviceState state);
|
||||
};
|
||||
}
|
||||
|
@@ -10,8 +10,8 @@ namespace ehs
|
||||
{
|
||||
enum class AudioDeviceType
|
||||
{
|
||||
OUTPUT = 0x0,
|
||||
INPUT = 0x1,
|
||||
OUTPUT = 0x0,
|
||||
ALL = 0x2
|
||||
};
|
||||
|
||||
@@ -23,18 +23,17 @@ namespace ehs
|
||||
UNPLUGGED = 0x8
|
||||
};
|
||||
|
||||
class BaseAudioDevice
|
||||
class EHS_LIB_IO BaseAudioDevice
|
||||
{
|
||||
protected:
|
||||
AudioDeviceType type;
|
||||
DataType dataType;
|
||||
UInt_16 bitDepth;
|
||||
UInt_16 byteDepth;
|
||||
UInt_32 sampleRate;
|
||||
UInt_32 channels;
|
||||
UInt_32 period;
|
||||
UInt_32 latency;
|
||||
UInt_64 maxFrames;
|
||||
bool streaming;
|
||||
|
||||
public:
|
||||
virtual ~BaseAudioDevice() = default;
|
||||
@@ -45,21 +44,19 @@ namespace ehs
|
||||
|
||||
BaseAudioDevice& operator=(const BaseAudioDevice& device);
|
||||
|
||||
virtual void Release();
|
||||
|
||||
virtual void OpenStream();
|
||||
|
||||
virtual void CloseStream();
|
||||
|
||||
virtual UInt_64 GetAvailFrames() const;
|
||||
virtual UInt_64 SendStream(const void *data, UInt_64 size);
|
||||
|
||||
virtual Byte* Map(UInt_64* offset, UInt_64* frames);
|
||||
virtual UInt_64 ReceiveStream(void *data, UInt_64 size);
|
||||
|
||||
virtual void UnMap(const UInt_64 offset, const UInt_64 frames);
|
||||
void BridgeStreams(UInt_64 bufferSize);
|
||||
|
||||
AudioDeviceType GetType() const;
|
||||
|
||||
void SetDataType(const DataType newDataType);
|
||||
void SetDataType(DataType newDataType);
|
||||
|
||||
DataType GetDataType() const;
|
||||
|
||||
@@ -67,39 +64,39 @@ namespace ehs
|
||||
|
||||
UInt_16 GetBitDepth() const;
|
||||
|
||||
void SetSampleRate(const UInt_32 newSampleRate);
|
||||
void SetSampleRate(UInt_32 newSampleRate);
|
||||
|
||||
UInt_32 GetSampleRate() const;
|
||||
|
||||
void SetChannels(const UInt_32 newChannels);
|
||||
void SetChannels(UInt_32 newChannels);
|
||||
|
||||
UInt_16 GetChannels() const;
|
||||
|
||||
UInt_32 GetFrameSize() const;
|
||||
|
||||
void SetPeriod(const UInt_32 newPeriod);
|
||||
void SetPeriod(UInt_32 newPeriod);
|
||||
|
||||
UInt_32 GetPeriod() const;
|
||||
|
||||
void SetLatency(const UInt_32 newLatency);
|
||||
void SetLatency(UInt_32 newLatency);
|
||||
|
||||
UInt_32 GetLatency() const;
|
||||
|
||||
UInt_64 GetMaxFrames() const;
|
||||
|
||||
bool IsStreaming() const;
|
||||
virtual bool IsStreaming() const;
|
||||
|
||||
virtual bool IsValid() const;
|
||||
|
||||
/// Retrieves the default audio input/output device.
|
||||
/// @param [in] type The audio device type to retrieve.
|
||||
/// @param [out] device The default audio device.
|
||||
static BaseAudioDevice GetDefault(const AudioDeviceType type);
|
||||
static BaseAudioDevice GetDefault(AudioDeviceType type);
|
||||
|
||||
/// Retrieves a list of audio input/output devices.
|
||||
/// @param [in] type The audio device type to retrieve.
|
||||
/// @param [in] state The audio device state to retrieve.
|
||||
/// @param [out] devices The list of audio devices.
|
||||
static Array<BaseAudioDevice> Get(const AudioDeviceType type, const AudioDeviceState state);
|
||||
static Array<BaseAudioDevice> Get(AudioDeviceType type, AudioDeviceState state);
|
||||
};
|
||||
}
|
@@ -5,27 +5,33 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Button
|
||||
class EHS_LIB_IO Button
|
||||
{
|
||||
private:
|
||||
Str_8 name;
|
||||
UInt_32 hash;
|
||||
Str_8 name;
|
||||
|
||||
public:
|
||||
Button();
|
||||
|
||||
Button(const Str_8& name);
|
||||
Button(Str_8 name);
|
||||
|
||||
Button(Button &&key) noexcept;
|
||||
|
||||
Button(const Button &key);
|
||||
|
||||
Button &operator=(Button &&key) noexcept;
|
||||
|
||||
Button &operator=(const Button &key);
|
||||
|
||||
bool operator==(const Button &key) const;
|
||||
|
||||
bool operator!=(const Button &key) const;
|
||||
|
||||
UInt_32 GetHash() const;
|
||||
|
||||
Str_8 GetName() const;
|
||||
|
||||
UInt_32 GetHash() const;
|
||||
bool IsValid() const;
|
||||
};
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@ namespace ehs
|
||||
TOUCHED
|
||||
};
|
||||
|
||||
class ButtonState
|
||||
class EHS_LIB_IO ButtonState
|
||||
{
|
||||
private:
|
||||
Button button;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class HID
|
||||
class EHS_LIB_IO HID
|
||||
{
|
||||
protected:
|
||||
UInt_8 type;
|
||||
@@ -15,11 +15,15 @@ namespace ehs
|
||||
Str_8 name;
|
||||
UInt_64 id;
|
||||
Array<ButtonState> states;
|
||||
Button lastState;
|
||||
float heldTime;
|
||||
float activateTime;
|
||||
bool active;
|
||||
|
||||
public:
|
||||
HID();
|
||||
|
||||
HID(const UInt_8 type, Str_8 name, const UInt_64 id);
|
||||
HID(UInt_8 type, Str_8 name, UInt_64 id);
|
||||
|
||||
HID(HID&& hid) noexcept;
|
||||
|
||||
@@ -33,11 +37,11 @@ namespace ehs
|
||||
|
||||
bool operator!=(const HID& other) const;
|
||||
|
||||
bool operator==(const UInt_64 otherId) const;
|
||||
bool operator==(UInt_64 otherId) const;
|
||||
|
||||
bool operator!=(const UInt_64 otherId) const;
|
||||
bool operator!=(UInt_64 otherId) const;
|
||||
|
||||
virtual void Poll();
|
||||
virtual void Poll(float delta);
|
||||
|
||||
UInt_8 GetType() const;
|
||||
|
||||
@@ -71,6 +75,10 @@ namespace ehs
|
||||
|
||||
const ButtonState* IsUp() const;
|
||||
|
||||
const ButtonState *IsPressed(const Button &button);
|
||||
|
||||
const ButtonState *GetPressed();
|
||||
|
||||
void ButtonDown(const Button& button);
|
||||
|
||||
void ButtonUp(const Button& button);
|
||||
@@ -87,5 +95,11 @@ namespace ehs
|
||||
bool AddState(const ButtonState& state);
|
||||
|
||||
ButtonState* GetState(const Button& button);
|
||||
|
||||
bool TickHoldTime(float delta);
|
||||
|
||||
void ResetTime();
|
||||
|
||||
void TickActivateTime(float delta);
|
||||
};
|
||||
}
|
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Input
|
||||
class EHS_LIB_IO Input
|
||||
{
|
||||
private:
|
||||
Array<InputHandler*> handlers;
|
||||
|
@@ -5,11 +5,13 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class InputHandler
|
||||
class EHS_LIB_IO InputHandler
|
||||
{
|
||||
private:
|
||||
UInt_64 hashId;
|
||||
Str_8 id;
|
||||
UInt_64 start;
|
||||
UInt_64 delta;
|
||||
|
||||
protected:
|
||||
Array<HID*> devices;
|
||||
@@ -29,9 +31,9 @@ namespace ehs
|
||||
|
||||
InputHandler& operator=(const InputHandler& ih);
|
||||
|
||||
bool operator==(const UInt_64 otherHashId);
|
||||
bool operator==(const UInt_64 otherHashId) const;
|
||||
|
||||
bool operator!=(const UInt_64 otherHashId);
|
||||
bool operator!=(const UInt_64 otherHashId) const;
|
||||
|
||||
virtual bool Initialize();
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Keyboard : public HID
|
||||
class EHS_LIB_IO Keyboard : public HID
|
||||
{
|
||||
public:
|
||||
Keyboard();
|
||||
@@ -23,7 +23,7 @@ namespace ehs
|
||||
|
||||
Keyboard& operator=(const Keyboard& hid);
|
||||
|
||||
void Poll() override;
|
||||
void Poll(float delta) override;
|
||||
|
||||
Keyboard* Clone() const override;
|
||||
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Mouse : public HID
|
||||
class EHS_LIB_IO Mouse : public HID
|
||||
{
|
||||
private:
|
||||
friend class Input;
|
||||
@@ -19,7 +19,7 @@ namespace ehs
|
||||
public:
|
||||
Mouse();
|
||||
|
||||
Mouse(Str_8 name, const UInt_64 id);
|
||||
Mouse(Str_8 name, UInt_64 id);
|
||||
|
||||
Mouse(Mouse&& hid) noexcept = default;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace ehs
|
||||
|
||||
Mouse& operator=(const Mouse& hid);
|
||||
|
||||
void Poll() override;
|
||||
void Poll(float delta) override;
|
||||
|
||||
void SetDelta(const Vec2_s32& newDelta);
|
||||
|
||||
|
@@ -13,7 +13,7 @@ namespace ehs
|
||||
NEAREST_NEIGHBOR
|
||||
};
|
||||
|
||||
class Img : public BaseObj
|
||||
class EHS_LIB_IO Img : public BaseObj
|
||||
{
|
||||
private:
|
||||
static Array<ImgCodec> codecs;
|
||||
|
@@ -12,7 +12,7 @@ namespace ehs
|
||||
typedef bool (*EncodeImgCb)(const ImgCodec* const, Serializer<UInt_64>&, const Img*);
|
||||
typedef bool (*DecodeImgCb)(const ImgCodec* const, Serializer<UInt_64>&, Img*);
|
||||
|
||||
class ImgCodec
|
||||
class EHS_LIB_IO ImgCodec
|
||||
{
|
||||
private:
|
||||
Str_8 id;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class PNG
|
||||
class EHS_LIB_IO PNG
|
||||
{
|
||||
private:
|
||||
Str_8 id;
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class PNG_Chunk
|
||||
class EHS_LIB_IO PNG_Chunk
|
||||
{
|
||||
private:
|
||||
Str_8 id;
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class AnimBone
|
||||
class EHS_LIB_IO AnimBone
|
||||
{
|
||||
private:
|
||||
UInt_8 boneId;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Animation
|
||||
class EHS_LIB_IO Animation
|
||||
{
|
||||
private:
|
||||
UInt_64 hashId;
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Bone
|
||||
class EHS_LIB_IO Bone
|
||||
{
|
||||
private:
|
||||
UInt_64 hashName;
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class KeyFrame
|
||||
class EHS_LIB_IO KeyFrame
|
||||
{
|
||||
private:
|
||||
float num;
|
||||
|
@@ -15,7 +15,7 @@ namespace ehs
|
||||
EHM
|
||||
};
|
||||
|
||||
class Mdl : public BaseObj
|
||||
class EHS_LIB_IO Mdl : public BaseObj
|
||||
{
|
||||
private:
|
||||
static Array<MdlCodec> codecs;
|
||||
|
@@ -12,7 +12,7 @@ namespace ehs
|
||||
typedef bool (*EnocdeMdlCb)(const MdlCodec*, Serializer<UInt_64>&, const Mdl*);
|
||||
typedef bool (*DecodeMdlCb)(const MdlCodec*, Serializer<UInt_64>&, Mdl*);
|
||||
|
||||
class MdlCodec
|
||||
class EHS_LIB_IO MdlCodec
|
||||
{
|
||||
private:
|
||||
Str_8 id;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Mesh final : public BaseObj
|
||||
class EHS_LIB_IO Mesh final : public BaseObj
|
||||
{
|
||||
protected:
|
||||
UInt_64 hashId;
|
||||
|
@@ -19,7 +19,7 @@ namespace ehs
|
||||
INVALID
|
||||
};
|
||||
|
||||
class PropertyChange
|
||||
class EHS_LIB_IO PropertyChange
|
||||
{
|
||||
public:
|
||||
ChangeType type;
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class BaseDNS
|
||||
class EHS_LIB_IO BaseDNS
|
||||
{
|
||||
public:
|
||||
static Str_8 Resolve(AddrType type, const Str_8 &hostname);
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class BaseTCP
|
||||
class EHS_LIB_IO BaseTCP
|
||||
{
|
||||
protected:
|
||||
AddrType addrType;
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class BaseUDP
|
||||
class EHS_LIB_IO BaseUDP
|
||||
{
|
||||
protected:
|
||||
AddrType type;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class DNS final : public BaseDNS
|
||||
class EHS_LIB_IO DNS final : public BaseDNS
|
||||
{
|
||||
public:
|
||||
static Str_8 Resolve(AddrType type, const Str_8 &hostname);
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class DNS final : public BaseDNS
|
||||
class EHS_LIB_IO DNS final : public BaseDNS
|
||||
{
|
||||
public:
|
||||
static Str_8 Resolve(AddrType type, const Str_8 &hostname);
|
||||
|
@@ -16,7 +16,7 @@ namespace ehs
|
||||
DEL
|
||||
};
|
||||
|
||||
class Request
|
||||
class EHS_LIB_IO Request
|
||||
{
|
||||
private:
|
||||
Verb verb;
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Response
|
||||
class EHS_LIB_IO Response
|
||||
{
|
||||
private:
|
||||
UInt_32 code;
|
||||
|
@@ -12,7 +12,7 @@ typedef struct ssl_st SSL;
|
||||
namespace ehs
|
||||
{
|
||||
/// A class for handling the HTTP(S) TCP socket layer.
|
||||
class SSL : public TCP
|
||||
class EHS_LIB_IO SSL : public TCP
|
||||
{
|
||||
private:
|
||||
SSL_CTX* ctx;
|
||||
|
@@ -10,7 +10,7 @@
|
||||
namespace ehs
|
||||
{
|
||||
/// A wrapper class for the transmission control protocol socket.
|
||||
class TCP : public BaseTCP
|
||||
class EHS_LIB_IO TCP : public BaseTCP
|
||||
{
|
||||
protected:
|
||||
Socket hdl;
|
||||
|
@@ -10,7 +10,7 @@
|
||||
namespace ehs
|
||||
{
|
||||
/// A wrapper class for the transmission control protocol socket.
|
||||
class TCP : public BaseTCP
|
||||
class EHS_LIB_IO TCP : public BaseTCP
|
||||
{
|
||||
protected:
|
||||
Socket hdl;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
namespace ehs
|
||||
{
|
||||
/// A wrapper class for the user datagram protocol socket.
|
||||
class UDP : public BaseUDP
|
||||
class EHS_LIB_IO UDP : public BaseUDP
|
||||
{
|
||||
private:
|
||||
Socket hdl;
|
||||
|
@@ -7,7 +7,7 @@
|
||||
namespace ehs
|
||||
{
|
||||
/// A wrapper class for the user datagram protocol socket.
|
||||
class UDP : public BaseUDP
|
||||
class EHS_LIB_IO UDP : public BaseUDP
|
||||
{
|
||||
private:
|
||||
Socket hdl;
|
||||
|
@@ -21,7 +21,7 @@ namespace ehs
|
||||
Str_8 id;
|
||||
};
|
||||
|
||||
class Spotify final
|
||||
class EHS_LIB_IO Spotify final
|
||||
{
|
||||
private:
|
||||
SSL client;
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Twitch
|
||||
class EHS_LIB_IO Twitch
|
||||
{
|
||||
private:
|
||||
SSL client;
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class TwitchChat
|
||||
class EHS_LIB_IO TwitchChat
|
||||
{
|
||||
private:
|
||||
TCP client;
|
||||
|
@@ -12,13 +12,13 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class Json
|
||||
class EHS_LIB_IO Json final
|
||||
{
|
||||
private:
|
||||
JsonBase *value;
|
||||
|
||||
public:
|
||||
virtual ~Json();
|
||||
~Json();
|
||||
|
||||
Json();
|
||||
|
||||
@@ -34,9 +34,9 @@ namespace ehs
|
||||
|
||||
Json(const JsonStr &value);
|
||||
|
||||
Json(const char* data, const UInt_64 size, const UInt_64 extra);
|
||||
Json(const char *data, UInt_64 size, UInt_64 extra);
|
||||
|
||||
Json(const Str_8& data, const UInt_64 extra);
|
||||
Json(const Str_8 &data, UInt_64 extra);
|
||||
|
||||
Json(Json &&json) noexcept;
|
||||
|
||||
@@ -50,19 +50,19 @@ namespace ehs
|
||||
|
||||
JsonBase *RetrieveValue(const Str_8 &access);
|
||||
|
||||
Str_8 ToStr(const bool compact) const;
|
||||
Str_8 ToStr(bool compact) const;
|
||||
|
||||
private:
|
||||
static Vector<Str_8> ParseAccess(const Str_8 &access);
|
||||
|
||||
void ParseValue(JsonVar* var, const Char_8** begin, const Char_8* end, const UInt_64 extra);
|
||||
void ParseValue(JsonVar *var, const Char_8 **begin, const Char_8 *end, UInt_64 extra);
|
||||
|
||||
JsonVar ParseVar(const Char_8** begin, const Char_8* end, const UInt_64 extra);
|
||||
JsonVar ParseVar(const Char_8 **begin, const Char_8 *end, UInt_64 extra);
|
||||
|
||||
void ParseObject(JsonObj* obj, const Char_8** begin, const Char_8* end, const UInt_64 extra);
|
||||
void ParseObject(JsonObj *obj, const Char_8 **begin, const Char_8 *end, UInt_64 extra);
|
||||
|
||||
void ParseArray(JsonArray* arr, const Char_8** begin, const Char_8* end, const UInt_64 extra);
|
||||
void ParseArray(JsonArray *arr, const Char_8 **begin, const Char_8 *end, UInt_64 extra);
|
||||
|
||||
void Parse(const Str_8& data, const UInt_64 extra);
|
||||
void Parse(const Str_8 &data, UInt_64 extra);
|
||||
};
|
||||
}
|
@@ -11,7 +11,7 @@ namespace ehs
|
||||
class JsonNum;
|
||||
class JsonStr;
|
||||
|
||||
class JsonArray : public JsonBase
|
||||
class EHS_LIB_IO JsonArray : public JsonBase
|
||||
{
|
||||
private:
|
||||
UInt_64 size;
|
||||
@@ -20,13 +20,13 @@ namespace ehs
|
||||
JsonBase** data;
|
||||
|
||||
public:
|
||||
virtual ~JsonArray();
|
||||
~JsonArray() override;
|
||||
|
||||
JsonArray();
|
||||
|
||||
JsonArray(const UInt_64 extra);
|
||||
JsonArray(UInt_64 extra);
|
||||
|
||||
JsonArray(const UInt_64 size, const UInt_64 extra);
|
||||
JsonArray(UInt_64 size, UInt_64 extra);
|
||||
|
||||
JsonArray(JsonArray&& ja) noexcept;
|
||||
|
||||
@@ -46,9 +46,9 @@ namespace ehs
|
||||
|
||||
UInt_64 Size() const;
|
||||
|
||||
void Insert(const UInt_64 index, const JsonBase* const value);
|
||||
void Insert(UInt_64 index, const JsonBase* value);
|
||||
|
||||
void Push(const JsonBase* const value);
|
||||
void Push(const JsonBase* value);
|
||||
|
||||
void Push(const JsonBase& value);
|
||||
|
||||
@@ -58,20 +58,20 @@ namespace ehs
|
||||
|
||||
void Push(const JsonBool& value);
|
||||
|
||||
void Push(const bool value);
|
||||
void Push(bool value);
|
||||
|
||||
void Push(const JsonNum& value);
|
||||
|
||||
void Push(const float value);
|
||||
void Push(float value);
|
||||
|
||||
void Push(const JsonStr& value);
|
||||
|
||||
void Push(const Char_8* value, const UInt_64 size = 0);
|
||||
void Push(const Char_8* value, UInt_64 size = 0);
|
||||
|
||||
void Push(const Str_8& value);
|
||||
|
||||
void Pop();
|
||||
|
||||
Str_8 ToStr(const UInt_64 level, const bool compact) const;
|
||||
Str_8 ToStr(UInt_64 level, bool compact) const override;
|
||||
};
|
||||
}
|
@@ -15,20 +15,22 @@ namespace ehs
|
||||
STR
|
||||
};
|
||||
|
||||
class JsonBase
|
||||
class EHS_LIB_IO JsonBase
|
||||
{
|
||||
private:
|
||||
JsonType type;
|
||||
|
||||
public:
|
||||
virtual ~JsonBase() = default;
|
||||
|
||||
JsonBase();
|
||||
|
||||
JsonBase(const JsonType type);
|
||||
JsonBase(JsonType type);
|
||||
|
||||
JsonBase(const JsonBase& base) = default;
|
||||
|
||||
JsonType GetType() const;
|
||||
|
||||
virtual Str_8 ToStr(const UInt_64 level, const bool compact) const;
|
||||
virtual Str_8 ToStr(UInt_64 level, bool compact) const;
|
||||
};
|
||||
}
|
@@ -7,14 +7,14 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class JsonBool : public JsonBase
|
||||
class EHS_LIB_IO JsonBool final : public JsonBase
|
||||
{
|
||||
public:
|
||||
bool value;
|
||||
|
||||
JsonBool();
|
||||
|
||||
JsonBool(const bool value);
|
||||
JsonBool(bool value);
|
||||
|
||||
JsonBool(const JsonBool& jb) = default;
|
||||
|
||||
@@ -22,6 +22,6 @@ namespace ehs
|
||||
|
||||
operator bool&();
|
||||
|
||||
Str_8 ToStr(const UInt_64 level, const bool compact) const;
|
||||
Str_8 ToStr(UInt_64 level, bool compact) const override;
|
||||
};
|
||||
}
|
@@ -7,39 +7,37 @@
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
class JsonNum : public JsonBase
|
||||
class EHS_LIB_IO JsonNum final : public JsonBase
|
||||
{
|
||||
public:
|
||||
float value;
|
||||
|
||||
JsonNum();
|
||||
|
||||
JsonNum(const SInt_64 value);
|
||||
JsonNum(SInt_64 value);
|
||||
|
||||
JsonNum(const UInt_64 value);
|
||||
JsonNum(UInt_64 value);
|
||||
|
||||
JsonNum(const SInt_32 value);
|
||||
JsonNum(SInt_32 value);
|
||||
|
||||
JsonNum(const UInt_32 value);
|
||||
JsonNum(UInt_32 value);
|
||||
|
||||
JsonNum(const SInt_16 value);
|
||||
JsonNum(SInt_16 value);
|
||||
|
||||
JsonNum(const UInt_16 value);
|
||||
JsonNum(UInt_16 value);
|
||||
|
||||
JsonNum(const SInt_8 value);
|
||||
JsonNum(SInt_8 value);
|
||||
|
||||
JsonNum(const UInt_8 value);
|
||||
JsonNum(UInt_8 value);
|
||||
|
||||
JsonNum(const double value);
|
||||
JsonNum(double value);
|
||||
|
||||
JsonNum(const float value);
|
||||
JsonNum(float value);
|
||||
|
||||
JsonNum(const JsonNum& jn) = default;
|
||||
|
||||
operator float() const;
|
||||
|
||||
operator float&();
|
||||
|
||||
Str_8 ToStr(const UInt_64 level, const bool compact) const;
|
||||
Str_8 ToStr(UInt_64 level, bool compact) const override;
|
||||
};
|
||||
}
|
@@ -9,7 +9,7 @@ namespace ehs
|
||||
{
|
||||
class JsonVar;
|
||||
|
||||
class JsonObj : public JsonBase
|
||||
class EHS_LIB_IO JsonObj final : public JsonBase
|
||||
{
|
||||
protected:
|
||||
UInt_64 size;
|
||||
@@ -18,13 +18,13 @@ namespace ehs
|
||||
JsonVar* vars;
|
||||
|
||||
public:
|
||||
virtual ~JsonObj();
|
||||
~JsonObj() override;
|
||||
|
||||
JsonObj();
|
||||
|
||||
JsonObj(const UInt_64 size, const UInt_64 extra);
|
||||
JsonObj(UInt_64 size, UInt_64 extra);
|
||||
|
||||
JsonObj(const UInt_64 extra);
|
||||
JsonObj(UInt_64 extra);
|
||||
|
||||
JsonObj(JsonObj &&value) noexcept;
|
||||
|
||||
@@ -34,9 +34,7 @@ namespace ehs
|
||||
|
||||
JsonObj& operator=(const JsonObj &value);
|
||||
|
||||
operator const JsonVar*() const;
|
||||
|
||||
operator JsonVar*();
|
||||
operator JsonVar *() const;
|
||||
|
||||
UInt_64 Size() const;
|
||||
|
||||
@@ -44,20 +42,20 @@ namespace ehs
|
||||
|
||||
UInt_64 RawSize() const;
|
||||
|
||||
bool HasVar(const UInt_64 hashId) const;
|
||||
bool HasVar(UInt_64 hashId) const;
|
||||
|
||||
bool HasVar(const Str_8 &identifier) const;
|
||||
|
||||
bool AddVar(const JsonVar &var);
|
||||
|
||||
const JsonVar* GetVar(const UInt_64 hashId) const;
|
||||
const JsonVar *GetVar(UInt_64 hashId) const;
|
||||
|
||||
const JsonVar *GetVar(const Str_8& identifier) const;
|
||||
|
||||
JsonVar* GetVar(const UInt_64 hashId);
|
||||
JsonVar *GetVar(UInt_64 hashId);
|
||||
|
||||
JsonVar *GetVar(const Str_8& identifier);
|
||||
|
||||
Str_8 ToStr(const UInt_64 level, const bool compact) const;
|
||||
Str_8 ToStr(UInt_64 level, bool compact) const override;
|
||||
};
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user