Skip to content
프로젝트

소개

가벼운 C++ 구성 라이브러리

개발 도구

이 수치를 측정하는 방법

What you can do

  • Header-only & STL-like
  • Custom type conversion & serialization
  • Complete Unicode support
  • ASCII & Wide-character support

측정된 스타 증가

in 24h
0
in 7 days
-1
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

logo

Open in VSCode Github status Codacy Badge codecov GitHub release GitHub license

A light weight configuration library for C++11.

EN | 中文

Features

  • Header-only & STL-like
  • Custom type conversion & serialization
  • Complete Unicode support
  • ASCII & Wide-character support

Quick start

Create JSON objects:

json::value j;
j["integer"] = 1;
j["float"] = 1.5;
j["string"] = "something";
j["boolean"] = true;
j["user"]["id"] = 10;
j["user"]["name"] = "Leeoo";

json::value j2 = json::object{
    { "null", nullptr },
    { "integer", 1 },
    { "float", 1.3 },
    { "boolean", true },
    { "string", "something" },
    { "array", json::array{ 1, 2 } },
    { "object", json::object{
        { "key", "value" },
        { "key2", "value2" },
    }},
};

Conversion & Serialization:

struct User
{
    std::string name;
    int age;

    // bind custom type to configor
    CONFIGOR_BIND(json::value, User, REQUIRED(name), OPTIONAL(age))
};

// User -> json
json::value j = User{"John", 18};
// json -> User
User u = json::object{{"name", "John"}, {"age", 18}};

// User -> string
std::string str = json::dump(User{"John", 18});
// string -> User
User u = json::parse("{\"name\": \"John\", \"age\": 18}");

// User -> stream
std::cout << json::wrap(User{"John", 18});
// stream -> User
User u;
std::cin >> json::wrap(u);

Learn more from the wiki.

Star History

Plan

  • Custom type conversion
  • Unicode support
  • Unit test coverage above 85%
  • Improve error message
  • YAML support
  • ini support
  • json5 support
  • SAX tool

관련 프로젝트 살펴보기

불러오는 중…