本文整理汇总了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();
}
示例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;
}
示例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();
}