CppNCorr
C++ ncorr Digital Image Correlation engine
Loading...
Searching...
No Matches
ini.h File Reference

Tiny, dependency-free INI-style configuration parser (header-only). More...

#include <cctype>
#include <fstream>
#include <map>
#include <stdexcept>
#include <string>

Go to the source code of this file.

Classes

class  ncorr::IniFile
 In-memory representation of a parsed INI file. More...
 

Namespaces

namespace  ncorr
 

Detailed Description

Tiny, dependency-free INI-style configuration parser (header-only).

Written in-tree to avoid adding any external dependency (no TOML/INI library). Format (deliberately minimal):

  • One key = value pair per line.
  • Blank lines are ignored.
  • Full-line comments start with '#' or ';'.
  • Inline comments: text after an unquoted '#' or ';' is stripped.
  • Optional [section] headers are parsed; keys may be addressed as "section.key" or, for the default (top) section, just "key".
  • Surrounding whitespace on keys and values is trimmed.
  • Values may be wrapped in matching single or double quotes to preserve leading/trailing spaces or embedded comment characters.
  • Keys are case-sensitive (to match C++ field names exactly).

This is intended for small config files (a few dozen keys); it loads the whole file into a map. It is not a general-purpose INI implementation.

Definition in file ini.h.