-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from sjinks/add-docs
docs: Doxygen documentation
- Loading branch information
Showing
15 changed files
with
1,162 additions
and
46 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
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
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Deploy API Docs to Pages | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the source code | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
||
- name: Install dependencies | ||
uses: ./.github/actions/install-dependencies | ||
|
||
- name: Generate API Docs | ||
run: | | ||
cmake -B build | ||
cmake --build build --target doxygen | ||
- name: Setup Pages | ||
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0 | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 | ||
with: | ||
path: apidocs | ||
|
||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 |
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,4 +1,5 @@ | ||
/.cache/ | ||
/.vscode/ | ||
/apidocs/ | ||
/build/ | ||
/build-*/ |
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
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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# JSON RPC | ||
|
||
[![Build and Test](https://github.com/sjinks/jsonrpc-cpp/actions/workflows/ci.yml/badge.svg)](https://github.com/sjinks/jsonrpc-cpp/actions/workflows/ci.yml) | ||
[![CodeQL](https://github.com/sjinks/jsonrpc-cpp/actions/workflows/codeql.yml/badge.svg)](https://github.com/sjinks/jsonrpc-cpp/actions/workflows/codeql.yml) | ||
|
||
JSON-RPC 2.0 library for C++ | ||
|
||
## Introduction | ||
|
||
This library provides a robust implementation of the JSON-RPC 2.0 protocol for C++. It allows you to easily handle JSON-RPC requests, and manage responses. | ||
|
||
## Features | ||
|
||
- Full support for JSON-RPC 2.0 | ||
- Easy-to-use API | ||
- Error handling and validation | ||
|
||
## Installation | ||
|
||
To install the library, follow these steps: | ||
|
||
1. Clone the repository: | ||
```sh | ||
git clone https://github.com/sjinks/jsonrpc-cpp.git | ||
cd jsonrpc-cpp | ||
``` | ||
|
||
2. Build the project using CMake: | ||
```sh | ||
cmake -B build -DCMAKE_BUILD_TYPE=Release | ||
cmake --build build | ||
``` | ||
|
||
3. Install the library: | ||
```sh | ||
cmake --install build # In Linux, you may have to use `sudo` | ||
``` | ||
|
||
## Usage | ||
|
||
```cpp | ||
#include <wwa/jsonrpc/dispatcher.h> | ||
class my_server { | ||
public: | ||
my_server() | ||
{ | ||
this->m_dispatcher.add("add", &my_server::add, this); | ||
} | ||
void handle_request() | ||
{ | ||
// Read the request somehow | ||
const std::string input = read_request(); | ||
const std::string response = this->m_dispatcher->parse_and_process_request(input); | ||
if (!response.empty()) { | ||
// Send the response | ||
send_response(response); | ||
} | ||
} | ||
private: | ||
wwa::json_rpc::dispatcher m_dispatcher; | ||
int add(int a, int b) | ||
{ | ||
return a + b; | ||
} | ||
}; | ||
``` |
Oops, something went wrong.