Git Product home page Git Product logo

Comments (8)

magiblot avatar magiblot commented on August 18, 2024

The main setback here is that I have to choose a configuration system, but I have never used one. Configuration files should be human-readable. Any suggestions?

from turbo.

okbob avatar okbob commented on August 18, 2024

from turbo.

okbob avatar okbob commented on August 18, 2024

from turbo.

unxed avatar unxed commented on August 18, 2024

The main setback here is that I have to choose a configuration system, but I have never used one. Configuration files should be human-readable. Any suggestions?

Why not to use well-known .ini file syntax?
For example, this is ready to use code to work with it from far2l (GPLv2):
https://github.com/elfmz/far2l/blob/master/utils/src/KeyFileHelper.cpp

from turbo.

exebook avatar exebook commented on August 18, 2024

JSON!

from turbo.

magiblot avatar magiblot commented on August 18, 2024

Hey exebook,

JSON!

Yeah, I also think JSON makes everything simpler. But I'm not sure plain JSON is good enough, as it doesn't support comments. libconfig not only is adapted to the use case of storing configuration, but also uses a syntax very similar to JSON: http://hyperrealm.github.io/libconfig/libconfig_manual.html#Configuration-Files.

from turbo.

exebook avatar exebook commented on August 18, 2024

JSON allows /* */ AFAIK but not //. But anyway you can strip comments before calling JSONParse in your library of choice. Also you can put your comments in string properties like { comment: "blah" }

from turbo.

ziotom78 avatar ziotom78 commented on August 18, 2024

JSON allows /* */ AFAIK but not //. But anyway you can strip comments before calling JSONParse in your library of choice. Also you can put your comments in string properties like { comment: "blah" }

I know for sure that a few JSON parsers recognize comments, but this does not seem to be in the standard; it is however supported by JSON5.

Another option could be to use TOML: it was designed specifically for configuration files written by humans, it looks reasonably similar to INI files, it is easy to support it in C++ because there are header-only libraries, it is widely used and so it's likely that people already know how to write TOML files.

from turbo.

Related Issues (20)

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.