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


C++ TDesC::Length方法代码示例

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


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

示例1: StartApplicationL

	EXPORT_C void StartApplicationL(const TUid& aUid, const TDesC& aDocumentName, TInt aRetryInterval, TApaCommand aCommand)
	{
		TUid appToBeStarted = aUid;
		TInt pushed=0;
#ifdef DEBUG
		RFs fs; User::LeaveIfError(fs.Connect()); 
		CleanupClosePushL(fs); pushed++;
		RFile f; User::LeaveIfError(f.Replace(fs, _L("c:\\processmanagement.txt"), EFileWrite));
		CleanupClosePushL(f); pushed++;

		f.Write(_L8("starting\n"));
#endif
		TInt retries=0;
		LOG(_L8("new'ing ls session..."));
		RApaLsSession *lsp;
		lsp=new (ELeave) RApaLsSession;
		LOG(_L8("\n"));
		CleanupStack::PushL(lsp); ++pushed;
		RApaLsSession& ls(*lsp);

		while(retries<80) {
			TInt i_pushed=0;
			LOG(_L8("connecting ls session..."));
			TInt err=ls.Connect();
			LOG(_L8(": "));
			TBuf8<12> msg; msg.Num(err); msg.Append(_L("\n"));
			LOG(msg);
			if (err==KErrNone) {
				CleanupClosePushL(ls); ++i_pushed;
				pushed+=i_pushed;
				break;
			} else {
				CleanupStack::PopAndDestroy(i_pushed);
			}
			LOG(_L8("waiting..."));
			retries++;
			User::After(TTimeIntervalMicroSeconds32(aRetryInterval*1000));
			LOG(_L8("done.\n"));
		}
		LOG(_L8("ls session created\n"));

		LOG(_L8("creating info..."));
		TApaAppInfo* infop=0;
		infop=new (ELeave) TApaAppInfo;
		LOG(_L8("1 "));
		CleanupStack::PushL(infop); ++pushed;
		LOG(_L8("2 "));
		TApaAppInfo& info(*infop);
		LOG(_L8("done\n"));
	
		RWsSession ws;
		User::LeaveIfError(ws.Connect());
		CleanupClosePushL(ws); ++pushed;
		TApaTaskList tl(ws);
		TApaTask app_task=tl.FindApp(aUid);
		TBool exists=app_task.Exists();
		while( !exists && retries<80) {
			TInt pushed=0;

			LOG(_L8("getting info..."));
			TInt err=ls.GetAppInfo(info, appToBeStarted);
			LOG(_L8("done: "));
			TBuf8<12> msg; msg.Num(err); msg.Append(_L("\n"));
			LOG(msg);
			if (err==KErrNone) {
#ifndef __S60V3__
				CApaCommandLine* cmd=CApaCommandLine::NewLC(info.iFullName); pushed++;
#else
				CApaCommandLine* cmd=CApaCommandLine::NewLC(); pushed++;
				cmd->SetExecutableNameL(info.iFullName);
#endif
				cmd->SetCommandL( aCommand );
				if ( aDocumentName.Length() > 0 )
					{					
					cmd->SetDocumentNameL(aDocumentName);
					}
#ifndef __S60V3__
				TRAP(err, EikDll::StartAppL(*cmd));
#else
				err=ls.StartApp(*cmd);
#endif
				CleanupStack::PopAndDestroy(pushed);
				LOG(_L8("StartAppL: "));
				msg.Num(err); msg.Append(_L("\n"));
				LOG(msg);
				if (err==KErrNone) break;	
			} else {
				LOG(_L8("popping..."));
				CleanupStack::PopAndDestroy(pushed);
				LOG(_L8("done\n"));
			}
			LOG(_L8("waiting..."));
			retries++;
			User::After(TTimeIntervalMicroSeconds32(aRetryInterval*1000));
			LOG(_L8("done.\n"));
		}
		LOG(_L8("done\n"));
		CleanupStack::PopAndDestroy(pushed);
	}
开发者ID:flaithbheartaigh,项目名称:jaikuengine-mobile-client,代码行数:99,代码来源:cc_processmanagement.cpp

示例2: GetCommandStringParameterL

/**
 * Reads the parameter	asociated to the specified command
 * @param aSectName	Section on ini file
 * @param aKeyName		Name of the parameter
 * @param aResult			descriptor containing parameter
 * @return TBool  ETrue for found, EFalse for not found 
 */
