initial
所属分类:编程语言基础
开发工具:D
文件大小:0KB
下载次数:0
上传日期:2024-01-26 01:22:27
上 传 者:
sh-1993
说明: D编程语言的INI解析库
(INI parsing library for the D programming language)
文件列表:
COPYING
dub.json
initial.d
## initial - INI parsing library for the D programming language
My attempt at making a sane and high-quality INI parsing library for D.
```ini
[section]
key = value
```
An INI file's contents is stored in an `INIUnit` structure. This contains
multiple `INISection`s stored in an associative array that you can read
or set yourself.
initial also provides serialisation facilities that can turn `INIUnit`s
and `INISection`s back into an INI document. Handy for if your program
has some sort of GUI configuration interface or if you're passing around
INI through a network connection.
## Demo
```d
INIUnit ini;
/* write INI data to an INIUnit */
ini["section"]["key"] = "value";
ini["section"]["num"] = "4.8";
/* read INI data */
readINI(ini, `
[section]
num = 5.3
`);
assert(ini["section"]["key"] == "value");
assert(ini["section"]["num"] == "5.3");
/* read INI from file */
readINIFile(ini, "config.ini");
/* write INI to file */
import std.file : write;
write("config.ini", ini.serialise());
```
## Usage
Download initial.d and put it somewhere in your import path, then compile it alongside
your program and link it in. Or you can do it all at once by using -i.
```
dmd -i -of=program program.d initial.d
```
近期下载者:
相关文件:
收藏者: