taocpp / config Goto Github PK
View Code? Open in Web Editor NEWC++ header-only config reader library based on JSON
License: MIT License
C++ header-only config reader library based on JSON
License: MIT License
__int128_t is a non-standard compliant extension in GCC and Clang, but this is not supported by other compilers like MSVC.
First of all, kudos for the awesome library!
I'm wondering if there is a way to use an environment variable result within the include token.
Something like this:
foo = (env "config_path") (include "(foo)/presets.base")
Note: this leads to a parsing error in the include token...
Or there is another way to get this done?
Hi and kudos for the awesome library!
Is there a way to do this:
std::string checkTemporary = R"(
(temporary x1)
x1 = 1
(temporary x2)
x2 = 2
(temporary y3)
y3 = 3
(permanent x1)
(permanent x2)
)";
TEST_CASE("Temporary", "[tao]")
{
tao::json::events::to_value taovalue_consumer;
auto cnfg = tao::config::from_string(checkTemporary, "test");
tao::json::events::from_value(taovalue_consumer, cnfg);
tao::json::nlohmann::to_value<::nlohmann::json> nlohmann_consumer;
tao::json::events::from_string(nlohmann_consumer, tao::json::to_string(taovalue_consumer.value));
CHECK(nlohmann_consumer.value.contains("x1"));
CHECK(nlohmann_consumer.value.contains("x2"));
CHECK(!nlohmann_consumer.value.contains("y3"));
}
but with something like (permanent x*)
?
The use case is that all temporaries with a certain prefix are possible presets. We want to construct a config json with a specific preset for our application by including all the temporaries in one file, and muxing between them when resolving the json without each and every preset appearing in the resolved json - and that's easy; but also to query the list of available temporaries (preset names) by including them in another file and making those with a certain prefix permanent when resolving.
Also, what is the right way to convert to nlohmann::json without going through std::string? Couldn't find it.
Thanks!
Guy.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.