A tiny stb-style header-only INI parser library for C.
xini.h lets you define your entire configuration schema at compile time using a
small set of macros. The library then generates the required types and parsing
logic for that schema, providing type-safe access to configuration values
through a single xini_config structure.
- Schema-driven configuration parsing
- Library specializes itself to your schema at compile time
- Static sections with strict key validation
- Dynamic sections with user-defined handlers
- Custom enumeration generation / parsing
- Mechanism to easily extend this library to support your own types
- Supports default values for entires
- Configuration dumping and cleanup helpers
- Copy
xini.hinto your project. - Define your configuration schema using the X-macro API before including
xini.h. - Define
XINI_IMPLEMENTATIONbefore includingxini.hin exactly one TU. - Create a context using
xini_context_init(). - Set default values using
xini_config_init(). - Parse a config file with
xini_config_parse(). - Access values through
xini_config.<section>.<key>. - Free
xini_configusingxini_config_free().
See example/example.c for a complete working example.
Documentation is present at top of xini.h. If anything is unclear, refer to
the example in example/. If you still have questions, feel free to open an
issue.
MIT License. See LICENSE for details.