mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 08:42:13 +00:00
Bug 1181445 (part 11) - Use nsBaseHashTable::Iterator in xpcom/glue/. r=froydnj.
--HG-- extra : rebase_source : 5b6fe9813c08627f626fa8da66a8e724baa274aa
This commit is contained in:
parent
70347ce8c5
commit
d367971294
@ -75,28 +75,21 @@ public:
|
||||
mObserver = new nsCategoryObserver(mCategoryName.get());
|
||||
}
|
||||
|
||||
mObserver->GetHash().EnumerateRead(EntriesToArray, &aResult);
|
||||
for (auto iter = mObserver->GetHash().Iter(); !iter.Done(); iter.Next()) {
|
||||
nsISupports* entry = iter.GetUserData();
|
||||
nsCOMPtr<T> service = do_QueryInterface(entry);
|
||||
if (service) {
|
||||
aResult.AppendObject(service);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
// Not to be implemented
|
||||
nsCategoryCache(const nsCategoryCache<T>&);
|
||||
|
||||
static PLDHashOperator EntriesToArray(const nsACString& aKey,
|
||||
nsISupports* aEntry, void* aArg)
|
||||
{
|
||||
nsCOMArray<T>& entries = *static_cast<nsCOMArray<T>*>(aArg);
|
||||
|
||||
nsCOMPtr<T> service = do_QueryInterface(aEntry);
|
||||
if (service) {
|
||||
entries.AppendObject(service);
|
||||
}
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
nsCString mCategoryName;
|
||||
nsRefPtr<nsCategoryObserver> mObserver;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -299,24 +299,14 @@ nsINIParser::GetString(const char* aSection, const char* aKey,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
PLDHashOperator
|
||||
nsINIParser::GetSectionsCB(const char* aKey, INIValue* aData,
|
||||
void* aClosure)
|
||||
{
|
||||
GSClosureStruct* cs = reinterpret_cast<GSClosureStruct*>(aClosure);
|
||||
|
||||
return cs->usercb(aKey, cs->userclosure) ? PL_DHASH_NEXT : PL_DHASH_STOP;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsINIParser::GetSections(INISectionCallback aCB, void* aClosure)
|
||||
{
|
||||
GSClosureStruct gs = {
|
||||
aCB,
|
||||
aClosure
|
||||
};
|
||||
|
||||
mSections.EnumerateRead(GetSectionsCB, &gs);
|
||||
for (auto iter = mSections.Iter(); !iter.Done(); iter.Next()) {
|
||||
if (!aCB(iter.GetKey(), aClosure)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -109,19 +109,10 @@ private:
|
||||
nsAutoPtr<INIValue> next;
|
||||
};
|
||||
|
||||
struct GSClosureStruct
|
||||
{
|
||||
INISectionCallback usercb;
|
||||
void* userclosure;
|
||||
};
|
||||
|
||||
nsClassHashtable<nsDepCharHashKey, INIValue> mSections;
|
||||
nsAutoArrayPtr<char> mFileContents;
|
||||
|
||||
nsresult InitFromFILE(FILE* aFd);
|
||||
|
||||
static PLDHashOperator GetSectionsCB(const char* aKey,
|
||||
INIValue* aData, void* aClosure);
|
||||
};
|
||||
|
||||
#endif /* nsINIParser_h__ */
|
||||
|
Loading…
Reference in New Issue
Block a user