-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update version 1.1.0
- Loading branch information
Showing
1 changed file
with
58 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,64 @@ | ||
### VCore: Open Source libuv extend core Library | ||
# VLibuv | ||
|
||
#### Resources | ||
## Project Overview | ||
|
||
* Homepage: <https://github.com/Antruly/VLibuv> | ||
* Docs: <https://github.com/Antruly/VLibuv/master> | ||
VLibuv is a C++ wrapper based on libuv, designed to provide a convenient object-oriented programming interface and simplify the development of asynchronous, event-driven applications. By extending and encapsulating libuv's `uv_handle_t` and `uv_req_t` types, VLibuv makes them more compatible with C++'s object-oriented programming style. | ||
|
||
#### Contributing | ||
## Key Features | ||
|
||
Summary of guidelines: | ||
- **C++ Wrapper:** Simplifies asynchronous programming and event handling with a C++ wrapper for libuv's raw types. | ||
|
||
* One pull request per issue; | ||
* Choose the right base branch; | ||
* Include tests and documentation; | ||
* Clean up "oops" commits before submitting; | ||
* Follow the coding style guide. | ||
- **Extension of `uv_handle_t` and `uv_req_t`:** Facilitates management and operations through C++ inheritance. | ||
|
||
#### remake | ||
* 本项目为libuv的一个扩展库,需要从https://github.com/libuv/libuv 下拉源码,并在cmake 下指定include和src目录后,方可进行编译 | ||
* 目前已测试平台为windows10 vs2022,其他平台需要自行测试 | ||
* 下载和使用该项目,需要遵循libuv官方的使用协议 | ||
- **Extension of `uv_buf_t`:** Enhances flexibility in buffer operations with extended methods. | ||
|
||
- **Derived Types:** Introduces derived types, such as `VTcpService`, for rapid establishment of a TCP service. | ||
|
||
- **Compatibility:** Maintains compatibility with all versions of libuv 1.0 series, incorporating new features and improvements promptly. | ||
|
||
## Building and Installing the Project with CMake | ||
Follow these steps to build and install the project using CMake: | ||
|
||
```camke | ||
# Clone the libuv repository from https://github.com/libuv/libuv. | ||
git clone https://github.com/libuv/libuv | ||
# In the root directory of VLibuv, create a build directory | ||
mkdir build && cd build | ||
# Run CMake to configure the project | ||
cmake .. | ||
# Build the project using your preferred build tool (make, Visual Studio, etc.) | ||
cmake --build . | ||
# Install the project | ||
cmake --install . | ||
``` | ||
|
||
## Example Usage | ||
|
||
```cpp | ||
#include "VTimer.h" | ||
|
||
// Timer callback function | ||
void timerFunc(VTimer* vtimer) { | ||
// Add logic to be executed when the timer triggers | ||
// For example, output a message | ||
std::cout << "Timer triggered!" << std::endl; | ||
} | ||
|
||
int main() { | ||
// Create an event loop object | ||
VLoop vloop; | ||
|
||
// Create a timer object and associate it with the event loop | ||
VTimer vtimer(&vloop); | ||
|
||
// Start the timer with the callback function as timerFunc, interval of 1000 milliseconds, and repeat count of 0 for unlimited repeats | ||
vtimer.start(timerFunc, 1000, 0); | ||
|
||
// Enter the event loop and wait for events to occur | ||
return vloop.exec(); | ||
} | ||
``` |