本文整理汇总了C++中CDesCArray类的典型用法代码示例。如果您正苦于以下问题:C++ CDesCArray类的具体用法?C++ CDesCArray怎么用?C++ CDesCArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CDesCArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: new
CDesCArray* CCommonUtils::SplitText(const TDesC& aText,const char& aSplitChar)
{
CDesCArray* tmpArray = new(ELeave) CDesCArrayFlat(5);
CleanupStack::PushL(tmpArray);
TInt len = aText.Length();
TBuf<100> tmp;
for ( TInt i = 0; i < len ; i ++)
{
if(aText[i] == aSplitChar)
{
tmp.TrimAll();
tmpArray->AppendL(tmp);
tmp.Zero();
}
else
tmp.Append(aText[i]);
}
if (tmp.Length() > 0 )
{
tmp.TrimAll();
tmpArray->AppendL(tmp);
}
CleanupStack::Pop(tmpArray);
return tmpArray;
}
示例2: new
QString Camera::symbianCapture(int width, int height)
{
CNewFileServiceClient* fileClient = NewFileServiceFactory::NewClientL();
CleanupStack::PushL(fileClient);
CDesCArray* fileNames = new (ELeave) CDesCArrayFlat(1);
CleanupStack::PushL(fileNames);
CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();
TSize resolution = TSize(width, height);
TPckgBuf<TSize> buffer( resolution );
TAiwVariant resolutionVariant( buffer );
TAiwGenericParam param( EGenericParamResolution, resolutionVariant );
paramList->AppendL( param );
const TUid KUidCamera = { 0x101F857A }; // Camera UID for S60 5th edition
TBool result = fileClient->NewFileL( KUidCamera, *fileNames, paramList,
ENewFileServiceImage, EFalse );
QString ret;
if (result) {
TPtrC fileName=fileNames->MdcaPoint(0);
ret = QString((QChar*) fileName.Ptr(), fileName.Length());
}
qDebug() << ret;
CleanupStack::PopAndDestroy(3);
return ret;
}
示例3: GetAvailableHeightsInTwipsAndPointsL
EXPORT_C TInt FontUtils::GetAvailableHeightsInTwipsAndPointsL(const CGraphicsDevice& aDevice,const TDesC& aTypefaceName,CArrayFix<TInt>& aTwipsList,CDesCArray& aPointsList)
/** Gets a list of all heights in twips, available for the named typeface and the
graphics device specified.
Also gets a list of heights in points, represented as character strings.
@param aDevice The graphics device.
@param aTypefaceName The name of the typeface.
@param aTwipsList On return, contains all available heights for the typeface,
in twips.
@param aPointsList On return, the heights in points, represented as character
strings.
@return KErrNotSupported if the named typeface is not supported by the graphics
device, otherwise KErrNone. */
{ // static
aTwipsList.Reset();
aPointsList.Reset();
TInt err=GetAvailableHeightsInTwipsL(aDevice,aTypefaceName,aTwipsList);
if (err==KErrNotSupported)
return err;
const TInt count=aTwipsList.Count();
for (TInt ii=0;ii<count;ii++)
{
const TInt points=PointsFromTwips(aTwipsList[ii]);
if (points<EMinFontHeight)
continue;
TBuf<8> num;
num.Num(points);
aPointsList.AppendL(num);
}
return KErrNone;
}
示例4: DoTestV8DatabaseL
void DoTestV8DatabaseL()
{
CopyOldCdbFileToCDriveL(KDatabaseV8);
CContactDatabase* db=CContactDatabase::OpenL(KDatabaseCDrive);
TDriveUnit driveUnit = _L("c:");
TBuf<190> driveName;
CDesCArray* dataBaseList = db->ListDatabasesL(driveUnit);
CleanupStack::PushL(dataBaseList);
TInt theCount = dataBaseList->Count();
TBool oldFileFormat = EFalse;
for(TInt i = 0; i< theCount; i++)
{
driveName = (*dataBaseList)[i];
test.Printf(_L("ListDatabaseTestL, ListDatabasesL: %s \n"),driveName.PtrZ());
TPtrC filenamePtr(driveName);
TInt found = filenamePtr.FindF(KOldFileFormatPrefix);
if (found != 0 && found != KErrNotFound)
{
oldFileFormat = ETrue;
}
}
test(oldFileFormat);
CleanupStack::PopAndDestroy(dataBaseList);
delete db;
}
示例5: GetAvailableFontsL
EXPORT_C void FontUtils::GetAvailableFontsL(const CGraphicsDevice& aDevice, CDesCArray& aFontNameList,TInt aFonts)
/** Gets the list of typeface names available for the graphics device.
@param aDevice The graphics device.
@param aFontNameList On return, contains the list of typeface names.
@param aFonts Can be used to specify which sorts of typefaces are required.
For possible values, see the flags defined in gulftflg.hrh
beginning with EGulAllFonts. */
{ // static
aFontNameList.Reset();
const TInt numTypefaces=aDevice.NumTypefaces();
TTypefaceSupport typefaceInfo;
for (TInt ii=0;ii<numTypefaces;ii++)
{
aDevice.TypefaceSupport(typefaceInfo,ii);
if (typefaceInfo.iTypeface.IsProportional())
{
if (aFonts==EGulMonospaceFontsOnly)
continue;
}
else if (aFonts==EGulNoMonospaceFonts || aFonts==EGulNoMonospaceOrSymbolFonts)
continue;
if (typefaceInfo.iTypeface.IsSymbol())
{
if (aFonts==EGulNoSymbolFonts || aFonts==EGulNoMonospaceOrSymbolFonts || aFonts==EGulMonospaceFontsOnly)
continue;
}
else if (aFonts==EGulSymbolFontsOnly)
continue;
aFontNameList.AppendL(typefaceInfo.iTypeface.iName);
}
}
示例6: databaseInfoArray
// ---------------------------------------------------------
// CPosLmLocalDatabaseManager::SynchronizeRegistryL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CPosLmLocalDatabaseManager::SynchronizeRegistryL()
{
RPointerArray<HPosLmDatabaseInfo> databaseInfoArray(KPosDbListGranularity);
CleanupStack::PushL(TCleanupItem(CleanupRPointerArray, &databaseInfoArray));
// list URIs
CDesCArray* dbUriArray = ListDatabasesLC();
// list registered databases
Session().ListDatabasesL(databaseInfoArray, KFileProtocol);
// unregister database which cannot be found on disk
for (TInt i = databaseInfoArray.Count() - 1; i >= 0; i--)
{
TInt index;
TPtrC registeredUri = databaseInfoArray[i]->DatabaseUri();
if (dbUriArray->Find(registeredUri, index) != 0)
{
// unregister database
User::LeaveIfError(Session().UnregisterDatabase(registeredUri,
DatabaseDrive(registeredUri)));
}
}
CleanupStack::PopAndDestroy(2, &databaseInfoArray); // dbUriArray
}
示例7: qDebug
void TwtCamera::openCamera()
{
#ifdef Q_OS_SYMBIAN
qDebug() << "TwtCamera::openCamera";
CDesCArray* selectedFiles = new (ELeave) CDesCArrayFlat(1);
CleanupStack::PushL(selectedFiles);
CNewFileServiceClient* fileClient = NewFileServiceFactory::NewClientL();
CleanupStack::PushL(fileClient);
bool result = fileClient->NewFileL(KUidCamera, *selectedFiles, NULL,
ENewFileServiceImage, EFalse);
if(result)
{
TPtrC address = selectedFiles->MdcaPoint(0);
QString filename = QString::fromUtf16(address.Ptr(), address.Length());
qDebug() << "TwtCamera::openCamera name = " << filename;
emit imgCaptured(filename);
}
else
{
qDebug() << "TwtCamera::openCamera file capture failed";
emit imgCaptured("");
}
CleanupStack::PopAndDestroy( 2 ); // selectedFiles, fileClient
#else
// for develop on simulator
emit imgCaptured("");
#endif
}
示例8: AddFormattedListBoxItemL
void CSearchableListBoxContainer::AddFormattedListBoxItemL( const TDesC& aString )
{
CTextListBoxModel* model = iListBox->Model();
CDesCArray* itemArray = static_cast< CDesCArray* > ( model->ItemTextArray() );
itemArray->AppendL( aString );
iListBox->HandleItemAdditionL();
}
示例9: new
void CSpreadWFDialogs::ShowSpreadWayfinderOptionsDialogL()
{
//Dialog that lets the user chose between contact bk search
//and entering a number manually.
CDesCArray* optionArray = new (ELeave) CDesCArrayFlat(2);
HBufC* option = CCoeEnv::Static()->AllocReadResourceLC(R_WF_OPTION_CONTACTS);
optionArray->AppendL(*option);
CleanupStack::PopAndDestroy(option);
option = CCoeEnv::Static()->AllocReadResourceLC(R_WF_OPTION_MANUALLY);
optionArray->AppendL(*option);
CleanupStack::PopAndDestroy(option);
TInt preSelIndex = iOptionsIndex;
typedef TCallBackEvent<CSpreadWFDialogs, TSpreadWFEvent> cb_t;
typedef CCallBackListDialog<cb_t> cbd_t;
cbd_t::RunDlgLD(cb_t(this,
ESpreadWFEventOptionsOk,
ESpreadWFEventOptionsCancel),
iOptionsIndex,
R_WF_SHARE_WAYFINDER,
optionArray,
R_WAYFINDER_CALLBACK_SINGLE_LIST_QUERY_OK_BACK,
EFalse,
preSelIndex);
}
示例10: new
void CMdEQuery::NotifyNewResultsL( const CDesCArray& aNewResults )
{
TInt firstNewItemIndex = aNewResults.Count();
TInt oldCount = 0;
if( iDistinctResults )
{
oldCount = iDistinctResults->Count();
}
else
{
iDistinctResults = new (ELeave) CDesCArrayFlat( 8 );
}
TRAPD( err, AppendResultsL( aNewResults ) );
if( err != KErrNone )
{
// Cleanup: remove the ones that were added.
while( iDistinctResults->Count() > oldCount )
{
iDistinctResults->Delete( iDistinctResults->Count() - 1 );
}
// Leave with the same error.
User::Leave(err);
}
for( TInt i = iObservers.Count() - 1; i >=0; i-- )
{
MMdEQueryObserver* observer = iObservers[i];
observer->HandleQueryNewResults( *this, firstNewItemIndex,
aNewResults.Count() );
}
}
示例11: _LOG
TInt CFileSelectDialog::Show()
{
_LOG(_L("CFileSelectDialog::Show()"));
TInt sel=0;
CDesCArray* itemList = new (ELeave) CDesCArrayFlat(3);
if (iCurrentPath.Compare(_L(""))!=0){if (iType==EFolder){iArray->InsertL(0,_L("Select folder"));}iArray->InsertL(0,_L("..."));}
_LOGDATA(_L("Length of array: %d"),iArray->Count());
for (TInt i=0;i<iArray->Count();i++)
{
TBuf<255> ItemTxt;
ItemTxt.Copy(_L("0\t"));
ItemTxt.Append(iArray->MdcaPoint(i));
ItemTxt.Append(_L("\t\t"));
itemList->AppendL(ItemTxt);
_LOGDATA(_L("Item: %S"),&iArray->MdcaPoint(i));
}
_LOG(_L("Will create dialog"));
SetItemTextArray(itemList);
ListBox()->HandleItemAdditionL();
Layout();
ListBox()->SetCurrentItemIndex(0);
ListBox()->DrawNow();
DrawDeferred();
}
示例12: JELOG2
// ---------------------------------------------------------------------------
// CLAPILandmarkStoreManager::LandmarkStoresL
// ---------------------------------------------------------------------------
//
CDesCArray* CLAPILandmarkStoreManager::LandmarkStoresL()
{
JELOG2(EJavaLocation);
// List landmark databases but remove the default store from the array
CDesCArray* stores = iLmDbManager->ListDatabasesLC();
HBufC* defaultDbName = iLmDbManager->DefaultDatabaseUriLC();
// Remove the default database from the store names array. External stores
// are also removed because this API does not support other than stores
// which are located in the file system of the device
TInt count = stores->Count();
for (TInt i = 0; i < count; i++)
{
TPtrC storeUri = stores->MdcaPoint(i);
if (defaultDbName->CompareF(storeUri) == 0 || storeUri.FindF(
KLAPIDefaultProtocol) == KErrNotFound)
{
stores->Delete(i);
break;
}
}
CleanupStack::PopAndDestroy(defaultDbName);
CleanupStack::Pop(stores);
return stores;
}
示例13: ListDatabasesLC
// ---------------------------------------------------------
// CPosLmLocalDatabaseManager::ListDatabasesL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CPosLmLocalDatabaseManager::ListDatabasesL(
RPointerArray<HPosLmDatabaseInfo>& aDatabaseInfoArray)
{
// list URIs
CDesCArray* dbUriArray = ListDatabasesLC();
// list registered databases
Session().ListDatabasesL(aDatabaseInfoArray, KFileProtocol);
// delete from URI list those databases that are registered
for (TInt i = aDatabaseInfoArray.Count() - 1; i >= 0; i--)
{
TInt index;
if (dbUriArray->Find(aDatabaseInfoArray[i]->DatabaseUri(), index) == 0)
{
dbUriArray->Delete(index);
}
}
// for each remaining URI in the list, fill in database info
// and add to list
TInt count = dbUriArray->Count();
for (TInt i = 0; i < count; i++)
{
HPosLmDatabaseInfo* info = HPosLmDatabaseInfo::NewLC((*dbUriArray)[i]);
aDatabaseInfoArray.AppendL(info);
CleanupStack::Pop(info); // transfer of ownership to array
}
CleanupStack::PopAndDestroy(dbUriArray);
// database drive, database media and default flag
// will be filled in by database management provider.
}
示例14: _LIT
void CMainMenuGridContainer::DeleteItemL(TInt aIndex)
{
CArrayPtr<CGulIcon>* icons =
iGrid->ItemDrawer()->FormattedCellData()->IconArray();
if (icons && aIndex >= 0 && aIndex < icons->Count()) {
//Delete item if index is valid.
_LIT(KItem, "%d\t\t0");
TBuf<8> buf;
MDesCArray* array = iGrid->Model()->ItemTextArray();
CDesCArray* cArray = (CDesCArray*)array;
//Remove icon and items.
icons->Delete(aIndex);
cArray->Delete(aIndex, (cArray->Count() - aIndex));
iGrid->HandleItemRemovalL();
//Re-add the items behind, needed since we changed the indexes.
for (TInt i = aIndex; i < icons->Count(); i++) {
buf.Format(KItem, i);
cArray->AppendL(buf);
}
//Inform list box that data was added.
iGrid->HandleItemAdditionL();
SetGridGraphicStyleL();
}
}
示例15: CopyToNewJavaStringArrayL
jobjectArray CopyToNewJavaStringArrayL(JNIEnv& aJni,
const CDesCArray& aNativeArray)
{
JELOG2(EJavaLocation);
jclass stringClass = aJni.FindClass("java/lang/String");
User::LeaveIfNull(stringClass);
//
jobjectArray result = aJni.NewObjectArray(aNativeArray.Count(),
stringClass, NULL);
if (result != NULL)
{
TPtrC item;
for (int i = 0; i < aNativeArray.Count(); ++i)
{
item.Set(aNativeArray[i]);
jstring javaString =
java::util::S60CommonUtils::NativeToJavaString(aJni, item);
User::LeaveIfNull(javaString);
//
aJni.SetObjectArrayElement(result, i, javaString);
aJni.DeleteLocalRef(javaString);
}
}
return result;
}