Migrate to VoidLibrary (toolchain + API groundwork)

This commit is contained in:
faumaray committed 2026-06-22 15:53:18 +03:00
1 parent 5e1e3d66c4
commit e17cfed56f
38 files changed
+3077 -2505

No files matched your search

@@ -0,0 +1,58 @@
#pragma once
#include <cstdint>
#include <memory>
namespace Echoion::Api
{
// Opaque handle types to avoid including full headers
// These are used in interfaces to break dependencies
// Forward declarations for Core types (Plugin never needs full definition)
struct AppConfig;
struct HotReloadState;
struct PlaybackState;
struct TrackInfo;
struct QueueEntry;
// Opaque handle wrapper - type-safe void pointer replacement
template <typename T> class OpaqueHandle
{
public:
OpaqueHandle() = default;
explicit OpaqueHandle(std::shared_ptr<T> ptr) : ptr_(std::move(ptr))
{
}
[[nodiscard]] bool isValid() const { return ptr_ != nullptr; }
[[nodiscard]] T* get() const { return ptr_.get(); }
[[nodiscard]] T& operator*() const { return *ptr_; }
[[nodiscard]] T* operator->() const { return ptr_.get(); }
void reset() { ptr_.reset(); }
void reset(T* ptr) { ptr_.reset(ptr); }
[[nodiscard]] std::shared_ptr<T> toSharedPtr() const
{
return ptr_;
}
private:
std::shared_ptr<T> ptr_;
};
// Specific handle types
using AppConfigHandle = OpaqueHandle<AppConfig>;
using HotReloadStateHandle = OpaqueHandle<HotReloadState>;
using PlaybackStateHandle = OpaqueHandle<PlaybackState>;
using TrackInfoHandle = OpaqueHandle<TrackInfo>;
using QueueEntryHandle = OpaqueHandle<QueueEntry>;
// Serialization helpers for cross-boundary communication
using SerializedConfig = std::string; // JSON string
using SerializedState = std::string; // JSON string
} // namespace Echoion::Api