本文整理汇总了C++中CCnvCharacterSetConverter::PrepareToConvertToOrFromL方法的典型用法代码示例。如果您正苦于以下问题:C++ CCnvCharacterSetConverter::PrepareToConvertToOrFromL方法的具体用法?C++ CCnvCharacterSetConverter::PrepareToConvertToOrFromL怎么用?C++ CCnvCharacterSetConverter::PrepareToConvertToOrFromL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCnvCharacterSetConverter
的用法示例。
在下文中一共展示了CCnvCharacterSetConverter::PrepareToConvertToOrFromL方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConstructL
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);
}
示例2: InitOptions
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);
}
示例3: 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);
}
示例4:
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;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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);
}
示例8: 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;
}
示例9: 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;
}
示例10: 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);
}