languages.cpp

来自「用于symbian手机的词典工具.绝对有用。」· C++ 代码 · 共 95 行

CPP
95
字号
/*
* 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
*
*/
#include <MDictionary.rsg>
#include "languages.h"


CLanguages::CLanguages():iTitle(NULL)
{
}

CLanguages::~CLanguages()
{
	delete iTitle;
	iTitle = NULL;
}


CLanguages* CLanguages::NewL()
{
    CLanguages* tmp = new (ELeave) CLanguages();
    CleanupStack::PushL( tmp );
    tmp->ConstructL();
    CleanupStack::Pop();
    return tmp;
}

void CLanguages::ConstructL()
{
	iTitle = HBufC::NewL(LANG_MAX_LENGTH);
}



HBufC* CLanguages::GetLanguage(HBufC* aLang)
{
	TBuf<LANG_MAX_LENGTH> tmptitle;

	if( (aLang->CompareC(_L("Hungarian")) == 0)||(aLang->CompareC(_L("hu")) == 0) )
	{
		CCoeEnv::Static()->ReadResource(tmptitle, R_LANG_HU);
	}
	if( (aLang->CompareC(_L("Italian")) == 0)||(aLang->CompareC(_L("it")) == 0) )
	{
		CCoeEnv::Static()->ReadResource(tmptitle, R_LANG_IT);
	}
	if( (aLang->CompareC(_L("English")) == 0)||(aLang->CompareC(_L("en")) == 0) )
	{
		CCoeEnv::Static()->ReadResource(tmptitle, R_LANG_EN);
	}
	if( (aLang->CompareC(_L("Spanish")) == 0)||(aLang->CompareC(_L("sp")) == 0) )
	{
		CCoeEnv::Static()->ReadResource(tmptitle, R_LANG_SP);
	}
	if( (aLang->CompareC(_L("Serbian")) == 0)||(aLang->CompareC(_L("yu")) == 0) )
	{
		CCoeEnv::Static()->ReadResource(tmptitle, R_LANG_YU);
	}
	if( (aLang->CompareC(_L("French")) == 0)||(aLang->CompareC(_L("fr")) == 0) )
	{
		CCoeEnv::Static()->ReadResource(tmptitle, R_LANG_FR);
	}
	if( (aLang->CompareC(_L("German")) == 0)||(aLang->CompareC(_L("ge")) == 0) )
	{
		CCoeEnv::Static()->ReadResource(tmptitle, R_LANG_GE);
	}

	if( tmptitle.CompareC( _L("") ) == 0 ) 
	{
		tmptitle.Copy( aLang->Des() );
	}

	TPtr aAddress( iTitle->Des() );
	aAddress = tmptitle;
	return iTitle;
}

⌨️ 快捷键说明

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