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

📄 dbhandler.h

📁 用于symbian手机的词典工具.绝对有用。
💻 H
字号:
/*
* MDictionary - dictionary program for Symbian cellular phones
*
* Copyright (C) 2005 Egyeki Gergely
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
*/
#ifndef __DBHANDLER_H__
#define __DBHANDLER_H__

#include <e32std.h>
#include <s32file.h>				//For opening a file
#include <f32file.h>				//RFs
#include <d32dbms.h>				//RDbNamedDatabase
#include <aknlists.h>				//For listbox
#include <AknWaitNoteWrapper.h>		//MAknBackgroundProcess

#include "MDictionary.hrh"

// Constants
_LIT(KDBDirPath, "\\system\\data\\");

_LIT(KSysTable, "SysTable");
_LIT(KSysTableTitle1Col, "Lang1Title");
_LIT(KSysTableTitle2Col, "Lang2Title");
_LIT(KSysTableFLetter1, "FirstLetter1");
_LIT(KSysTableFLetter2, "FirstLetter2");
_LIT(KSysTableFont1, "FontFile1");
_LIT(KSysTableFont2, "FontFile2");
_LIT(KSysTableAuthorsCol, "Authors");
_LIT(KSysTableLangsCol, "FullLangs");
_LIT(KSysTableVersionCol, "Version");

//Letters1 table
_LIT(KLetters1Table, "Letters1Table");
_LIT(KLetters1TableNameCol, "Name");
_LIT(KLetters1TableLetterCol, "Letter");

//Letters2 table
_LIT(KLetters2Table, "Letters2Table");
_LIT(KLetters2TableNameCol, "Name");
_LIT(KLetters2TableLetterCol, "Letter");

//Dic table
_LIT(KDicTable, "DicTable");
_LIT(KDicTableLangsCol, "Langs");

//LangX table
_LIT(KLangTable, "LangTable");
_LIT(KLangTableWordCol, "Word");

class CLanguages;

class CDBHandler : public MAknBackgroundProcess
{
public:

	static CDBHandler* NewL();
	virtual ~CDBHandler();

	TInt OpenDbL();
	TInt CloseDb();
	TBool IsOpen() const;

	HBufC* GetActDB();
	TInt GetActDBInt();
	void SetActDBInt(TInt i);
	void SetActDB(HBufC* db);
	HBufC* GetDBTitle1L();
	HBufC* GetDBTitle2L();
	HBufC* GetFLetter1L();
	HBufC* GetFLetter2L();
	HBufC* GetFont1L();
	HBufC* GetFont2L();
	HBufC* GetDicTitle1L();
	HBufC* GetDicTitle2L();
	HBufC* GetAuthorsL();
	HBufC* GetVersionL();

	//Before this function you must set the variables
	// with the SetParameters() function
	void ListSelectL();
	void SearchSelectL();

	TBool				DicExist;
	TBool				DicSelected;
	CDesC16ArraySeg*	iDicList;
	CDesC16ArraySeg*	iFormattedDicList;
	CDesC16ArraySeg*	iSelectList;
	CDesC16ArraySeg*	iResultList;

private:
	
	CDBHandler();
	void ConstructL();

	void SearchingDicL();
	void SetFormattedDicListL();

	//Implement MAknBackgroundProcess virtual functions
	void StepL();
	TBool IsProcessDone() const;
	void ProcessFinished();
	void DialogDismissedL(TInt);
	TInt CycleError(TInt aError);

	HBufC*				iActDB;
	TInt				iActDBInt;
	HBufC*				iDicLang1;
	HBufC*				iDicLang2;
	HBufC*				iDicFont1;
	HBufC*				iDicFont2;
	HBufC*				iFLetterLang1;
	HBufC*				iFLetterLang2;
	HBufC*				iDicTitle1;
	HBufC*				iDicTitle2;
	HBufC*				iDicAuthors;
	HBufC*				iDicVersion;

	//Data
	RFs					iFsSession;	
	RFileReadStream		iReader;
	RDbNamedDatabase	iDicDB;
	RDbView				iView;

	TBool				iOpen;
	HBufC*				iLine;

	//To make work MAknBackgroundProcess
	HBufC*				iSearchWord;		//the word to search
	TInt				iSearchLang;		//0 = Lang1, 1 = Lang2
	TInt				iSearchType;		//0 = symple, 1 = exact
	TInt				iSearchSelectType;	//0 = Listing, 1 = Searching

	TBool				iWorking;			//The engine is working or not

	CLanguages*			iLang;				//Getting the translated lang text

public:

	void SetParameters(HBufC* aWord, TInt aLang, TInt aType, TInt aSelectType);

};


#endif // __DBHANDLER_H__

⌨️ 快捷键说明

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