chini.h

来自「此文档是用vistual studio 2005 开发的用来描述3D-tree 」· C头文件 代码 · 共 54 行

H
54
字号
/*
* Copyleft (c) 2008 Lauming chen, SooChow University.
*
*
*
*/

/*
* File: ChIni.h
* Read and write ini file
*/

#ifndef _CHINI__INCLUDE_
#define _CHINI__INCLUDE_

#include <map>
#include <list>
#include <string>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <sstream>
using namespace std;

typedef map<string, string> MAP_KEY_VALUE;
struct _node 
{
	string section;
	MAP_KEY_VALUE section_node;
};
typedef list<_node> LIST_INI;

class ChIni {
public :
	ChIni( char* fileName );
	~ChIni();
	string readValueAsString( string section, string key );
	int readValueAsInt( string section, string key );
	double readValueAsDouble( string section, string key );
	bool readValueAsBoolean( string section, string key );
	bool writeValue( string section, string key, string value );
	bool writeValue( string section, string key, int value );
	bool writeValue( string section, string key, float value );
	bool writeValue( string section, string key, double value );
	bool writeValue( string section, string key, bool value );
protected :
	bool readFile();
	bool writeFile();
	LIST_INI m_listini;
private :
	string fileName;
};

#endif /* _CHINI__INCLUDE_ */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?