本文整理汇总了C++中NS_NewISupportsArray函数的典型用法代码示例。如果您正苦于以下问题:C++ NS_NewISupportsArray函数的具体用法?C++ NS_NewISupportsArray怎么用?C++ NS_NewISupportsArray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NS_NewISupportsArray函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_GetAtom
nsresult
nsFileView::Init()
{
mDirectoryAtom = do_GetAtom("directory");
if (!mDirectoryAtom)
return NS_ERROR_OUT_OF_MEMORY;
mFileAtom = do_GetAtom("file");
if (!mFileAtom)
return NS_ERROR_OUT_OF_MEMORY;
NS_NewISupportsArray(getter_AddRefs(mFileList));
if (!mFileList)
return NS_ERROR_OUT_OF_MEMORY;
NS_NewISupportsArray(getter_AddRefs(mDirList));
if (!mDirList)
return NS_ERROR_OUT_OF_MEMORY;
NS_NewISupportsArray(getter_AddRefs(mFilteredFiles));
if (!mFilteredFiles)
return NS_ERROR_OUT_OF_MEMORY;
mDateFormatter = do_CreateInstance(NS_DATETIMEFORMAT_CONTRACTID);
if (!mDateFormatter)
return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}
示例2: NS_NewISupportsArray
nsresult nsEudoraFilters::LoadServers()
{
nsresult rv;
if (m_pServerArray)
rv = m_pServerArray->Clear();
else
rv = NS_NewISupportsArray(getter_AddRefs(m_pServerArray));
NS_ENSURE_SUCCESS(rv, rv);
if (!m_pFilterArray)
rv = NS_NewISupportsArray(getter_AddRefs(m_pFilterArray));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIMsgAccountManager> accountMgr = do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsISupportsArray> allServers;
rv = accountMgr->GetAllServers(getter_AddRefs(allServers));
NS_ENSURE_SUCCESS(rv, rv);
uint32_t numServers;
rv = allServers->Count(&numServers);
NS_ENSURE_SUCCESS(rv, rv);
for (uint32_t serverIndex = 0; serverIndex < numServers; serverIndex++)
{
nsCOMPtr<nsIMsgIncomingServer> server = do_QueryElementAt(allServers, serverIndex, &rv);
if (server && NS_SUCCEEDED(rv))
{
bool canHaveFilters;
rv = server->GetCanHaveFilters(&canHaveFilters);
if (NS_SUCCEEDED(rv) && canHaveFilters)
{
nsAutoCString serverType;
rv = server->GetType(serverType);
if (NS_SUCCEEDED(rv) && !serverType.IsEmpty())
{
// Only get imap accounts and the special "none" (Local Folders) account
// since all imported Eudora pop3 accounts will go to Local Folders
if (serverType.Equals("none") || serverType.Equals("imap"))
{
// Pre-fetch filters now so that if there's any problem reading up the
// filter file we know about it in advance and can stop importing
nsCOMPtr<nsIMsgFilterList> filterList;
rv = server->GetFilterList(nullptr, getter_AddRefs(filterList));
NS_ENSURE_SUCCESS(rv, rv);
m_pServerArray->AppendElement(server);
}
}
}
}
}
return NS_OK;
}
示例3: NS_NewISupportsArray
nsAbPalmHotSync::nsAbPalmHotSync(PRBool aIsUnicode, PRUnichar * aAbDescUnicode, const char * aAbDesc, PRInt32 aPalmCatIndex, PRInt32 aPalmCatId)
{
mTotalCardCount=0;
mCardForPalmCount = 0;
mCardListForPalm = nsnull;
mInitialized = PR_FALSE;
mDBOpen = PR_FALSE;
if(aIsUnicode)
mAbName.Assign(aAbDescUnicode);
else
mAbName.AssignASCII(aAbDesc);
mAbName.Trim(" ");
mPalmCategoryIndex = aPalmCatIndex;
mPalmCategoryId = aPalmCatId;
mIsPalmDataUnicode = aIsUnicode;
mNewCardCount = 0;
NS_NewISupportsArray(getter_AddRefs(mNewCardsArray));
mIsNewCardForPalm = PR_FALSE;
}
示例4: NS_NewISupportsArray
NS_IMETHODIMP
nsHTTPIndex::ArcLabelsOut(nsIRDFResource *aSource, nsISimpleEnumerator **_retval)
{
nsresult rv = NS_ERROR_UNEXPECTED;
*_retval = nsnull;
nsCOMPtr<nsISupportsArray> array;
rv = NS_NewISupportsArray(getter_AddRefs(array));
if (NS_FAILED(rv)) return rv;
if (isWellknownContainerURI(aSource))
{
array->AppendElement(kNC_Child);
}
if (mInner)
{
nsCOMPtr<nsISimpleEnumerator> anonArcs;
rv = mInner->ArcLabelsOut(aSource, getter_AddRefs(anonArcs));
PRBool hasResults = PR_TRUE;
while (NS_SUCCEEDED(rv) &&
NS_SUCCEEDED(anonArcs->HasMoreElements(&hasResults)) &&
hasResults == PR_TRUE)
{
nsCOMPtr<nsISupports> anonArc;
if (NS_FAILED(anonArcs->GetNext(getter_AddRefs(anonArc))))
break;
array->AppendElement(anonArc);
}
}
return NS_NewArrayEnumerator(_retval, array);
}
示例5: NS_NewISupportsArray
nsresult
nsMsgAccountManagerDataSource::getAccountRootArcs(nsISupportsArray **aResult)
{
nsresult rv;
if (!mAccountRootArcsOut) {
rv = NS_NewISupportsArray(getter_AddRefs(mAccountRootArcsOut));
NS_ENSURE_SUCCESS(rv, rv);
mAccountRootArcsOut->AppendElement(kNC_Server);
mAccountRootArcsOut->AppendElement(kNC_Child);
mAccountRootArcsOut->AppendElement(kNC_Settings);
mAccountRootArcsOut->AppendElement(kNC_Name);
mAccountRootArcsOut->AppendElement(kNC_FolderTreeName);
mAccountRootArcsOut->AppendElement(kNC_FolderTreeSimpleName);
mAccountRootArcsOut->AppendElement(kNC_NameSort);
mAccountRootArcsOut->AppendElement(kNC_FolderTreeNameSort);
mAccountRootArcsOut->AppendElement(kNC_PageTag);
}
*aResult = mAccountRootArcsOut;
NS_IF_ADDREF(*aResult);
return NS_OK;
}
示例6: NS_NewISupportsArray
/* nsIEnumerator listTokens (); */
NS_IMETHODIMP nsPK11TokenDB::ListTokens(nsIEnumerator* *_retval)
{
nsNSSShutDownPreventionLock locker;
nsCOMPtr<nsISupportsArray> array;
PK11SlotList *list = 0;
PK11SlotListElement *le;
*_retval = nullptr;
nsresult rv = NS_NewISupportsArray(getter_AddRefs(array));
if (NS_FAILED(rv)) { goto done; }
/* List all tokens, creating PK11Token objects and putting them
* into the array.
*/
list = PK11_GetAllTokens(CKM_INVALID_MECHANISM, false, false, 0);
if (!list) { rv = NS_ERROR_FAILURE; goto done; }
for (le = PK11_GetFirstSafe(list); le; le = PK11_GetNextSafe(list, le, false)) {
nsCOMPtr<nsIPK11Token> token = new nsPK11Token(le->slot);
rv = array->AppendElement(token);
if (NS_FAILED(rv)) {
PK11_FreeSlotListElement(list, le);
rv = NS_ERROR_OUT_OF_MEMORY;
goto done;
}
}
rv = array->Enumerate(_retval);
done:
if (list) PK11_FreeSlotList(list);
return rv;
}
示例7: NS_NewISupportsArray
//
// GetOutputDataFlavors
//
// Creates a new list and returns the list of all the flavors this converter
// knows how to export (convert). In this case, it's all sorts of things that HTML can be
// converted to.
//
// Flavors (strings) are wrapped in a primitive object so that JavaScript can
// access them easily via XPConnect.
//
NS_IMETHODIMP
nsHTMLFormatConverter::GetOutputDataFlavors(nsISupportsArray **_retval)
{
if ( !_retval )
return NS_ERROR_INVALID_ARG;
nsresult rv = NS_NewISupportsArray ( _retval ); // addrefs for us
if ( NS_SUCCEEDED(rv) ) {
rv = AddFlavorToList ( *_retval, kHTMLMime );
if ( NS_FAILED(rv) )
return rv;
#if NOT_NOW
// pinkerton
// no one uses this flavor right now, so it's just slowing things down. If anyone cares I
// can put it back in.
rv = AddFlavorToList ( *_retval, kAOLMailMime );
if ( NS_FAILED(rv) )
return rv;
#endif
rv = AddFlavorToList ( *_retval, kUnicodeMime );
if ( NS_FAILED(rv) )
return rv;
}
return rv;
} // GetOutputDataFlavors
示例8: NS_NewISupportsArray
/* nsIEnumerator listModules (); */
NS_IMETHODIMP
nsPKCS11ModuleDB::ListModules(nsIEnumerator **_retval)
{
nsNSSShutDownPreventionLock locker;
nsresult rv = NS_OK;
/* get isupports array */
nsCOMPtr<nsISupportsArray> array;
rv = NS_NewISupportsArray(getter_AddRefs(array));
if (NS_FAILED(rv)) return rv;
/* get the default list of modules */
SECMODModuleList *list = SECMOD_GetDefaultModuleList();
/* lock down the list for reading */
SECMODListLock *lock = SECMOD_GetDefaultModuleListLock();
SECMOD_GetReadLock(lock);
while (list) {
nsCOMPtr<nsIPKCS11Module> module = new nsPKCS11Module(list->module);
array->AppendElement(module);
list = list->next;
}
/* Get the modules in the database that didn't load */
list = SECMOD_GetDeadModuleList();
while (list) {
nsCOMPtr<nsIPKCS11Module> module = new nsPKCS11Module(list->module);
array->AppendElement(module);
list = list->next;
}
SECMOD_ReleaseReadLock(lock);
rv = array->Enumerate(_retval);
return rv;
}
示例9: NS_NewISupportsArray
/* void RegisterListener (in nsIWebProgressListener listener); */
NS_IMETHODIMP nsPrintProgress::RegisterListener(nsIWebProgressListener * listener)
{
nsresult rv = NS_OK;
if (!listener) //Nothing to do with a null listener!
return NS_OK;
if (!m_listenerList)
rv = NS_NewISupportsArray(getter_AddRefs(m_listenerList));
if (NS_SUCCEEDED(rv) && m_listenerList)
{
m_listenerList->AppendElement(listener);
if (m_closeProgress || m_processCanceled)
listener->OnStateChange(nsnull, nsnull, nsIWebProgressListener::STATE_STOP, 0);
else
{
listener->OnStatusChange(nsnull, nsnull, 0, m_pendingStatus.get());
if (m_pendingStateFlags != -1)
listener->OnStateChange(nsnull, nsnull, m_pendingStateFlags, m_pendingStateValue);
}
}
return NS_OK;
}
示例10: NS_NewISupportsArray
/* nsISimpleEnumerator GetTargets (in nsIRDFResource aSource, in nsIRDFResource property, in boolean aTruthValue); */
NS_IMETHODIMP
nsMsgAccountManagerDataSource::GetTargets(nsIRDFResource *source,
nsIRDFResource *property,
PRBool aTruthValue,
nsISimpleEnumerator **_retval)
{
nsresult rv = NS_RDF_NO_VALUE;
// create array and enumerator
// even if we're not handling this we need to return something empty?
nsCOMPtr<nsISupportsArray> nodes;
rv = NS_NewISupportsArray(getter_AddRefs(nodes));
if (NS_FAILED(rv)) return rv;
rv = NS_NewArrayEnumerator(_retval, nodes);
if (NS_FAILED(rv)) return rv;
if (source == kNC_AccountRoot)
rv = createRootResources(property, nodes);
else if (property == kNC_Settings)
rv = createSettingsResources(source, nodes);
if (NS_FAILED(rv))
return NS_RDF_NO_VALUE;
return NS_OK;
}
示例11: NS_NewISupportsArray
NS_IMETHODIMP
nsSeamonkeyProfileMigrator::GetSourceProfiles(nsISupportsArray** aResult)
{
if (!mProfileNames && !mProfileLocations) {
nsresult rv = NS_NewISupportsArray(getter_AddRefs(mProfileNames));
if (NS_FAILED(rv)) return rv;
rv = NS_NewISupportsArray(getter_AddRefs(mProfileLocations));
if (NS_FAILED(rv)) return rv;
// Fills mProfileNames and mProfileLocations
FillProfileDataFromSeamonkeyRegistry();
}
NS_IF_ADDREF(*aResult = mProfileNames);
return NS_OK;
}
示例12: MsgGetAtom
nsMessengerUnixIntegration::nsMessengerUnixIntegration()
{
mBiffStateAtom = MsgGetAtom("BiffState");
mNewMailReceivedAtom = MsgGetAtom("NewMailReceived");
mAlertInProgress = false;
mLastMRUTimes.Init();
NS_NewISupportsArray(getter_AddRefs(mFoldersWithNewMail));
}
示例13: do_GetAtom
nsMessengerOSXIntegration::nsMessengerOSXIntegration()
{
mBiffStateAtom = do_GetAtom("BiffState");
mBiffIconVisible = PR_FALSE;
mSuppressBiffIcon = PR_FALSE;
mAlertInProgress = PR_FALSE;
NS_NewISupportsArray(getter_AddRefs(mFoldersWithNewMail));
}
示例14: NS_NewISupportsArray
NS_IMETHODIMP nsScrollPortView::AddScrollPositionListener(nsIScrollPositionListener* aListener)
{
if (nsnull == mListeners) {
nsresult rv = NS_NewISupportsArray(&mListeners);
if (NS_FAILED(rv))
return rv;
}
return mListeners->AppendElement(aListener);
}
示例15: chromeUrl
NS_IMETHODIMP nsMessengerBootstrap::OpenMessengerWindowWithUri(const char *windowType, const char * aFolderURI, nsMsgKey aMessageKey)
{
bool standAloneMsgWindow = false;
nsCAutoString chromeUrl("chrome://messenger/content/");
if (windowType && !strcmp(windowType, "mail:messageWindow"))
{
chromeUrl.Append("messageWindow.xul");
standAloneMsgWindow = true;
}
nsCOMPtr<nsISupportsArray> argsArray;
nsresult rv = NS_NewISupportsArray(getter_AddRefs(argsArray));
NS_ENSURE_SUCCESS(rv, rv);
// create scriptable versions of our strings that we can store in our nsISupportsArray....
if (aFolderURI)
{
if (standAloneMsgWindow)
{
nsCOMPtr <nsIMsgFolder> folder;
rv = GetExistingFolder(nsDependentCString(aFolderURI), getter_AddRefs(folder));
NS_ENSURE_SUCCESS(rv, rv);
nsCAutoString msgUri;
folder->GetBaseMessageURI(msgUri);
nsCOMPtr<nsISupportsCString> scriptableMsgURI (do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID));
NS_ENSURE_TRUE(scriptableMsgURI, NS_ERROR_FAILURE);
msgUri.Append('#');
msgUri.AppendInt(aMessageKey, 10);
scriptableMsgURI->SetData(msgUri);
argsArray->AppendElement(scriptableMsgURI);
}
nsCOMPtr<nsISupportsCString> scriptableFolderURI (do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID));
NS_ENSURE_TRUE(scriptableFolderURI, NS_ERROR_FAILURE);
scriptableFolderURI->SetData(nsDependentCString(aFolderURI));
argsArray->AppendElement(scriptableFolderURI);
if (!standAloneMsgWindow)
{
nsCOMPtr<nsISupportsPRUint32> scriptableMessageKey (do_CreateInstance(NS_SUPPORTS_PRUINT32_CONTRACTID));
NS_ENSURE_TRUE(scriptableMessageKey, NS_ERROR_FAILURE);
scriptableMessageKey->SetData(aMessageKey);
argsArray->AppendElement(scriptableMessageKey);
}
}
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
// we need to use the "mailnews.reuse_thread_window2" pref
// to determine if we should open a new window, or use an existing one.
nsCOMPtr<nsIDOMWindow> newWindow;
return wwatch->OpenWindow(0, chromeUrl.get(), "_blank",
"chrome,all,dialog=no", argsArray,
getter_AddRefs(newWindow));
}