-
Notifications
You must be signed in to change notification settings - Fork 8
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 #76 from dzcode-io/75-add-readmemd-for-c-library
Add `README.md` for C library
- Loading branch information
Showing
7 changed files
with
116 additions
and
31 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 @@ | ||
# kuliya for C | ||
|
||
Algeria's college hierarchy dataset as a C library | ||
|
||
# Prerequisites | ||
|
||
- [CMake](https://cmake.org/download/) build system (minimum required version 3.19) | ||
- [Conan](https://conan.io/downloads) package manager | ||
- [Clang](https://clang.llvm.org/get_started.html) or [GCC](https://gcc.gnu.org/releases.html) compiler (on macOS clang comes with the developer tools) | ||
- Any IDE out there, preferably [VSCode](https://code.visualstudio.com/download) with the following extensions: | ||
- [C/C++](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) | ||
- [CMake](https://marketplace.visualstudio.com/items?itemName=twxs.cmake) | ||
- [CMake Tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) | ||
- [conan-extension](https://marketplace.visualstudio.com/items?itemName=konicy.conan-extension) | ||
|
||
# Get Started | ||
|
||
- Install build dependencies: | ||
```sh | ||
cd c && conan install . --output-folder=build --build=missing | ||
``` | ||
- Click on CMake Tools icon <img src="https://ms-vscode.gallerycdn.vsassets.io/extensions/ms-vscode/cmake-tools/1.18.16/1711685798086/Microsoft.VisualStudio.Services.Icons.Default" width="20px"/> in the extensions sidebar (Open [CMakeLists.txt](./CMakeLists.txt) if it doesn't appear for some reason). | ||
- Follow these steps: | ||
|
||
https://github.com/dzcode-io/kuliya/assets/48713070/3f693a1c-050d-4ee2-bfce-9ade59e772ed | ||
|
||
# Usage | ||
|
||
```c | ||
#include <stdio.h> | ||
#include <kuliya.h> | ||
|
||
int main(void) | ||
{ | ||
kuliya_init(); | ||
kuliya_schema *res = get_node_by_path("umkb/fst/dee/sec"); | ||
if (res != NULL) | ||
{ | ||
printf("%s\n", res->name.en); | ||
} | ||
kuliya_deinit(); | ||
} | ||
``` | ||
Check practical example usage [here](./example/main.c). | ||
# Contribute | ||
Feel free to ask for help in [#kuliya](https://dzcode.slack.com/archives/C01C0155CKC) group chat |
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
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,32 @@ | ||
#include <iostream> | ||
#include <kuliya.h> | ||
|
||
class Kuliya | ||
{ | ||
public: | ||
Kuliya(); | ||
~Kuliya(); | ||
kuliya_schema *GetNodeByPath(const char *path); | ||
}; | ||
|
||
Kuliya::Kuliya() | ||
{ | ||
kuliya_init(); | ||
} | ||
|
||
Kuliya::~Kuliya() | ||
{ | ||
kuliya_deinit(); | ||
} | ||
|
||
kuliya_schema *Kuliya::GetNodeByPath(const char *path) | ||
{ | ||
return get_node_by_path(path); | ||
} | ||
|
||
int main(void) | ||
{ | ||
Kuliya *kuliya = new Kuliya(); | ||
auto schema = kuliya->GetNodeByPath("umkb/fst/dee/sec"); | ||
std::cout << schema->name.en << "\n"; | ||
} |