mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
0fd9123eac
This patch was generated by a script. Here's the source of the script for future reference: function convert() { echo "Converting $1 to $2..." find . ! -wholename "*nsprpub*" \ ! -wholename "*security/nss*" \ ! -wholename "*/.hg*" \ ! -wholename "obj-ff-dbg*" \ ! -name nsXPCOMCID.h \ ! -name prtypes.h \ -type f \ \( -iname "*.cpp" \ -o -iname "*.h" \ -o -iname "*.c" \ -o -iname "*.cc" \ -o -iname "*.idl" \ -o -iname "*.ipdl" \ -o -iname "*.ipdlh" \ -o -iname "*.mm" \) | \ xargs -n 1 sed -i -e "s/\b$1\b/$2/g" } convert PRInt8 int8_t convert PRUint8 uint8_t convert PRInt16 int16_t convert PRUint16 uint16_t convert PRInt32 int32_t convert PRUint32 uint32_t convert PRInt64 int64_t convert PRUint64 uint64_t convert PRIntn int convert PRUintn unsigned convert PRSize size_t convert PROffset32 int32_t convert PROffset64 int64_t convert PRPtrdiff ptrdiff_t convert PRFloat64 double
139 lines
3.6 KiB
C++
139 lines
3.6 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
#ifndef NSCATEGORYMANAGER_H
|
|
#define NSCATEGORYMANAGER_H
|
|
|
|
#include "prio.h"
|
|
#include "plarena.h"
|
|
#include "nsClassHashtable.h"
|
|
#include "nsICategoryManager.h"
|
|
#include "mozilla/Mutex.h"
|
|
#include "mozilla/Attributes.h"
|
|
|
|
#define NS_CATEGORYMANAGER_CLASSNAME "Category Manager"
|
|
|
|
/* 16d222a6-1dd2-11b2-b693-f38b02c021b2 */
|
|
#define NS_CATEGORYMANAGER_CID \
|
|
{ 0x16d222a6, 0x1dd2, 0x11b2, \
|
|
{0xb6, 0x93, 0xf3, 0x8b, 0x02, 0xc0, 0x21, 0xb2} }
|
|
|
|
/**
|
|
* a "leaf-node", managed by the nsCategoryNode hashtable.
|
|
*
|
|
* we need to keep a "persistent value" (which will be written to the registry)
|
|
* and a non-persistent value (for the current runtime): these are usually
|
|
* the same, except when aPersist==false. The strings are permanently arena-
|
|
* allocated, and will never go away.
|
|
*/
|
|
class CategoryLeaf : public nsDepCharHashKey
|
|
{
|
|
public:
|
|
CategoryLeaf(const char* aKey)
|
|
: nsDepCharHashKey(aKey),
|
|
value(NULL) { }
|
|
const char* value;
|
|
};
|
|
|
|
|
|
/**
|
|
* CategoryNode keeps a hashtable of its entries.
|
|
* the CategoryNode itself is permanently allocated in
|
|
* the arena.
|
|
*/
|
|
class CategoryNode
|
|
{
|
|
public:
|
|
NS_METHOD GetLeaf(const char* aEntryName,
|
|
char** _retval);
|
|
|
|
NS_METHOD AddLeaf(const char* aEntryName,
|
|
const char* aValue,
|
|
bool aReplace,
|
|
char** _retval,
|
|
PLArenaPool* aArena);
|
|
|
|
void DeleteLeaf(const char* aEntryName);
|
|
|
|
void Clear() {
|
|
mozilla::MutexAutoLock lock(mLock);
|
|
mTable.Clear();
|
|
}
|
|
|
|
uint32_t Count() {
|
|
mozilla::MutexAutoLock lock(mLock);
|
|
uint32_t tCount = mTable.Count();
|
|
return tCount;
|
|
}
|
|
|
|
NS_METHOD Enumerate(nsISimpleEnumerator** _retval);
|
|
|
|
// CategoryNode is arena-allocated, with the strings
|
|
static CategoryNode* Create(PLArenaPool* aArena);
|
|
~CategoryNode();
|
|
void operator delete(void*) { }
|
|
|
|
private:
|
|
CategoryNode()
|
|
: mLock("CategoryLeaf")
|
|
{ }
|
|
|
|
void* operator new(size_t aSize, PLArenaPool* aArena);
|
|
|
|
nsTHashtable<CategoryLeaf> mTable;
|
|
mozilla::Mutex mLock;
|
|
};
|
|
|
|
|
|
/**
|
|
* The main implementation of nsICategoryManager.
|
|
*
|
|
* This implementation is thread-safe.
|
|
*/
|
|
class nsCategoryManager MOZ_FINAL
|
|
: public nsICategoryManager
|
|
{
|
|
public:
|
|
NS_DECL_ISUPPORTS
|
|
NS_DECL_NSICATEGORYMANAGER
|
|
|
|
/**
|
|
* Suppress or unsuppress notifications of category changes to the
|
|
* observer service. This is to be used by nsComponentManagerImpl
|
|
* on startup while reading the stored category list.
|
|
*/
|
|
NS_METHOD SuppressNotifications(bool aSuppress);
|
|
|
|
void AddCategoryEntry(const char* aCategory,
|
|
const char* aKey,
|
|
const char* aValue,
|
|
bool aReplace = true,
|
|
char** aOldValue = NULL);
|
|
|
|
static nsresult Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
|
|
|
|
static nsCategoryManager* GetSingleton();
|
|
static void Destroy();
|
|
|
|
private:
|
|
static nsCategoryManager* gCategoryManager;
|
|
|
|
nsCategoryManager();
|
|
~nsCategoryManager();
|
|
|
|
CategoryNode* get_category(const char* aName);
|
|
void NotifyObservers(const char* aTopic,
|
|
const char* aCategoryName, // must be a static string
|
|
const char* aEntryName);
|
|
|
|
PLArenaPool mArena;
|
|
nsClassHashtable<nsDepCharHashKey, CategoryNode> mTable;
|
|
mozilla::Mutex mLock;
|
|
bool mSuppressNotifications;
|
|
};
|
|
|
|
#endif
|