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


C++ TBuf::AllocLC方法代码示例

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


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

示例1: GenerateTestDescriptionLC

/** Function to generate a meaningful hash string from the test attributes

@param aSize the size of the font
@param aAttributes the attributes of the font 
@see TFontEffectsFlags
@param aTypefaceName the typeface name

@return the buffer with a text description, used for inclusion in the hash string
*/
HBufC* CTLinkedFontsComparison::GenerateTestDescriptionLC(TInt aSize,TUint32 aAttributes, const TPtrC &aTypefaceName, const TDesC &aTestDescription)
	{
	TBuf<KLengthOfHashValue> tempBuffer;
		
	//append the name
	tempBuffer.Append(_L("_"));
	tempBuffer.Append(aTypefaceName);
	tempBuffer.Append(_L("_"));
	tempBuffer.Append(aTestDescription);
	tempBuffer.Append(_L("_"));
	
	//append the size 
	tempBuffer.AppendFormat(_L("_size-%d"),aSize);
	if (aAttributes == 0)
		{
		//output no attributes
		tempBuffer.Append(_L("_"));
		tempBuffer.Append(KFontEffectsFlagsString[0]); //no attributes string
		}
	else
		{
		for (TInt counter=0;counter<31;counter++)
			{
			TInt bit = 1<<counter; //1,2,4,8 etc
			if (bit&aAttributes)
				{
				tempBuffer.Append(_L("_"));
				tempBuffer.Append(KFontEffectsFlagsString[counter+1]);
				}
			}
		}
	return tempBuffer.AllocLC();	
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:42,代码来源:t_linkedfontscomparison.cpp

示例2: GetArrayFromConfig

/**
 *   Return array of string parameters i.e. key=a1,a2,a3 returns array which contains
 *   String a1, a2 and a3.
 *   @return ret - EFalse if can't get a String parameter from Config file.  ETrue if KErrNone
 */
TBool CDataWrapperBase::GetArrayFromConfig(const TDesC& aSectName, const TDesC& aKeyName, RPointerArray<HBufC>& aResult)
	{
	TBool	ret=EFalse;
	TPtrC completeArray;
	
	TRAPD(err, ret=GetCommandStringParameterL(aSectName, aKeyName, completeArray));
	if ( err != KErrNone )
		{
		ret=EFalse;
		}

    TLex16 lex(completeArray); // Here we have the array as a string i.e. "a1,a2,a3"
    TBuf<256> buf;
    TChar chr;
    
    while(!lex.Eos())
        {
        chr = lex.Get();
        // Check if there was a list separator
        if (chr == ',')
            {
            HBufC* param = buf.AllocLC();
            buf.Zero();
            aResult.Append(param);
            CleanupStack::Pop(param); // pointer to buf is stored in RPointerArray
            }
        // If not separator character we can store the character into array
        else
            {
            buf.Append(chr);
            }
        }
    // Remember to put last token into array (,a3)
    HBufC* param = buf.AllocLC();
    aResult.Append(param);
    CleanupStack::Pop(param);
    
    return ret;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:44,代码来源:DataWrapperBase.cpp

示例3: GenerateHashIdStringLC

/**
Auxilary function called to generate Hash ID String based on the parameters (test case ID, subtest etc...) and returns
HashId looks like:Testcasecame_0010_9_Swiss_EGray2_0 (aTestCase = DrawText_0010 or DrawTextVertical_0010, aSubTestNumber = 9, aFontFaceIndex = Swiss, aDisplayMode = EGray2, aOrientation = 0)
@param aTestCase holds the testcase ID
@param aSubTestNumber holds the subtest number
@param aFontFaceIndex holds the font face index (index used in KFontFace[])
@param aDisplayMode holds the display mode
@param aOrientation holds the orientation number
*/
EXPORT_C HBufC* CTHashReferenceImages::GenerateHashIdStringLC(const TDesC& aTestCase, TInt aSubTestNumber, const TPtrC aName[], TInt aNameIndex,
												TInt aDisplayMode, TInt aOrientation)
	{
	//this is here because at file scope there is uninitialised writable data
	const TDesC * KDisplayModeNames[KNumOfDisplayModes] = 
		{
		&KMode0,
		&KMode1,
		&KMode2,
		&KMode3,
		&KMode4,
		&KMode5,
		&KMode6,
		&KMode7,
		&KMode8,
		&KMode9,
		&KMode10,
		&KMode11,
		};	
	
	TBuf<KLengthOfHashValue> tempBuffer;
	tempBuffer.Format(KHashIDFormat, &aTestCase, aSubTestNumber, &aName[aNameIndex], KDisplayModeNames[aDisplayMode], aOrientation);
	return tempBuffer.AllocLC();
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:33,代码来源:thashreferenceimages.cpp


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