Compare commits
3 Commits
7f979dacd4
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 9d841358ee | |||
| e48076a452 | |||
| b17f84cb40 |
@@ -1,11 +1,21 @@
|
||||
<h1 align="center">
|
||||
<b>seallib</b>
|
||||
<b>🦭seallib🦭</b>
|
||||
</h1>
|
||||
|
||||
<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>
|
||||
|
||||
## 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
|
||||
|
||||
### 1. Requirements
|
||||
@@ -49,6 +59,7 @@ target_link_libraries(your_project PRIVATE seallib)
|
||||
---
|
||||
|
||||
## Build Options
|
||||
Toggle features by setting these variables to ``ON`` or ``OFF`` in your CMake configuration.
|
||||
| Option | Description | Default |
|
||||
| :--- | :--- | :--- |
|
||||
| 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
|
||||
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. Assertion
|
||||
### 2. Assert
|
||||
(Documentation pending implementation)
|
||||
|
||||
<a name="module-events"></a>
|
||||
### 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
|
||||
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)
|
||||
A script is provided to automate generation and open the solution in Visual Studio:
|
||||
|
||||
Reference in New Issue
Block a user