Giter VIP home page Giter VIP logo

libkitsunemimiconfig's Introduction

libKitsunemimiConfig

IMPORTANT: This repository is no longer maintained, because in context of issue kitsudaiki/Hanami#31 the content was moved into the main-repository (https://github.com/kitsudaiki/Hanami-AI).

Github workfloat status GitHub tag (latest SemVer) GitHub C++Version Platform

Description

This library provides a simple interface for reading config files.

Build

Requirements

name repository version task
g++ g++ >= 8.0 Compiler for the C++ code.
make make >= 4.0 process the make-file, which is created by qmake to build the programm with g++
qmake qt5-qmake >= 5.0 This package provides the tool qmake, which is similar to cmake and create the make-file for compilation.
FLEX flex >= 2.6 Build the lexer-code for all used parser.
GNU Bison bison 3.x Build the parser-code together with the lexer-code.

Installation on Ubuntu/Debian:

sudo apt-get install g++ make qt5-qmake flex bison

IMPORTANT: All my projects are only tested on Linux.

Kitsunemimi-repositories

Repository-Name Version-Tag Download-Path
libKitsunemimiCommon develop https://github.com/kitsudaiki/libKitsunemimiCommon.git
libKitsunemimiIni develop https://github.com/kitsudaiki/libKitsunemimiIni.git

HINT: These Kitsunemimi-Libraries will be downloaded and build automatically with the build-script below.

build library

In all of my repositories you will find a build.sh. You only have to run this script. It doesn't required sudo, because you have to install required tool via apt, for example, by yourself. But if other projects from me are required, it download them from github and build them in the correct version too. This script is also use by the ci-pipeline, so its tested with every commit.

Run the following commands:

git clone https://github.com/kitsudaiki/libKitsunemimiConfig.git
cd libKitsunemimiConfig
./build.sh
cd ../result

It create automatic a build and result directory in the directory, where you have cloned the project. At first it build all into the build-directory and after all build-steps are finished, it copy the include directory from the cloned repository and the build library into the result-directory. So you have all in one single place.

Tested on Debian and Ubuntu. If you use Centos, Arch, etc and the build-script fails on your machine, then please write me a mail and I will try to fix the script.

Usage by example

Content of example config-file:

[DEFAULT]
string_val = asdf.asdf
int_val = 2
float_val = 123.0
string_list = a,b,c
bool_value = true

Example usage in code:

#include <libKitsunemimiConfig/config_handler.h>
#include <libKitsunemimiCommon/logger.h>

ErrorContainer error;

// init configuration
// called anywhere at the beginning of the programm
Kitsunemimi::initConfig(m_testFilePath, error), true);

// register values
REGISTER_STRING_CONFIG("DEFAULT", "string_val", error, "");
REGISTER_INT_CONFIG("DEFAULT", "int_val", error, 42);
REGISTER_INT_CONFIG("DEFAULT", "another_int_val", error, 42);

// check if config is valid and all registrations were successfull
bool valid = Kitsunemimi::isConfigValid();
// is true in this example
if(valid == false) {
	LOG_ERROR(error);
}

// all register options:
//
// REGISTER_STRING_CONFIG
// REGISTER_INT_CONFIG
// REGISTER_FLOAT_CONFIG
// REGISTER_BOOL_CONFIG
// REGISTER_STRING_ARRAY_CONFIG

bool success = false;

std::string firstValue = GET_STRING_CONFIG("DEFAULT", "string_val", success);
//     variable success is true
long number1 = GET_INT_CONFIG("DEFAULT", "int_val", success);
//     variable success is true
long number2 = GET_INT_CONFIG("DEFAULT", "another_int_val", success);
//     variable success is true

// all get options:
//
// GET_STRING_CONFIG
// GET_INT_CONFIG
// GET_FLOAT_CONFIG
// GET_BOOL_CONFIG
// GET_STRING_ARRAY_CONFIG

// get on not registered value
std::string fail = GET_STRING_CONFIG("DEFAULT", "fail", success);
//     variable success is false

Contributing

Please give me as many inputs as possible: Bugs, bad code style, bad documentation and so on.

License

This project is licensed under the MIT License - see the LICENSE file for details

libkitsunemimiconfig's People

Contributors

kitsudaiki avatar

Stargazers

 avatar  avatar

Watchers

 avatar

libkitsunemimiconfig's Issues

tag 0.2.5

Tag-request

Checklist

  • Changelog
  • Version-tag in pro-file
  • Version-tag of requirements in Readme
  • Version-tag of requirements in build-script
  • Add tag

tag 0.3.0

Tag-request

Checklist

  • Changelog
  • Version-tag in pro-file
  • Version-tag of requirements in Readme
  • Version-tag of requirements in build-script
  • Add tag

tag 0.2.3

Tag-request

Checklist

  • Changelog
  • Version-tag in pro-file
  • Version-tag of requirements in Readme
  • Version-tag of requirements in build-script
  • Add tag

rework interface

Cleanup-request

Description

Rework interface to make it better usable, because a the moment to check the registration-commands for the return-value is bad and unnecessary.

tag 0.5.0

Tag-request

Checklist

  • Changelog
  • Version-tag in pro-file
  • Version-tag of requirements in Readme
  • Version-tag of requirements in build-script
  • Add tag

tag 0.4.0

Tag-request

Checklist

  • Changelog
  • Version-tag in pro-file
  • Version-tag of requirements in Readme
  • Version-tag of requirements in build-script
  • Add tag

failing pipeline in release mode

BUG-issue

Description of the bug you run into

For an unknown reasons, the weekly scheduled ci-job failed for an unknown reason. It was solved for now by switching the build-script to debug-mode. I was not able to reproduce the problem on my local pc.

tag 0.2.4

Tag-request

Checklist

  • Changelog
  • Version-tag in pro-file
  • Version-tag of requirements in Readme
  • Version-tag of requirements in build-script
  • Add tag

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.