最近の更新

関連


その他いろいろ

MODxでつくる! 最強のCMSサイト カバー
MODxでつくる! 最強のCMSサイト

はやくMODx 2.0でないかなあ

INIFile

boost::spiritを利用したINIの読み込み・書き出し
初出:2009年03/14 更新:2009年03/14

この文書のキーワード: なし

INIFile

boost::spiritによるINIファイルの読み込みと書き出しを行うクラスINIFileと、INIFile中のセクションに対応するINISectionを公開しています。

依存ライブラリ等

ダウンロード

inifile-1.2.2.zip

使用方法

inifile.hのコメントを参照してください。そのうちDoxygenか何かでドキュメント作るかも

使用例

#include <inifile.h>

class AutoShadeProfile : INIFile {
public:
...
void load() {
	readFile("autoshade.ini");

	// [Window]
	Left   = getSection("Window").getVal<int>("Left");
	Top    = getSection("Window").getVal<int>("Top");
	Width  = getSection("Window").getVal<int>("Width");
	Height = getSection("Window").getVal<int>("Height");
	ShowTrayIcon  = getSection("Window").getVal<bool>("ShowTrayIcon");
	StartMinimize = getSection("Window").getVal<bool>("StartMinimize");

	// [Path]
	FilterPath = getSection("Path").getVal<string>("FilterPath");
}

void save() {
	// [Window]
	getSection("Window").setVal<int>("Left", Left);
	getSection("Window").setVal<int>("Top", Top);
	getSection("Window").setVal<int>("Width", Width);
	getSection("Window").setVal<int>("Height", Height);

	writeFile("autoshade.ini");
}
};

参考