KvConfigParse
KvConfigParse
Description
Parse complete key-value config text into cfg.
Supported syntax:
key = valuekey: value- blank lines
- comments starting with
#or; - quoted values using
'or"
If the same key appears multiple times, the last parsed value replaces earlier ones.
Parameters
| Name | Direction | Description |
|---|---|---|
si |
in | Input iterator. |
cfg |
in,out | Destination config map. |
Success
Returns iterator advanced to end of parsed config.
Failure
Returns original iterator on first invalid line.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
KvConfig.c:342:
}
StrIter KvConfigParse(StrIter si, KvConfig *cfg) {
StrIter saved_si = si;- In
Parse.c:14:
);
StrIter input = StrIterFromStr(src);
StrIter si = KvConfigParse(input, &cfg);
Str *host = KvConfigGetPtr(&cfg, "host");
i64 port = 0;- In
Parse.c:44:
);
StrIter input = StrIterFromStr(src);
StrIter si = KvConfigParse(input, &cfg);
Str *path = KvConfigGetPtr(&cfg, "path");
Str *user = KvConfigGetPtr(&cfg, "user");- In
Parse.c:71:
bool result = true;
(void)KvConfigParse(input, &cfg);
stored_host = KvConfigGetPtr(&cfg, "host");- In
Parse.c:110:
StrIter input = StrIterFromStr(src);
(void)KvConfigParse(input, &cfg);
result = result && KvConfigGetI64(&cfg, "workers", &workers) && (workers == 16);- In
Parse.c:133:
);
StrIter input = StrIterFromStr(src);
StrIter si = KvConfigParse(input, &cfg);
bool enabled = false;
bool result = true;
Last updated on