TBool CDataWrapperBase::GetCommandStringParameterL(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult)
	{
	TBool	ret=EFalse;

	if ( aSectName.Length()!=0 )
		{
		ret=CDataWrapper::GetStringFromConfig(aSectName, aKeyName, aResult);

		for ( TInt index=iInclude.Count(); (index>0) && (!ret); )
			{
			ret=iInclude[--index]->FindVar(aSectName, aKeyName, aResult);
			}
		}

	if ( ret )
		{
		if ( aResult.Match(KMatch)!=KErrNotFound )
			{
			//	We have an entry of the format
			//	entry =*{section,entry}*
			//	where * is one or more characters
			//	We need to construct this from other data in the ini file replacing {*,*}
			//	with the data from
			//	[section]
			//	entry =some_value
			HBufC*	buffer=HBufC::NewLC(aResult.Length());
			buffer->Des().Copy(aResult);

			TInt	startLength=KStart().Length();
			TInt	sparatorLength=KSeparator().Length();
			TInt	endLength=KEnd().Length();
			TInt	bufferLength;
			TInt	start;
			TInt	sparator;
			TInt	end;
			TPtrC	remaining;
			TLex	lex;
			do
				{
				bufferLength=buffer->Length();
				start=buffer->Find(KStart);

				remaining.Set(buffer->Des().Right(bufferLength-start-startLength));
				sparator=remaining.Find(KSeparator);
				remaining.Set(remaining.Right(remaining.Length()-sparator-sparatorLength));
				sparator += (start + startLength);

				end=remaining.Find(KEnd) + sparator + sparatorLength;

				TPtrC	sectionName(buffer->Ptr()+start+startLength, sparator-start-startLength);
				TPtrC	keyName(buffer->Ptr()+sparator+sparatorLength, end-sparator-sparatorLength);
				sectionName.Set(TLex(sectionName).NextToken());
				keyName.Set(TLex(keyName).NextToken());

				TInt	entrySize=0;
				TPtrC	entryData;
				TBool	found=CDataWrapper::GetStringFromConfig(sectionName, keyName, entryData);
				for ( TInt index=iInclude.Count(); (index>0) && (!found);  )
					{
					found=iInclude[--index]->FindVar(sectionName, keyName, entryData);
					}
				if ( found )
					{
					entrySize=entryData.Length();
					}

				TInt	newLength=start + bufferLength - end - endLength + entrySize;
				HBufC*	bufferNew=HBufC::NewLC(newLength);
				bufferNew->Des().Copy(buffer->Ptr(), start);
				if ( entrySize>0 )
					{
					bufferNew->Des().Append(entryData);
					}
				bufferNew->Des().Append(buffer->Ptr() + end + endLength, bufferLength - end - endLength);
				CleanupStack::Pop(bufferNew);
				CleanupStack::PopAndDestroy(buffer);
				buffer=bufferNew;
				CleanupStack::PushL(buffer);
				}
			while ( buffer->Match(KMatch)!=KErrNotFound );
			iBuffer.Append(buffer);
			CleanupStack::Pop(buffer);
			aResult.Set(*buffer);
			INFO_PRINTF4(KDataRead, &aSectName, &aKeyName , &aResult);
			}
		}

	return ret;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:96,代码来源:datawrapperbase.cpp

示例3: IsPluginInRom

TInt RCdlSession::IsPluginInRom(const TDesC& aFileName, TBool& aIsInRom) const
	{
	TPckg<TBool> isInRom(aIsInRom);
	TIpcArgs p(&aFileName, aFileName.Length(), &isInRom);
	return SendReceive(ECdlServCmdIsPluginInRom, p);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:6,代码来源:CdlClient.cpp

示例4: DrawCharJustified

void CTextWindow::DrawCharJustified(const TDesC &aText)
	{
	iGc->SetCharJustification(Size().iWidth-10-iTmpFont->TextWidthInPixels(aText),aText.Length()-1);
	PrintLine(iTmpFont, aText);
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:5,代码来源:TTEXT.CPP

示例5: ParseStartAndEndPos

/*
-------------------------------------------------------------------------------

    Class: CStifSectionParser

    Method: ParseStartAndEndPos

    Description: Start and end position parser.

    Parameters: TPtrC aSection: in: Parsed section
                const TDesC& aStartTag: in: Start tag of parsing
                TTagToReturnValue aTagIndicator: in: Will aStartTag included to
                the returned values
                TInt& aStartPos: inout: Start point of parsing
                TInt& aEndPos: inout: End point of parsing
                TInt& aLength: inout: Length of parsed section

    Return Values: TInt: Error code

    Errors/Exceptions: None

    Status: Proposal

-------------------------------------------------------------------------------
*/
TInt CStifSectionParser::ParseStartAndEndPos( TPtrC aSection,
                                            const TDesC& aStartTag,
                                            TTagToReturnValue aTagIndicator,
                                            TInt& aStartPos,
                                            TInt& aEndPos,
                                            TInt& aLength )
    {
    TLex lex( aSection );
    lex.SkipAndMark( iSkipAndMarkPos );

    // Check is aStartTag given
    if ( aStartTag.Length() == 0 )
        {
        // Skip line break, tabs, spaces etc.
        lex.SkipSpace();
        aStartPos = lex.Offset();
        }
    else
        {
        // While end of section and aStartTag is given
        while ( !lex.Eos() )
            {
            lex.SkipSpace();
            TPtrC line = SubstractLine( lex.Remainder() );
            TInt tagStartPos = 0;
            TInt tagEndPos = 0;
            if ( FindTag( line, aStartTag, tagStartPos, tagEndPos ) == KErrNone )
            	{
            	if ( aTagIndicator == ETag )
            		{
            		aStartPos = lex.Offset();
            		}
            	else
            		{
            		aStartPos = lex.Offset() + tagEndPos;
            		if ( line.Length() - tagEndPos == 0 )
            			{
            			return KErrNotFound;
            			}
            		}
            	break;
            	}
                
            GotoEndOfLine( lex );
            }
        }

    // End tag parsing starts and if we are end of the section
    if( lex.Eos() )
        {
        return KErrNotFound;
        }

    // "Delete" white spaces(includes line break) 
    aEndPos = GotoEndOfLine( lex );
    // Position where start next parsing.(End position, includes white spaces)
    iSkipAndMarkPos = lex.Offset();
    // The length includes spaces and end of lines
    aLength = ( aEndPos - aStartPos );

    return KErrNone;

    }
开发者ID:fedor4ever,项目名称:testfw,代码行数:88,代码来源:StifSectionParser.cpp

示例6: SetItemIdStrAttributeL

// -----------------------------------------------------------------------------
// CAtomFeedParser::SetItemIdStrAttributeL
//
// Determine and set the unique IdStr attribute (unique to the feed that is).
// -----------------------------------------------------------------------------
//
void CAtomFeedParser::SetItemIdStrAttributeL(TXmlEngElement aItemNode, 
        MFeedParserObserver& aObserver)
    {    
    const TInt  KStrChunk = 30;
    
    TDesC*    content = NULL;
    TDesC*    summary = NULL;
    TDesC*    description = NULL;
    TDesC*    title = NULL;
    HBufC*    url = NULL;
    HBufC*    idStr = NULL;
    TXmlEngElement  node;

    // If the id node is present use it.
    node = iXmlUtils.GetFirstNamedChild(aItemNode, KId);
    if (node.NotNull())
        {
        ElementHandlerCDataL(*this, iXmlUtils, node, EItemAttributeIdStr, aObserver);        
        return;
        }

    // Otherwise create a idStr from the first 30 chars of the description and title
    // and the last 30 chars of the url.  This doesn't guarantee a unique id, but 
    // it very likely.
    node = iXmlUtils.GetFirstNamedChild(aItemNode, KSummary);
    summary = iXmlUtils.ExtractSimpleTextL(node, KStrChunk);
    CleanupStack::PushL(summary);
        
    node = iXmlUtils.GetFirstNamedChild(aItemNode, KContent);
    content = iXmlUtils.ExtractSimpleTextL(node, KStrChunk);
    CleanupStack::PushL(content);

    node = iXmlUtils.GetFirstNamedChild(aItemNode, KTitle);
    title = iXmlUtils.ExtractSimpleTextL(node, KStrChunk);
    CleanupStack::PushL(title);
    
    node = iXmlUtils.GetFirstNamedChild(aItemNode, KLink);
    url = iXmlUtils.ExtractSimpleTextL(node, KStrChunk, ETrue);
    CleanupStack::PushL(url);

    // Determine whether content or summary will be used for the description.
    description = summary;
    
    if (content != NULL)
        {
        if (summary == NULL)
            {
            description = content;
            }
        else if (content->Length() > summary->Length())
            {
            description = content;
            }
        }

    // Construct the idStr from the parts.
    TInt  len = 0;
    
    if (description != NULL)
        {
        len += description->Length();
        }
    if (title != NULL)
        {
        len += title->Length();
        }
    if (url != NULL)
        {
        len += url->Length();
        }
    
    idStr = HBufC::NewL(len);
    CleanupStack::PushL(idStr);

    TPtr  ptr(idStr->Des());
    
    if (description != NULL)
        {
        ptr.Append(*description);
        }
    if (title != NULL)
        {
        ptr.Append(*title);
        }
    if (url != NULL)
        {
        ptr.Append(*url);
        }
        
    // Replace any chars that may interfere with the database.
    _LIT(KSpace, " ");
    
    for (TInt i = 0; i < ptr.Length(); i++)
        {
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:101,代码来源:AtomFeedParser.cpp

示例7: Formater

/**
Finds the keystring from the source string and replaces it with the
replacement string. The formated string is stored in the destination
descriptor.
*/
TInt CResourceLoader::Formater(TDes& aDest, const TDesC& aSource, const TDesC& aKey, const TDesC& aSubs, TBidiText::TDirectionality aDirectionality)    
    {
    // substitute string must not contain KSubStringSeparator, 
    // or results will be unpredictable 
    __ASSERT_DEBUG(aSubs.Locate(KSubStringSeparator) == KErrNotFound, 
        User::Panic(KPanicCategory, EInvalidSubstitute));

    TInt keylength(aKey.Length());

    //aDest must be empty.
    aDest.Zero();

    // offset indicates end of last handled key in source
    TInt offset(0);

    // offset in destination string
    TInt desOffset(0);

    // Substring directionalities are adjusted after all changes are done.
    TBool checkSubstringDirectionalities(EFalse);

    // count is the position in the source from which the substring starts
    TInt count(0);

    // Replaced parameters count
    TInt replaceCount(0);

    while (count != KErrNotFound)
        {
        // desCount is the position of the substring starts in destination.
        TInt desCount(0);

        TPtrC remainder = aSource.Right(aSource.Length() - offset);
        count = remainder.Find(aKey);

        TInt maxSubLength = -1;
        if (count != KErrNotFound)
            {
            replaceCount++;
            desOffset += count;
            offset += count;
            count = offset;
            desCount = desOffset;

            // copy source to destination if first time
            if (aDest.Length() == 0)
                aDest.Append(aSource);

            // delete found key from destination
            aDest.Delete(desCount, keylength);

            offset += keylength; // increase offset by key length

            if (count + keylength < (aSource.Length()-1)) // aKey is not at the end of string
                {
                if (aSource[count+keylength] == '[') // Key includes max datalength
                    {
                    maxSubLength = 10*(aSource[count+keylength+1]-'0') 
                                   + (aSource[count+keylength+2]-'0');
                    aDest.Delete(desCount,4); // Length information stored->delete from descriptor
                    offset += 4; // increase offset by max sub length indicator
                    }
                }
         
            aDest.Insert(desCount, aSubs);
        
            desOffset = desCount + aSubs.Length();

            if (maxSubLength > 0 && aSubs.Length() > maxSubLength)
                {
                aDest.Delete(desCount+maxSubLength-1, aSubs.Length()+1-maxSubLength);     
                TText ellipsis(KEllipsis);
                aDest.Insert(desCount+maxSubLength-1, TPtrC(&ellipsis,1));
                desOffset = desCount + maxSubLength;
                }

            TBidiText::TDirectionality subsDir =
                TBidiText::TextDirectionality(aDest.Mid(desCount, desOffset - desCount));

            // If inserted string has different directionality,
            // insert directionality markers so that bidi algorithm works in a desired way.
            if (aDirectionality != subsDir)
                {
                checkSubstringDirectionalities = ETrue;

                TInt freeSpace = aDest.MaxLength() - aDest.Length();

                // Protect the directionality of the inserted string.
                if (freeSpace >= KExtraSpaceForSubStringDirMarkers)
                    {
                    TBuf<1> subsMarker;
                    subsMarker.Append(subsDir == TBidiText::ELeftToRight ?
                        KLRMarker : KRLMarker);

                    aDest.Insert(desOffset, subsMarker);
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:101,代码来源:basepluginresourceloader.cpp

示例8: preferenceL

// ----------------------------------------------------------------------------
// WidgetPreferences::PreferenceL
// Get preference for a key
//
//
// ----------------------------------------------------------------------------
TInt WidgetPreferences::preferenceL( const TDesC& akey, HBufC*& avalue)
{

    TInt rSuccess = KErrNotFound;
    TInt size = 0;

    if ( !m_basepath || (m_basepath->Length() <= 0) )
        return rSuccess;


    if ( akey.Length() <= KMaxKeyValueSize ) {

        HBufC* k = HBufC::NewLC( akey.Length() + KMaxIntLength + 1 );
        k->Des().Format( KKeyFormat, m_widgetid, &akey );

        PrefElement* pref = m_preferences->Find( *k );

        if ( !pref ) {
            CleanupStack::PopAndDestroy( k );
            return rSuccess;
        }

        size = pref->valueSize();

        if ( size > KMaxKeyValueSize ) {
            // return contents from temp file whose name is stored
            // in the m_value member of m_preferences
            RFs fs;

            if ( fs.Connect() == KErrNone ) {
                CleanupClosePushL( fs );
                HBufC* filePath = HBufC::NewLC( pref->value().Length() );
                TPtr fName( filePath->Des() );
                fName.Append( pref->value() );

                RFileReadStream readStream;

                if ( readStream.Open( fs, *filePath, EFileRead ) == KErrNone ) {
                    CleanupClosePushL( readStream );
                    TInt len( readStream.ReadInt32L() );
                    if ( len > 0 ) {
                        HBufC* v = HBufC::NewLC( len );
                        TPtr ptrvalue = v->Des();
                        readStream.ReadL( ptrvalue, len );
                        avalue = v; // ownership xfered
                        CleanupStack::Pop( v );
                        rSuccess = KErrNone;
                    }
                    CleanupStack::PopAndDestroy();//readStream
                }

                CleanupStack::PopAndDestroy( 2 ); //filePath,fs
            }
        }
        else if ( size >= 0 ) {
            avalue = pref->value().AllocL();
            rSuccess = KErrNone;
        }

        CleanupStack::PopAndDestroy( k );
    }

    return rSuccess;

}
开发者ID:kuailexs,项目名称:symbiandump-mw4,代码行数:71,代码来源:Preferences.cpp

示例9: setPreferenceL

// ----------------------------------------------------------------------------
// WidgetPreferences::SetPreferenceL
// set Preference for a key
//
//
// ----------------------------------------------------------------------------
void WidgetPreferences::setPreferenceL( const TDesC& akey, const TDesC& avalue)
{
    if ( !m_basepath || (m_basepath->Length() <= 0) )
        return;

    if ( akey.Length() <= KMaxKeyValueSize ) {

        HBufC* k = HBufC::NewLC( akey.Length() + KMaxIntLength + 1 );
        k->Des().Format( KKeyFormat, m_widgetid, &akey );

        // if hash has the key and its value
        // delete the old value later when the new value was successfully updated
        PrefElement* prefExisting = NULL;
        prefExisting = m_preferences->Find( *k );

        if ( avalue.Length() <= KMaxKeyValueSize ) {
            PrefElement* pref = new (ELeave) PrefElement;
            CleanupStack::PushL( pref );
            pref->setValueL( avalue );
            pref->setValueSize( avalue.Length() );
            m_preferences->InsertL( k, pref );
            CleanupStack::Pop(); //pref
        }
        else {
            // create a temp file and save the value in temp file.
            // m_value member of PrefElement contains the temp file name.
            RFs fs;
            RFile file;
            if ( fs.Connect() == KErrNone ) {
                CleanupClosePushL( fs );

                // create and write to file
                TFileName tempFileName;
                file.Temp( fs, *m_basepath, tempFileName, EFileWrite|EFileShareExclusive );
                CleanupClosePushL( file );
                HBufC* filePath = HBufC::NewLC( tempFileName.Length() );
                TPtr fName( filePath->Des() );
                fName.Append( tempFileName );
                RFileWriteStream writeStream( file );
                CleanupClosePushL( writeStream );
                TRAPD( err,
                       writeStream.WriteInt32L( avalue.Length() );
                       writeStream.WriteL( avalue );
                       writeStream.CommitL(); );
                // If an error occured while writing to the file, delete the temp file
                // This should be the case when disk is full
                if ( err != KErrNone )
                {
                    CleanupStack::PopAndDestroy( ); //writeStream
                    file.Close();
                    fs.Delete( *filePath );
                    User::Leave( err );
                }

                // create new preference element
                PrefElement* pref = new ( ELeave ) PrefElement;
                CleanupStack::PushL( pref );
                pref->setValueSize( avalue.Length() );
                pref->setValueL( *filePath );
                // update new preference element
                m_preferences->InsertL( k, pref );

                CleanupStack::Pop( pref );
                CleanupStack::PopAndDestroy( ); //writeStream
                CleanupStack::PopAndDestroy( 3 ); //filePath,file,fs
            }
开发者ID:kuailexs,项目名称:symbiandump-mw4,代码行数:72,代码来源:Preferences.cpp

示例10: ConstructL

// ---------------------------------------------------------
// CContextbookContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CContextbookContainer::ConstructL(const TRect& aRect, phonebook_i* i_book, bool i_searchable, const TDesC& title, Cfile_output_base * aLog, CAknIconArray * aIconlist, TInt current_item_index, TInt top_item_index, TBuf<20> current_filter)
{
	CALLSTACKITEM(_L("CContextbookContainer::ConstructL"));

	iCurrentContactId=KErrNotFound;

	iconlist = new (ELeave) CAknIconArray(30);
	//copy
	for (TInt i = 0; i< aIconlist->Count();i++)
	{
		CGulIcon * ic, *icon_from; 
		icon_from= (*aIconlist)[i];
		ic=CGulIcon::NewL( icon_from->Bitmap(), icon_from->Mask());
		ic->SetBitmapsOwnedExternally(ETrue);
		iconlist->AppendL( ic );
	}
	
	iLog = aLog;
	CreateWindowL();

	CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
	CAknTitlePane* tp=(CAknTitlePane*)sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle));

	HBufC* t=HBufC::NewL(title.Length());
	*t=title;
	tp->SetText(t);

	if (iLog) {
		iLog->write_time();
		iLog->write_to_output(_L("Showing "));
		iLog->write_to_output(title);
		iLog->write_nl();
	}

	sendui=CSendAppUi::NewL(0);

	searchable=i_searchable;

	resource_files=new (ELeave) CArrayFixFlat<TInt>(5);

	// for phonebook dialogs
	TFileName resfile=_L("z:\\System\\data\\PBKVIEW.rSC");
	BaflUtils::NearestLanguageFile(iEikonEnv->FsSession(), resfile); //for localization
	resource_files->AppendL(iEikonEnv->AddResourceFileL(resfile)); 
	
	book=i_book;
	book->set_observer(this);

	listbox=new (ELeave) doublelinebox(book,iLog);
	listbox->SetContainerWindowL(*this);
	listbox->ConstructL(this, EAknListBoxSelectionList);
	listbox->SetItemHeightL(40);
	listbox->View()->SetMatcherCursor(EFalse);

	listbox->ItemDrawer()->FormattedCellData()->SetIconArray(iconlist);

	listbox->SetListBoxObserver(this);
	listbox->Model()->SetItemTextArray(book->get_array());
	
	listbox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray);
	listbox->CreateScrollBarFrameL(ETrue);
	listbox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
	
	listbox->SetCurrentItemIndex(current_item_index);
	listbox->SetTopItemIndex(top_item_index);

	if (is_searchable()) 
	{
		edit=new (ELeave) CEikEdwin;
		edit->SetBorder(TGulBorder::ESingleBlack);
		edit->SetContainerWindowL(*this);
		edit->ConstructL();
		edit->AddEdwinObserverL(this);
		edit->SetFocus(ETrue);
		edit->SetTextL(&current_filter);
		filter();
		
	}

	phone=new (ELeave) phonehelper;
	phone->ConstructL();

	globalNote=CAknGlobalNote::NewL();

	pbkengine=CPbkContactEngine::Static();
	if (pbkengine) {
		owns_engine=false;
	} else {
		pbkengine=CPbkContactEngine::NewL();
		owns_engine=true;
	}
	SetRect(aRect);
   
	ActivateL();
}
开发者ID:flaithbheartaigh,项目名称:jaikuengine-mobile-client,代码行数:100,代码来源:ContextbookContainer.cpp

示例11: AppendL

void CMdsClauseBuffer::AppendL( const TDesC& aDes, const TInt aAdditional )
	{
	ReserveSpaceL( iBuffer->Size() + aDes.Length() + 1 + aAdditional );

	iBuffer->Des().Append( aDes );
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:6,代码来源:mdsclausebuffer.cpp

示例12: ParseL

// ---------------------------------------------------------
// TDdParser::ParseL()
// ---------------------------------------------------------
//
void TDdParser::ParseL( const TDesC& aBuf, CCodData& aData, const TBool aIsDd2, TBool& aIsLicenseTag )
    {
    CLOG(( EParse, 2, _L("-> TDdParser::ParseL") ));
    CDUMP(( EParse, 2, _S("Buf:"), _S("    "), \
        (const TUint8*)aBuf.Ptr(), aBuf.Size() ));
    iError = KErrNone;
    iData = &aData;
    // XML Parser expects the buffer contain a BOM and be in
    // network byte order (this is hard-coded into cXmlParser).
    // We already have the buffer converted to UCS-2, native byte order, BOM
    // removed, and this cannot be changed without changing API.
    // So we have to re-add BOM and convert the buffer back to network byte
    // order. This is an annoying a waste, luckily a DD file is small
    // enough not to be significant.
    HBufC* buf = HBufC::NewLC( aBuf.Length() + 1 );
    buf->Des().Append( 0xFFFE );    // Add BOM, little endian as aBuf.
    buf->Des().Append( aBuf );      // Append buffer.
    // Now turn the whole buffer big-endian.
    TUint8* ptr = (TUint8*)buf->Ptr();
    for ( TInt i = 0; i < buf->Size(); i += 2 )
        {
        TUint8 tmp = ptr[i];
        ptr[i] = ptr[i + 1];
        ptr[i + 1] = tmp;
        }
    NW_WBXML_Dictionary_t* dictArray[ 1 ] = 
        { (NW_WBXML_Dictionary_t*)&NW_DdDummy_WBXMLDictionary };
    RNwWbxmlDictionary wbxmlDict;
    User::LeaveIfError( wbxmlDict.Initialize( 1, dictArray ) );
    CleanupClosePushL<RNwWbxmlDictionary>( wbxmlDict );

    NW_TinyDom_Handle_t domHandle;
    NW_Status_t stat;
    CNwDomDocumentNode* docNode = new (ELeave) CNwDomDocumentNode();
    CleanupStack::PushL( docNode );
    docNode->iDocNode = CXML_DOM_DocumentNode_BuildTree
        ( 
        &domHandle, 
        (NW_Byte*)buf->Ptr(), 
        (NW_Int32)buf->Size(), 
        /*encoded=*/NW_FALSE, 
        /*publicID=*/NW_DdDummy_PublicId, 
        /*extTNotStringTable=*/NW_FALSE,
        &stat
        );
    LeaveIfNwErrorL( stat );
    User::LeaveIfNull( docNode->iDocNode ); // Safety code.
    if (!aIsDd2)
	{
	  DocNodeL( docNode->iDocNode );
	}
    else
	{
	  iIsLicenseTag = EFalse;
	  ParseDd2DocNodeL( docNode->iDocNode );
	}
    CleanupStack::PopAndDestroy( 3, buf );  // docNode, close wbxmlDict, buf

#ifdef __TEST_COD_LOG
    TPtrC ptr16;
    TPtrC8 ptr8;
    CLOG(( EParse, 3, _L("TCodParser::ParseL data:") ));
    ptr16.Set( aData.Name() );
    CLOG(( EParse, 3, _L("  Name<%S>"), &ptr16 ));
    ptr16.Set( aData.Vendor() );
    CLOG(( EParse, 3, _L("  Vendor<%S>"), &ptr16 ));
    ptr16.Set( aData.Description() );
    CLOG(( EParse, 3, _L("  Desc<%S>"), &ptr16 ));
    CLOG(( EParse, 3, _L("  Size(%d)"), aData.Size() ));
    ptr8.Set( aData.InstallNotify() );
    CLOG(( EParse, 3, _L8("  InstNotif<%S>"), &ptr8 ));
    ptr8.Set( aData.NextUrl() );
    CLOG(( EParse, 3, _L8("  NextUrl<%S>"), &ptr8 ));
    ptr8.Set( aData.NextUrlAtError() );
    CLOG(( EParse, 3, _L8("  NextUrlAtErr<%S>"), &ptr8 ));
    ptr8.Set( aData.InfoUrl() );
    CLOG(( EParse, 3, _L8("  InfoUrl<%S>"), &ptr8 ));
    ptr16.Set( aData.Price() );
    CLOG(( EParse, 3, _L("  Price<%S>"), &ptr16 ));
    ptr8.Set( aData.Icon() );
    CLOG(( EParse, 3, _L8("  Icon<%S>"), &ptr8 ));

//TODO add logs for OMA 2
#endif /* def __TEST_COD_LOG */
	
	//If there are no media objects present to download, 
    if( !iData->Count() )
    	{
    	User::Leave( KErrCodInvalidDescriptor );	
    	}
    	
    // NULL data for clarity. These are never used later, but don't keep
    // pointers to objects which are out of reach.
    iData = NULL;
    User::LeaveIfError( iError );
    aIsLicenseTag = iIsLicenseTag;
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:101,代码来源:DdParser.cpp

示例13: iRemainder

TLineBuffer::TLineBuffer(const TDesC &aBuffer) : iRemainder(aBuffer.Length()), iTail(aBuffer)
	{
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:3,代码来源:ws_eng.cpp

示例14: ProcessForwardingL

// -----------------------------------------------------------------------------
// CSatSendSsHandler::ProcessForwardingL
// -----------------------------------------------------------------------------
void CSatSendSsHandler::ProcessForwardingL(
        TAction aAction,
        TForwardingProcedure aForwarding,
        const TDesC& aNumber,
        const TDesC& aBasicCode,
        const TDesC& aTimer )
    {
    LOG( SIMPLE, "CSatSendSsHandler::ProcessForwardingL calling" )

    TBasicServiceGroups bsc = ChangeToBsc( aBasicCode );
    ConnectToSsEngineL();

    TCallDivertSetting setDivert;
    setDivert.iNumber.Copy( aNumber );
    setDivert.iServiceGroup = EServiceGroupVoice;
    setDivert.iStatus = EDivertingStatusUnknown;
    setDivert.iNoReplyTimer = 0;// all unconditional

    LOG2( NORMAL, 
    "CSatSendSsHandler::ProcessForwardingL aForwarding: %d", aForwarding )
    switch ( aForwarding )
        {
        case EForwardingNotReachable:
            {
            LOG( NORMAL, 
            "CSatSendSsHandler::ProcessForwardingL EForwardingNotReachable" )
            setDivert.iCondition = EDivertConditionNotReachable;
            break;
            }

        case EForwardingNoReply:
            {
            LOG( NORMAL, 
            "CSatSendSsHandler::ProcessForwardingL EForwardingNoReply" )
            if ( aTimer.Length() != 0 )
                {
                TLex input( aTimer );
                User::LeaveIfError( input.Val( setDivert.iNoReplyTimer ) );
                }
            else
                {
                LOG( NORMAL, 
                "CSatSendSsHandler::ProcessForwardingL iNoReplyTimer" )
                setDivert.iNoReplyTimer = iDivert->GetTimerValueL();
                }
            setDivert.iCondition = EDivertConditionNoReply;
            break;
            }

        case EForwardingBusy:
            {
            LOG( NORMAL, 
            "CSatSendSsHandler::ProcessForwardingL EForwardingBusy" )
            setDivert.iCondition = EDivertConditionBusy;
            break;
            }

        case EForwardingUnconditional:
            {
            LOG( NORMAL, 
            "CSatSendSsHandler::ProcessForwardingL EForwardingUnconditional" )
            setDivert.iCondition = EDivertConditionUnconditional;
            break;
            }

        case EForwardingAll:
            {
            LOG( NORMAL, 
            "CSatSendSsHandler::ProcessForwardingL EForwardingAll" )
            setDivert.iCondition = EDivertConditionAllCalls;
            break;
            }

        case EForwardingAllConditional:
            {
            LOG( NORMAL, 
            "CSatSendSsHandler::ProcessForwardingL \
            EForwardingAllConditional" )
            setDivert.iCondition = EDivertConditionAllConditionalCases;
            break;
            }

        default:
            {
            LOG( NORMAL, 
            "CSatSendSsHandler::ProcessForwardingL Unknown forwarding" )
            break;
            }
        }

    switch ( aAction )
        {
        case EActivate:
            {
            LOG( NORMAL, "CSatSendSsHandler::EActivate" )
            setDivert.iSetting = EActivateDiverting;
            iDivert->SetDivertingL( setDivert, bsc );
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:101,代码来源:csatsendsshandler.cpp

示例15: SearchMailAddressL

/**
Search algorithm for searching e-mail addresses

@param aText Text that will be parsed
@return ETrue if any EMail items were found else returns EFalse
@leave KErrNone, if successful; otherwise one of the other system-wide error codes.
@panic ETulPanicDescriptorLength in debug build if item's position 
and/or length is out of the document's range.
*/
TBool CTulAddressStringTokenizer::SearchMailAddressL( const TDesC& aText )
    {
    TInt searchStart = 0;
    TInt searchResult = 0;
    const TInt end = aText.Length(); // end of document

    do
        {
        TPtrC segment = aText.Right( end - searchStart );
        searchResult = segment.LocateF('@');

        if (searchResult != KErrNotFound)
            { // @ found
            // There should be valid characters (not a period) before and after the @ character
            if ( searchResult == 0 // first char
                || (searchResult >= segment.Length() - 1) // last char 
                || !(IsValidEmailChar(segment[searchResult - 1])) 
                || !(IsValidEmailHostChar(segment[searchResult + 1]))
                || segment[searchResult - 1] == '.' 
                || segment[searchResult + 1] == '.'
               )
                {
                searchStart += searchResult + 1;
                continue;
                }

            TBool wasPeriod = EFalse; // To prevent sequential periods
            // Get TLex from the pointer to get a better API for parsing
            TLexMark startPos;
            TLexMark endPos;
            TLex token = segment;
            
            // Go to searchResult and un-get until the beginning of e-mail address is reached
            token.Inc( searchResult );
            token.Mark();
            do
                {
                token.UnGet();
                if ( token.Peek() == '.' )
                    { // If it was a period
                    if (wasPeriod)	// and if the former was also -> break
                        break;
                    else	// else mark that this one was a period
                        wasPeriod = ETrue;
                    }
                else
                    wasPeriod = EFalse;
                }
            while (token.Offset() > 0 && IsValidEmailChar(token.Peek()));
            
            if (token.Offset() != 0 || !IsValidEmailChar(token.Peek()))
                token.Inc();

            // Get rid of periods from the start of address
            // Does it have to start with a number or char(abc...).
            // If it does, the loop should check that it gets rid of all special chars also.
            while (token.Peek() == '.')
                token.Inc();

            token.Mark( startPos ); // Mark the beginning of address
            token.UnGetToMark();
            wasPeriod = EFalse;
            
            do	// Go forward until a nonvalid character
                {
                token.Inc();
                if ( token.Peek() == '.' )
                    { // If it was a period
                    if ( wasPeriod )	// and if the former was also -> break
                        break;
                    else	// else mark that this one was a period
                        wasPeriod = ETrue;
                    }
                else
                    wasPeriod = EFalse;
                }
            while ( !token.Eos() && IsValidEmailHostChar( token.Peek() ) );
            
            // If address ends with a period take it away
            token.UnGet();
            if (token.Peek() != '.')
                token.Inc();

            token.Mark( endPos ); // Mark the beginning of address

            // Append the found string to the array
            __ASSERT_DEBUG( searchStart + token.MarkedOffset( startPos ) 
                            + token.MarkedOffset( endPos ) 
                            - token.MarkedOffset( startPos ) <= aText.Length(), 
                            Panic(ETulPanicDescriptorLength) );
            AddItemL( searchStart + token.MarkedOffset( startPos ), 
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:101,代码来源:tuladdressstringtokenizer.cpp


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