当前位置: 首页>>代码示例>>C++>>正文


C++ CCnvCharacterSetConverter类代码示例

本文整理汇总了C++中CCnvCharacterSetConverter的典型用法代码示例。如果您正苦于以下问题:C++ CCnvCharacterSetConverter类的具体用法?C++ CCnvCharacterSetConverter怎么用?C++ CCnvCharacterSetConverter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CCnvCharacterSetConverter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: INFO_PRINTF1

/**
@SYMTestCaseID          SYSLIB-CHARCONV-CT-0536
@SYMTestCaseDesc        Splitting and converting from Unicode to EucJpPacked test
@SYMTestPriority        Medium
@SYMTestActions         Tests for conversion after splitting, from Unicode to EucJpPacked and back to Unicode
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
void CT_EUCJP_PACKED_2::TestSplittingConvertingFromUnicodeToEucJpPacked(CCnvCharacterSetConverter& aCharacterSetConverter, TInt aMaximumLengthLowerLimit, TInt aMaximumLengthUpperLimit, TInt aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit, TInt aExpectedLengthOfFirstPartOfEucJpPacked, const TDesC8& aExpectedEucJpPacked, const TDesC16& aOriginalUnicode)
	{
	INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0536 "));
	test(aMaximumLengthLowerLimit<=aMaximumLengthUpperLimit);
	test(aMaximumLengthUpperLimit<=KBufferLength);
	TUint8 eucJpPackedBuffer[KBufferLength];
	for (TInt i=aMaximumLengthLowerLimit; i<=aMaximumLengthUpperLimit; ++i)
		{
		TPtr8 generatedFirstPartOfEucJpPacked(eucJpPackedBuffer, i);
		test(aCharacterSetConverter.ConvertFromUnicode(generatedFirstPartOfEucJpPacked, aOriginalUnicode)==aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit);
		test(generatedFirstPartOfEucJpPacked==aExpectedEucJpPacked.Left(aExpectedLengthOfFirstPartOfEucJpPacked));
		TBuf8<KBufferLength> generatedSecondPartOfEucJpPacked;
		test(aCharacterSetConverter.ConvertFromUnicode(generatedSecondPartOfEucJpPacked, aOriginalUnicode.Right(aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit))==0);
		test(generatedSecondPartOfEucJpPacked==aExpectedEucJpPacked.Mid(aExpectedLengthOfFirstPartOfEucJpPacked));
		TInt state=CCnvCharacterSetConverter::KStateDefault;
		TBuf16<KBufferLength> generatedUnicode;
		test(aCharacterSetConverter.ConvertToUnicode(generatedUnicode, generatedFirstPartOfEucJpPacked, state)==0);
		test(state==CCnvCharacterSetConverter::KStateDefault);
		TBuf16<KBufferLength> generatedSecondPartOfUnicode;
		test(aCharacterSetConverter.ConvertToUnicode(generatedSecondPartOfUnicode, generatedSecondPartOfEucJpPacked, state)==0);
		test(state==CCnvCharacterSetConverter::KStateDefault);
		generatedUnicode.Append(generatedSecondPartOfUnicode);
		test(generatedUnicode==aOriginalUnicode);
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:33,代码来源:t_eucjp_packed_2.cpp

示例2: INFO_PRINTF1

void CT_ISO2022JP1_2::TestSplittingConvertingFromUnicodeToIso2022Jp(
                CCnvCharacterSetConverter& aCharacterSetConverter,
                TInt aMaximumLengthLowerLimit,
                TInt aMaximumLengthUpperLimit,
                TInt aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit,
                const TDesC8& aExpectedFirstPartOfIso2022Jp,
                const TDesC8& aExpectedSecondPartOfIso2022Jp,
                const TDesC16& aOriginalUnicode)
	{
	INFO_PRINTF1(_L(" TestTruncatedConversionFromUnicodeToIso2022Jp "));
	test(aMaximumLengthLowerLimit<=aMaximumLengthUpperLimit);
	test(aMaximumLengthUpperLimit<=KBufferLength);
	TUint8 iso2022JpBuffer[KBufferLength];
	for (TInt i=aMaximumLengthLowerLimit; i<=aMaximumLengthUpperLimit; ++i)
		{
		TPtr8 generatedFirstPartOfIso2022Jp(iso2022JpBuffer, i);
		test(aCharacterSetConverter.ConvertFromUnicode(generatedFirstPartOfIso2022Jp, aOriginalUnicode)==aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit);
		test(generatedFirstPartOfIso2022Jp==aExpectedFirstPartOfIso2022Jp);
		TBuf8<KBufferLength> generatedSecondPartOfIso2022Jp;
		test(aCharacterSetConverter.ConvertFromUnicode(generatedSecondPartOfIso2022Jp, aOriginalUnicode.Right(aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit))==0);
		test(generatedSecondPartOfIso2022Jp==aExpectedSecondPartOfIso2022Jp);
		TInt state=CCnvCharacterSetConverter::KStateDefault;
		TBuf16<KBufferLength> generatedUnicode;
		test(aCharacterSetConverter.ConvertToUnicode(generatedUnicode, generatedFirstPartOfIso2022Jp, state)==0);
		TBuf16<KBufferLength> generatedSecondPartOfUnicode;
		test(aCharacterSetConverter.ConvertToUnicode(generatedSecondPartOfUnicode, generatedSecondPartOfIso2022Jp, state)==0);
		generatedUnicode.Append(generatedSecondPartOfUnicode);
		test(generatedUnicode==aOriginalUnicode);
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:30,代码来源:t_iso2022jp1_2.cpp

示例3: callGetOptionsPage

void CRhodesAppView::InitOptions()
	{
		char* slash = "";
		char* options_page = callGetOptionsPage();
		if (!options_page) {
		options_page = "";
		} else if ( (*options_page!='/')&&(*options_page!='\\') ) {
			slash = "/";
		}
		int len = strlen(get_home_url())+strlen(slash)+strlen(options_page);
		char* sp = (char*) malloc(len+1);
		sprintf(sp,"%s%s%s",get_home_url(),slash,options_page);

		RFs session;
		User::LeaveIfError(session.Connect());
		
		CCnvCharacterSetConverter *converter = CCnvCharacterSetConverter::NewL();
	  	converter->PrepareToConvertToOrFromL(KCharacterSetIdentifierUtf8, session);
	  
	  	TPtrC8 ptr((const unsigned char*)sp);

	  	int state = CCnvCharacterSetConverter::KStateDefault;
	  	converter->ConvertToUnicode(iOptionsPage, ptr, state);
		
	  	session.Close();
	  	
		free(sp);
	}
开发者ID:3runo5ouza,项目名称:rhodes,代码行数:28,代码来源:rhodesAppView.cpp

示例4: ConvertToUnicode

void ConvertToUnicode(RFs session, TDes16& aUnicode, const char *str)
{
  CCnvCharacterSetConverter *converter = CCnvCharacterSetConverter::NewL();
  converter->PrepareToConvertToOrFromL(KCharacterSetIdentifierUtf8, session);
  
  TPtrC8 ptr((const unsigned char*)str);

  int state = CCnvCharacterSetConverter::KStateDefault;
  converter->ConvertToUnicode(aUnicode, ptr, state);
}
开发者ID:evlinsky,项目名称:FBReader,代码行数:10,代码来源:os_symbian.cpp

示例5:

HBufC8* CRecogStep::ConvertDes16toHBufC8LC(TDesC& source)
	{
	HBufC8 *buf = HBufC8::NewL(source.Length());
	CleanupStack::PushL(buf);
	TPtr8 ptr=buf->Des();

	CCnvCharacterSetConverter *converter = CCnvCharacterSetConverter::NewLC();
	converter->PrepareToConvertToOrFromL(KCharacterSetIdentifierAscii, iTheFs);
	converter->ConvertFromUnicode(ptr, source);
	CleanupStack::PopAndDestroy(converter);
	return buf;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:12,代码来源:trecogstep.cpp

示例6: CALLSTACKITEM_N

void CLocaLogicImpl::ConstructL()
{
	CALLSTACKITEM_N(_CL("CLocaLogicImpl"), _CL("ConstructL"));

	iDevStats=CDevStats::NewL(AppContext(), iDb);
	iMessageStats=CMessageStats::NewL(AppContext(), iDb);
	iRemote=CLocaRemoteEvents::NewL(AppContext(), this);
	iAcceptedMessages=CAcceptedMsgs::NewL(iDb);

	iBBSubSession=BBSession()->CreateSubSessionL(this);
	iBBSubSession->AddNotificationL(KLocaScriptTuple, ETrue);

	iEvent.iData.SetValue(&iMsgStatus);
	iEvent.iData.SetOwnsValue(EFalse);
	iEvent.iPriority()=CBBSensorEvent::VALUE;

	GetSettingsL();

	Settings().NotifyOnChange(SETTING_LOCA_BLUEJACK_MAX_MESSAGES, this);
	Settings().NotifyOnChange(SETTING_LOCA_BLUEJACK_MAX_RETRIES, this);
	Settings().NotifyOnChange(SETTING_PUBLISH_AUTHOR, this);

	iInterpreter = CSPyInterpreter::NewInterpreterL();
	iCC=CCnvCharacterSetConverter::NewL();
	iCC->PrepareToConvertToOrFromL(KCharacterSetIdentifierIso88591, Fs());
	iFunctions=new (ELeave) CDesC8ArraySeg(4);
	iErrorFunctions=new (ELeave) CDesC8ArraySeg(4);
}
开发者ID:flaithbheartaigh,项目名称:jaikuengine-mobile-client,代码行数:28,代码来源:loca_logic.cpp

示例7: ay_sys_getstr

TFileName ay_sys_getstr(const unsigned char *str, unsigned long length)
{
    CCnvCharacterSetConverter *aCharacterSetConverter = CCnvCharacterSetConverter::NewL();
    RFs aFileServerSession;
    TUint aForeignCharacterSet = KCharacterSetIdentifierAscii;
    // check to see if the character set is supported - if not then leave
    if (aCharacterSetConverter->PrepareToConvertToOrFromL(aForeignCharacterSet,
                    aFileServerSession) != CCnvCharacterSetConverter::EAvailable)
    User::Leave(KErrNotSupported);
    // Create a small output buffer 
    TBuf16<20> outputBuffer;
    TFileName endBuffer;
    // Create a buffer for the unconverted text - initialised with the input descriptor
    TPtrC8 remainderOfForeignText(str, length);
    // Create a "state" variable and initialise it with CCnvCharacterSetConverter::KStateDefault
    // After initialisation the state variable must not be tampered with.
    // Simply pass into each subsequent call of ConvertToUnicode()
    TInt state=CCnvCharacterSetConverter::KStateDefault;
    for(;;) // conversion loop

    {
        // Start conversion. When the output buffer is full, return the number
        // of characters that were not converted
        const TInt returnValue=aCharacterSetConverter->ConvertToUnicode(outputBuffer, remainderOfForeignText, state);
        // check to see that the descriptor isn�t corrupt - leave if it is
        if (returnValue==CCnvCharacterSetConverter::EErrorIllFormedInput)
        User::Leave(KErrCorrupt);
        else if (returnValue<0) // future-proof against "TError" expanding
        User::Leave(KErrGeneral);

        // Do something here to store the contents of the output buffer.
        // Finish conversion if there are no unconverted 
        // characters in the remainder buffer
        endBuffer += outputBuffer;
        if (returnValue==0)
        break;
        
        // Remove converted source text from the remainder buffer.
        // The remainder buffer is then fed back into loop
        remainderOfForeignText.Set(remainderOfForeignText.Right(returnValue));
    }
    delete aCharacterSetConverter;
    return endBuffer;
}
开发者ID:fgroen,项目名称:ayfly,代码行数:44,代码来源:formats.cpp

示例8: ConvertToUnicodeFromGBK

//
//将中文字符转换成Unicode	
HBufC16* CCommonUtils::ConvertToUnicodeFromGBK(const TText8* aStr)
{	
	CCnvCharacterSetConverter* converter = CCnvCharacterSetConverter::NewLC();

	if( converter->PrepareToConvertToOrFromL(KCharacterSetIdentifierGbk,CEikonEnv::Static()->FsSession()) != CCnvCharacterSetConverter::EAvailable)
	{
		delete converter;
		return NULL;
	}

	//TText8  *str = (TText8*)"诺基亚7650C";
	TInt state= CCnvCharacterSetConverter::KStateDefault;

	TPtrC8 source( aStr );
	HBufC* ret = HBufC::NewLC( source.Length() );
	TPtr16 ptr = ret->Des();
	converter->ConvertToUnicode(ptr, source, state);
	CleanupStack::Pop(ret);

	return ret;
}
开发者ID:flaithbheartaigh,项目名称:lemonplayer,代码行数:23,代码来源:CommonUtils.cpp

示例9: CleanupClosePushL

// -----------------------------------------------------------------------------
// CSTSPinConverter::ConvertToUTF8L
//
// -----------------------------------------------------------------------------
void CSTSPinConverter::ConvertToUTF8L(const TDesC& aPinValue,
                                      TPtr8& aConvertedPIN, TBool aUpperCase)
{

    // RFs for CCnvCharacterSetConverter
    RFs fsSession;
    User::LeaveIfError(fsSession.Connect());
    CleanupClosePushL(fsSession);

    CCnvCharacterSetConverter* converter = CCnvCharacterSetConverter::NewLC();

    // transform pin to UTF8
    if (converter->PrepareToConvertToOrFromL(KCharacterSetIdentifierUtf8,
            fsSession) != CCnvCharacterSetConverter::EAvailable)
    {
        User::Leave(KErrNotSupported);
    }

    TInt error = converter->ConvertFromUnicode(aConvertedPIN, aPinValue);

    // check to see that the descriptor isn’t corrupt - leave if it is
    if (error == CCnvCharacterSetConverter::EErrorIllFormedInput)
    {
        User::Leave(KErrCorrupt);
    }
    if (error < 0)
    {
        User::Leave(KErrGeneral);
    }

    //convert to uppercase
    if (aUpperCase)
    {
        aConvertedPIN.UpperCase();
    }

    CleanupStack::PopAndDestroy(converter);
    CleanupStack::PopAndDestroy(&fsSession);

}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:44,代码来源:cstspinconverter.cpp

示例10: FromUnicodeL

// ============================================================================
// CWidgetBackupRegistryXml::FromUnicodeL
// Utility to bundle transcoding to unicode steps.
//
// @since 5.0
// @param aEncoding input buffer encoding
// @param aUnicodeSizeMultiplier how many bytes of input make one unicode char
// @param aInBuf input data in encoding
// @param aOutBuf malloc'ed output buf, caller takes ownership
// @param aFileSession CCnvCharacterSetConverter requires it
// ============================================================================
//
void CWidgetBackupRegistryXml::FromUnicodeL( TInt aEncoding,
                                     TInt aUnicodeSizeMultiplier,
                                     TPtrC16 aInBuf, HBufC8** aOutBuf,
                                     RFs& aFileSession )
    {
    *aOutBuf = NULL;

    // outbuf sizing and alloction
    HBufC8* outBuf = HBufC8::NewLC(aUnicodeSizeMultiplier * (aInBuf.Length() + 1));
    TPtr8 outPtr = outBuf->Des();

    // convert from unicode
    CCnvCharacterSetConverter* charConv = CCnvCharacterSetConverter::NewLC();
    charConv->PrepareToConvertToOrFromL( aEncoding, aFileSession );
    User::LeaveIfError(
        charConv->ConvertFromUnicode( outPtr, aInBuf));
    outPtr.ZeroTerminate();
    CleanupStack::PopAndDestroy( charConv );

    CleanupStack::Pop( outBuf ); 
    *aOutBuf = outBuf;
    }
开发者ID:gvsurenderreddy,项目名称:symbiandump-mw4,代码行数:34,代码来源:WidgetBackupRegistryXml.cpp

示例11: ToUnicodeL

// ============================================================================
// CWidgetUIConfigHandler::ToUnicodeL
// Utility to bundle transcoding to unicode steps.
//
// @since 3.1
// @param aEncoding input buffer encoding
// @param aUnicodeSizeMultiplier how many bytes of input make one unicode char
// @param aInBuf input data in encoding
// @param aOutBuf malloc'ed output buf, caller takes ownership
// @param aFileSession CCnvCharacterSetConverter requires it
// ============================================================================
//
void CWidgetUIConfigHandler::ToUnicodeL( TInt aEncoding,
                                         TInt aUnicodeSizeMultiplier,
                                         TPtrC8 aInBuf, HBufC16** aOutBuf,
                                         RFs& aFileSession )
    {
    *aOutBuf = NULL;

    // outbuf sizing and alloction
    HBufC16* outBuf = HBufC16::NewLC(aUnicodeSizeMultiplier * aInBuf.Length());
    TPtr16 outPtr = outBuf->Des();

    // convert to unicode
    CCnvCharacterSetConverter* charConv = CCnvCharacterSetConverter::NewLC();
    charConv->PrepareToConvertToOrFromL( aEncoding, aFileSession );
    TInt state = CCnvCharacterSetConverter::KStateDefault;
    TInt rep = 0; // number of unconvertible characters
    TInt rIndx = 0; // index of first unconvertible character
    User::LeaveIfError(
        charConv->ConvertToUnicode( outPtr, aInBuf, state, rep, rIndx ) );
    CleanupStack::PopAndDestroy( charConv );

    CleanupStack::Pop(); // outBuf
    *aOutBuf = outBuf;
    }
开发者ID:gvsurenderreddy,项目名称:symbiandump-mw4,代码行数:36,代码来源:WidgetUIConfigHandler.cpp

示例12: ConvertFromPythonString

void CLocaLogicImpl::ConvertFromPythonString(TDes& aBuf, PyObject* aString)
{
	aBuf.Zero();
	if (PyString_Check(aString)) {
		TInt state=CCnvCharacterSetConverter::KStateDefault;
		TInt len=PyString_Size(aString);
		if (len > aBuf.MaxLength()) len=aBuf.MaxLength();
		iCC->ConvertToUnicode(aBuf, TPtrC8((TUint8*)PyString_AsString(aString), 
			len), state);
	} else if (PyUnicode_Check(aString)) {
		TInt len=PyUnicode_GetSize(aString)/2;
		if (len > aBuf.MaxLength()) len=aBuf.MaxLength();
		aBuf=TPtrC((TUint16*)PyUnicode_AsUnicode(aString), len);
	}
}
开发者ID:flaithbheartaigh,项目名称:jaikuengine-mobile-client,代码行数:15,代码来源:loca_logic.cpp

示例13: CalcHashValueL

//
// Calculate a hash value for each server entry
// 
TBool CEmailNotificationParser::CalcHashValueL(CCnvCharacterSetConverter& aCharConv, const TDesC8& aUserName, const TDesC& aServerName, const TDesC8& aPortNum)
	{
	TInt total = 0;
	TInt loop = 0;
	TInt unConvertChar;
	TInt posOfUnconv;

	delete iServerName;
	iServerName = NULL;
	iServerName = HBufC8::NewL(aServerName.Length());

	TPtr8 svr = iServerName->Des();
	aCharConv.ConvertFromUnicode( svr, aServerName, unConvertChar,posOfUnconv);

	// Fix for DEF044588: the Smart Messaging Specification (Revision 3.0.0) states (page 3-17) that
	// the value of the first character of S is multiplied by one, second character by two etc.
	for(loop = 0; loop < aUserName.Length(); loop++)
		{
		total += ( (loop+1) * (TUint)aUserName[loop]);
		}

	TInt pos = aUserName.Length();

	for(loop = 0; loop < svr.Length(); loop++)
		{
		total += ( (pos + (loop+1) )* (TUint)svr[loop]);
		}

	pos += aServerName.Length();

	for(loop = 0; loop < aPortNum.Length(); loop++)
		{
		total += ( (pos + (loop+1) )* (TUint)aPortNum[loop]);
		}

	TReal hashVal;
	User::LeaveIfError(Math::Mod(hashVal, total, KServerIdModVal));
	return ((TInt)hashVal == iServerId);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:42,代码来源:ENP.CPP

示例14: TestGetBodyTextL

LOCAL_C TBool TestGetBodyTextL()
	{
	__UHEAP_MARK;
	// Retrieve the store from the current context... 
	CMsvStore* store = pContext->EditStoreL();
	CleanupStack::PushL(store);
	
	// Populate CMsvBodyText from the data in the store...
	CMsvBodyText* obj = CMsvBodyText::NewLC();
	obj->RestoreL(*store);
	
	// Create a rich text object...
	CParaFormatLayer* paraLayer = CParaFormatLayer::NewL();
	CleanupStack::PushL(paraLayer);
	CCharFormatLayer* charLayer = CCharFormatLayer::NewL();
	CleanupStack::PushL(charLayer);
	CRichText* richText = CRichText::NewL(paraLayer, charLayer);
	CleanupStack::PushL(richText);
	
	// Create an array of available character sets...
	CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* charSets;
	CCnvCharacterSetConverter* converter = CCnvCharacterSetConverter::NewL();
	CleanupStack::PushL(converter);
	charSets = converter->CreateArrayOfCharacterSetsAvailableLC(gFs);
	
	// For each available character set, call GetBodyTextL...
	TInt i;
	for (i = 0; i < charSets->Count(); i++)
		{
		// Over-ride the stored character set.
		obj->SetCharacterSet((*charSets)[i].Identifier());
		// Convert the 8 bit data to the specified character set.
		obj->GetBodyTextL(gFs, *store, *richText);
		test(richText->HasChanged());
		richText->Reset();
		}
	
	// Instead of decoding 10 bytes of data, increase the amount of data to 4000 bytes.
	obj->SetCharacterSet(0);
	obj->SetDefaultCharacterSet((*charSets)[0].Identifier());
	const TInt KTextBufferSize=4000;
	CBufBase *buffer=CBufFlat::NewL(KTextBufferSize);
	CleanupStack::PushL(buffer);
	while(buffer->Size()<KTextBufferSize)
		{
		buffer->InsertL(buffer->Size(),K10BytesData);
		}

	obj->StoreL(*store, *buffer);
	CleanupStack::PopAndDestroy(buffer);
	store->CommitL();
	obj->RestoreL(*store);
	obj->GetBodyTextL(gFs, *store, *richText);
	test(richText->HasChanged());
	
	// Clean up and release resources...
	CleanupStack::PopAndDestroy(charSets);
	CleanupStack::PopAndDestroy(converter);
	CleanupStack::PopAndDestroy(richText);
	CleanupStack::PopAndDestroy(charLayer);
	CleanupStack::PopAndDestroy(paraLayer);
	CleanupStack::PopAndDestroy(obj);
	CleanupStack::PopAndDestroy(store);
	__UHEAP_MARKEND;
		
	return ETrue;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:67,代码来源:T_CMsvBodyText.cpp

示例15: GetEmailServicesL

//
// Get all email services
//
void CEmailNotificationParser::GetEmailServicesL()
	{

	CCnvCharacterSetConverter* charconv = CCnvCharacterSetConverter::NewL();
	CleanupStack::PushL(charconv);
	CArrayFix<CCnvCharacterSetConverter::SCharacterSet> *charsetsAvailable = charconv->CreateArrayOfCharacterSetsAvailableL(iFs);
	CleanupStack::PushL(charsetsAvailable);

	charconv->PrepareToConvertToOrFromL(KUidCharsetISO88591,*charsetsAvailable,iFs);
	
	const TMsvId current = iEntry.Entry().Id();
	iEntry.SetEntryL(KMsvRootIndexEntryId);
	// Get all POP3 and Imap services
	CMsvEntrySelection* rootChildren = iEntry.ChildrenL();
	CleanupStack::PushL(rootChildren);

	TMsvEntry entry;

	CEmailAccounts* accounts = CEmailAccounts::NewLC();

	const TInt count = rootChildren->Count(); 
	TInt j =0;
	while(j < count && iFoundServer ==EFalse)
		{
		// set context to service entry
		iEntry.SetEntryL((*rootChildren)[j]);
		entry = iEntry.Entry(); 
		if (entry.iType == KUidMsvServiceEntry && (entry.iMtm == KUidMsgTypePOP3 || entry.iMtm == KUidMsgTypeIMAP4))
			{
			TBuf8<8> port;

			if(entry.iMtm == KUidMsgTypePOP3)
				{
				// calculate hash value
				CImPop3Settings* settings = new(ELeave)CImPop3Settings;
				CleanupStack::PushL(settings);
 
 				TPopAccount id;
				accounts->GetPopAccountL(entry.Id(), id);
				accounts->LoadPopSettingsL(id, *settings);

				port.Num((TUint)KPOP3DefaultPortNumber);
				iFoundServer = CalcHashValueL( *charconv, settings->LoginName(), settings->ServerAddress(), port);
				}
			else // entry.iMtm == KUidMsgTypeIMAP4
				{
				CImImap4Settings* settings = new(ELeave)CImImap4Settings;
				CleanupStack::PushL(settings);
				
 				TImapAccount id;
				accounts->GetImapAccountL(entry.Id(), id);
				accounts->LoadImapSettingsL(id, *settings);

				port.Num((TUint)KIMAPDefaultPortNumber);
				iFoundServer = CalcHashValueL( *charconv, settings->LoginName(), settings->ServerAddress(), port);
				}
			CleanupStack::PopAndDestroy(); // settings
			}
		j++;
		}

	if(	iFoundServer )
		iServiceMsvId = entry.Id();

	CleanupStack::PopAndDestroy(4, charconv); // charconv, charsetsAvailable, rootChildren, accounts
	
	iEntry.SetEntryL(current);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:71,代码来源:ENP.CPP


注:本文中的CCnvCharacterSetConverter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。