⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 properties.h

📁 天之炼狱1服务器端源文件游戏服务端不完整
💻 H
字号:
////////////////////////////////////////////////////////////////////////// Filename    : Properties.h// Written By  : reiot@ewestsoft.com// Description : ////////////////////////////////////////////////////////////////////////#ifndef __PROPERTIES_H__#define __PROPERTIES_H__// include files#include "Types.h"#include "Exception.h"#include <map>// help classclass StringCompare {public :	bool operator () (const string & left, const string & right) const	{		return left.compare(right) < 0;	}};////////////////////////////////////////////////////////////////////////// class Properties;//// 颇老肺何磐 (key,value) pair 甫 佬绢辑 map 狼 屈怕肺 啊瘤绊 乐绰促.// 林肺 券版捞唱 可记殿阑 淬篮 颇老俊 荤侩茄促. 按眉甫 积己秦辑 阿辆// 可记阑 汲沥窍绊 历厘窍搁 货 颇老捞 父甸绢柳促. //// *Usage*//// Properties prop;// prop.load("gameserver.conf");// cout << prop.getProperty("MODE") << endl;// cout << prop.getProperty("NumOfPlayerThreads") << endl;// prop.setProperty("MODE","MODE_IV");// prop.save();//// Properties prop2("loginserver.conf");// prop2.load();// prop2.save("loginserver.new");////////////////////////////////////////////////////////////////////////class Properties {	public :		static const char Comment;	static const char Separator;	static const char* WhiteSpaces;	public :		// constructor	Properties () throw ();	Properties (const string & filename) throw ();		// destructor	~Properties () throw ();	public :		// load from file	void load () throw (IOException, Error);	void load (const string & filename) throw (IOException, Error) { m_Filename = filename; load(); }	// save to file	void save () throw (IOException);	void save (const string & filename) throw (IOException) { m_Filename = filename; save(); }	// get/set property	string getProperty (string key) const throw (NoSuchElementException);	int getPropertyInt (string key) const throw (NoSuchElementException);	void setProperty (string key, string value) throw ();	bool hasKey(string key) const { return m_Properties.find(key) != m_Properties.end(); }	// get debug string	string toString () const throw ();	private :		// key 啊 string 捞绊, value 开矫 string 牢 map 捞促.	map< string, string, StringCompare > m_Properties;	// load/save target file's name	string m_Filename;	};//////////////////////////////////////////////////// global variable declaration//////////////////////////////////////////////////extern Properties* g_pConfig;extern Properties* g_pTestConfig;	// by sigi. 2002.12.26#endif

⌨️ 快捷键说明

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