本文整理汇总了C++中nsCOMPtr::AppendElement方法的典型用法代码示例。如果您正苦于以下问题:C++ nsCOMPtr::AppendElement方法的具体用法?C++ nsCOMPtr::AppendElement怎么用?C++ nsCOMPtr::AppendElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsCOMPtr
的用法示例。
在下文中一共展示了nsCOMPtr::AppendElement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetSelectedCards
nsresult nsAbView::GetSelectedCards(nsCOMPtr<nsIMutableArray> &aSelectedCards)
{
if (!mTreeSelection)
return NS_OK;
PRInt32 selectionCount;
nsresult rv = mTreeSelection->GetRangeCount(&selectionCount);
NS_ENSURE_SUCCESS(rv, rv);
if (!selectionCount)
return NS_OK;
for (PRInt32 i = 0; i < selectionCount; i++)
{
PRInt32 startRange;
PRInt32 endRange;
rv = mTreeSelection->GetRangeAt(i, &startRange, &endRange);
NS_ENSURE_SUCCESS(rv, NS_OK);
PRInt32 totalCards = mCards.Count();
if (startRange >= 0 && startRange < totalCards)
{
for (PRInt32 rangeIndex = startRange; rangeIndex <= endRange && rangeIndex < totalCards; rangeIndex++) {
nsCOMPtr<nsIAbCard> abCard;
rv = GetCardFromRow(rangeIndex, getter_AddRefs(abCard));
NS_ENSURE_SUCCESS(rv,rv);
rv = aSelectedCards->AppendElement(abCard, false);
NS_ENSURE_SUCCESS(rv, rv);
}
}
}
return NS_OK;
}
示例2: fillIMutableArrayFromVector
/*
* Fill a scriptable array with the values from a vector of strings.
* The scriptable array can only contain scriptable elements so a
* nsISupportsCString is created for each std::string in the vector.
*/
static void fillIMutableArrayFromVector(std::vector<std::string> &engines,
nsCOMPtr<nsIMutableArray> &outArray)
{
for(std::vector<std::string>::const_iterator it = engines.begin() ; it != engines.end() ; it++)
{
LOG(DEBUG) << "Outputting engine : " << *it;
std::string engine(it->begin(), it->end());
nsCString new_data;
new_data.Assign(engine.c_str(), engine.length());
nsCOMPtr<nsISupportsCString> curr_engine = do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID);
curr_engine->SetData(new_data);
outArray->AppendElement(curr_engine, false /* STRONG reference. */);
}
}
示例3: ProcessPath
// Helper routine used in tracking app lists. Converts path
// entries to lower case and stores them in the trackList array.
void nsMIMEInfoWin::ProcessPath(nsCOMPtr<nsIMutableArray>& appList,
nsTArray<nsString>& trackList,
const nsAString& appFilesystemCommand)
{
nsAutoString lower(appFilesystemCommand);
ToLowerCase(lower);
// Don't include firefox.exe in the list
WCHAR exe[MAX_PATH+1];
PRUint32 len = GetModuleFileNameW(NULL, exe, MAX_PATH);
if (len < MAX_PATH && len != 0) {
PRUint32 index = lower.Find(exe);
if (index != -1)
return;
}
nsCOMPtr<nsILocalHandlerApp> aApp;
if (!GetLocalHandlerApp(appFilesystemCommand, aApp))
return;
// Save in our main tracking arrays
appList->AppendElement(aApp, false);
trackList.AppendElement(lower);
}