Backing out bug 313309 part 3 due to various intermingled bustages.

This commit is contained in:
bsmedberg%covad.net 2005-11-14 16:37:43 +00:00
Родитель 107e388551
Коммит 638b74d7bd
3 изменённых файлов: 27 добавлений и 21 удалений

Просмотреть файл

@ -80,8 +80,6 @@ typedef PRUint32 nsrefcnt;
class NS_NO_VTABLE nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISUPPORTS_IID)
/**
* @name Methods
*/
@ -117,9 +115,5 @@ public:
//@}
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsISupports, NS_ISUPPORTS_IID)
/*@}*/
#endif

Просмотреть файл

@ -134,23 +134,13 @@ typedef nsID nsIID;
const nsIID _name = _iidspec
/**
* A macro to build the static const IID accessor method. The Dummy
* template parameter only exists so that the kIID symbol will be linked
* properly (weak symbol on linux, gnu_linkonce on mac, multiple-definitions
* merged on windows). Dummy should always be instantiated as "int".
* A macro to build the static const IID accessor method
*/
#define NS_DECLARE_STATIC_IID_ACCESSOR(the_iid) \
template <class Dummy> \
struct COMTypeInfo \
{ \
static const nsIID kIID NS_HIDDEN; \
}; \
static const nsIID& GetIID() {return COMTypeInfo<int>::kIID;}
static const nsIID& GetIID() {static const nsIID iid = the_iid; return iid;}
#define NS_DEFINE_STATIC_IID_ACCESSOR(the_interface, the_iid) \
template <class Dummy> \
const nsIID the_interface::COMTypeInfo<Dummy>::kIID NS_HIDDEN = the_iid;
#define NS_DEFINE_STATIC_IID_ACCESSOR(the_interface, the_iid)
/**
* A macro to build the static const CID accessor method
@ -159,7 +149,7 @@ typedef nsID nsIID;
#define NS_DEFINE_STATIC_CID_ACCESSOR(the_cid) \
static const nsID& GetCID() {static const nsID cid = the_cid; return cid;}
#define NS_GET_IID(T) (T::COMTypeInfo<int>::kIID)
#define NS_GET_TEMPLATE_IID(T) (T::template COMTypeInfo<int>::kIID)
#define NS_GET_IID(T) nsCOMTypeInfo<T>::GetIID()
#define NS_GET_TEMPLATE_IID(T) NS_GET_IID(T)
#endif

Просмотреть файл

@ -190,6 +190,26 @@ ns_if_addref( T expr )
#define NS_ISUPPORTS_CAST(__unambiguousBase, __expr) \
NS_STATIC_CAST(nsISupports*, NS_STATIC_CAST(__unambiguousBase, __expr))
extern "C++" {
// ...because some one is accidentally including this file inside
// an |extern "C"|
class nsISupports;
template <class T>
struct nsCOMTypeInfo
{
static const nsIID& GetIID() { return T::GetIID(); }
};
NS_SPECIALIZE_TEMPLATE
struct nsCOMTypeInfo<nsISupports>
{
static const nsIID& GetIID() {
static const nsIID iid_NS_ISUPPORTS_IID = NS_ISUPPORTS_IID; return iid_NS_ISUPPORTS_IID;
}
};
// a type-safe shortcut for calling the |QueryInterface()| member function
template <class T, class DestinationType>
inline
@ -203,4 +223,6 @@ CallQueryInterface( T* aSource, DestinationType** aDestination )
NS_REINTERPRET_CAST(void**, aDestination));
}
} // extern "C++"
#endif /* __nsISupportsUtils_h */