Compare commits

..

3 Commits

Author SHA1 Message Date
neru 9d841358ee docs: remove - 2026-05-11 08:37:58 -03:00
neru e48076a452 docs: wording, table of contents, and misc changes 2026-05-11 08:37:30 -03:00
neru b17f84cb40 docs: add documentation for event lib 2026-05-11 08:29:43 -03:00
+49 -10
View File
@@ -1,11 +1,21 @@
<h1 align="center"> <h1 align="center">
<b>seallib</b> <b>🦭seallib🦭</b>
</h1> </h1>
<p align="center"> <p align="center">
A modular and tiny C++20 powered library collection of random stuff I've needed for other projects. A <b>modular and tiny C++20</b> powered library collection of random stuff I've needed for other projects.
</p> </p>
## Table of Contents
* [Installation & Integration](#installation--integration)
* [Build Options](#build-options)
* [Modules](#modules)
* [Logging](#1-logging)
* [Assert](#2-assert)
* [Events](#3-events)
* [VFS](#4-vfs)
* [Running tests](#running-tests)
## Installation & Integration ## Installation & Integration
### 1. Requirements ### 1. Requirements
@@ -49,6 +59,7 @@ target_link_libraries(your_project PRIVATE seallib)
--- ---
## Build Options ## Build Options
Toggle features by setting these variables to ``ON`` or ``OFF`` in your CMake configuration.
| Option | Description | Default | | Option | Description | Default |
| :--- | :--- | :--- | | :--- | :--- | :--- |
| SEALLIB_ASSERT | Enable Assertion utility | OFF | | SEALLIB_ASSERT | Enable Assertion utility | OFF |
@@ -59,9 +70,8 @@ target_link_libraries(your_project PRIVATE seallib)
--- ---
## Module Instructions ## Modules
<a name="module-logging"></a>
### 1. Logging ### 1. Logging
The Log module uses a Sink architecture. You create a Logger, attach an ILogSink, and log messages using std::format syntax. The Log module uses a Sink architecture. You create a Logger, attach an ILogSink, and log messages using std::format syntax.
@@ -91,15 +101,44 @@ int main() {
} }
``` ```
<a name="module-assertion"></a> ### 2. Assert
### 2. Assertion
(Documentation pending implementation) (Documentation pending implementation)
<a name="module-events"></a>
### 3. Events ### 3. Events
(Documentation pending implementation) The Events module provides a thread and type safe signal/slot mechanism. It allows you to define custom events with any number of parameters and subscribe to them using callbacks.
#### Basic Usage
```cpp
#include <seallib/event.h>
#include <iostream>
using namespace seallib;
// Define an event that takes an int and a string
Event<int, std::string> OnUserLogin;
void onLogin(int id, std::string name) {
std::cout << "User " << name << " (ID: " << id << ") logged in!" << std::endl;
}
int main() {
// 1. Subscribe to the event
auto connection = OnUserLogin.addListener(onLogin);
// 2. Add a lambda listener
OnUserLogin.addListener([](int id, auto name) {
std::clog << "[Log] Login detected for ID: " << id << std::endl;
});
// 3. Trigger the event
OnUserLogin.run(42, "SomeUser");
// 4. Remove a listener when no longer needed
OnUserLogin.removeListener(connection);
return 0;
}
```
<a name="module-vfs"></a>
### 4. VFS ### 4. VFS
The VFS (Virtual File System) module provides a unified interface for file operations by mapping virtual paths to user defined providers. The VFS (Virtual File System) module provides a unified interface for file operations by mapping virtual paths to user defined providers.
@@ -182,7 +221,7 @@ int main() {
--- ---
## Running Tests ## Running tests
### Windows (PowerShell + Visual Studio) ### Windows (PowerShell + Visual Studio)
A script is provided to automate generation and open the solution in Visual Studio: A script is provided to automate generation and open the solution in Visual Studio: