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

📄 setting.h

📁 手机天气预报系统
💻 H
字号:
/*
 ============================================================================
 Name		: Setting.h
 Author	  : Richie Chyi
 Copyright   : Copyright?2008
 Description : Declares Setting Config Class.
 ============================================================================
 */

#ifndef SETTING_H_
#define SETTING_H_

#include <e32base.h>

_LIT(KConfigFileName, "c:\\weatherconfig.dat");

class CSetting : public CBase
	{
public:
	static CSetting* NewL();
	static CSetting* NewLC();
	~CSetting();
	
protected:
	CSetting();
	void ConstructL();
	
	/**
	 * 外化
	 */
	void ExternalizeL(RWriteStream& aStream);

	/**
	 * 内化
	 */
	void InternalizeL(RReadStream& aStream);
	
public:
	
	/**
	 *  从文件读取数据
	 */
	TInt ReadFromFileL();
	
	/**
	 * 保存至文件
	 */
	TInt SaveToFileL();
	
	/**
	 * 是否已保存过
	 */
	TBool IsSaved();
	
	/**
	 * 根据索引获取城市名称字符串
	 */
	static void CityNameForIndex(TInt aCityIndex, TDes& aBuf);
	
	/**
	 * 获取数据
	 */
	inline TInt8 CityIndex();
	inline TInt8 Hour();
	inline TInt8 Minute();
	
	/**
	 * 设置数据
	 */
	inline void SetCityIndex(TInt8 aCityIndex);
	inline void SetHour(TInt8 aHour);
	inline void SetMinute(TInt8 aMinute);
	
private:
	TInt8 iCityIndex;
	TInt8 iHour;
	TInt8 iMinute;
	};

/**
 * 内联函数定义
 */
TInt8 CSetting::CityIndex() { return iCityIndex; }
TInt8 CSetting::Hour() { return iHour; }
TInt8 CSetting::Minute() { return iMinute; }

void CSetting::SetCityIndex(TInt8 aCityIndex) { iCityIndex = aCityIndex; }
void CSetting::SetHour(TInt8 aHour) { iHour = aHour; }
void CSetting::SetMinute(TInt8 aMinute) { iMinute = aMinute; }

#endif /*SETTING_H_*/

⌨️ 快捷键说明

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