summaryrefslogtreecommitdiffstats
path: root/src/libs/xpcom18a4/xpcom/reflect/xptinfo/public
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-11 08:17:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-11 08:17:27 +0000
commitf215e02bf85f68d3a6106c2a1f4f7f063f819064 (patch)
tree6bb5b92c046312c4e95ac2620b10ddf482d3fa8b /src/libs/xpcom18a4/xpcom/reflect/xptinfo/public
parentInitial commit. (diff)
downloadvirtualbox-f215e02bf85f68d3a6106c2a1f4f7f063f819064.tar.xz
virtualbox-f215e02bf85f68d3a6106c2a1f4f7f063f819064.zip
Adding upstream version 7.0.14-dfsg.upstream/7.0.14-dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/.cvsignore1
-rw-r--r--src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/Makefile.in66
-rw-r--r--src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/nsIInterfaceInfo.idl137
-rw-r--r--src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/nsIInterfaceInfoManager.idl85
-rw-r--r--src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/nsIXPTLoader.idl100
-rw-r--r--src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/xptinfo.h281
6 files changed, 670 insertions, 0 deletions
diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/.cvsignore b/src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/.cvsignore
new file mode 100644
index 00000000..f3c7a7c5
--- /dev/null
+++ b/src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/.cvsignore
@@ -0,0 +1 @@
+Makefile
diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/Makefile.in b/src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/Makefile.in
new file mode 100644
index 00000000..dbf13d8b
--- /dev/null
+++ b/src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/Makefile.in
@@ -0,0 +1,66 @@
+#
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is
+# Netscape Communications Corporation.
+# Portions created by the Initial Developer are Copyright (C) 1999
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either of the GNU General Public License Version 2 or later (the "GPL"),
+# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH = ../../../..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE = xpcom
+
+XPIDL_MODULE = xpcom_xpti
+
+GRE_MODULE = 1
+
+EXPORTS = \
+ xptinfo.h \
+ $(NULL)
+
+XPIDLSRCS = \
+ nsIInterfaceInfo.idl \
+ nsIInterfaceInfoManager.idl \
+ nsIXPTLoader.idl \
+ $(NULL)
+
+EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
+
+include $(topsrcdir)/config/rules.mk
+
+CFLAGS += -DEXPORT_XPCI_API
+
diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/nsIInterfaceInfo.idl b/src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/nsIInterfaceInfo.idl
new file mode 100644
index 00000000..f77dbcfc
--- /dev/null
+++ b/src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/nsIInterfaceInfo.idl
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1999
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* The nsIInterfaceInfo public declaration. */
+
+
+#include "nsISupports.idl"
+
+// forward declaration of non-XPCOM types
+
+[ptr] native nsXPTMethodInfoPtr(nsXPTMethodInfo);
+[ptr] native nsXPTConstantPtr(nsXPTConstant);
+[ptr] native nsXPTParamInfoPtr(nsXPTParamInfo);
+ native nsXPTType(nsXPTType);
+
+// We bend the rules to do a [shared] nsIID (but this is never scriptable)
+[ptr] native nsIIDPtrShared(nsIID);
+
+%{C++
+class nsXPTMethodInfo;
+class nsXPTConstant;
+class nsXPTParamInfo;
+class nsXPTType;
+%}
+
+/* this is NOT intended to be scriptable */
+[uuid(215DBE04-94A7-11d2-BA58-00805F8A5DD7)]
+interface nsIInterfaceInfo : nsISupports
+{
+ readonly attribute string name;
+ readonly attribute nsIIDPtr InterfaceIID;
+
+ PRBool isScriptable();
+
+ readonly attribute nsIInterfaceInfo parent;
+
+ /**
+ * These include counts for parent (and all ancestors).
+ */
+ readonly attribute PRUint16 methodCount;
+ readonly attribute PRUint16 constantCount;
+
+ /**
+ * These include methods and constants for parent (and all ancestors).
+ *
+ * These do *not* make copies ***explicit bending of XPCOM rules***.
+ */
+
+ void getMethodInfo(in PRUint16 index,
+ [shared, retval] out nsXPTMethodInfoPtr info);
+
+ void getMethodInfoForName(in string methodName, out PRUint16 index,
+ [shared, retval] out nsXPTMethodInfoPtr info);
+
+ void getConstant(in PRUint16 index,
+ [shared, retval] out nsXPTConstantPtr constant);
+
+
+ /**
+ * Get the interface information or iid associated with a param of some
+ * method in this interface.
+ */
+
+ nsIInterfaceInfo getInfoForParam(in PRUint16 methodIndex,
+ [const] in nsXPTParamInfoPtr param);
+
+ nsIIDPtr getIIDForParam(in PRUint16 methodIndex,
+ [const] in nsXPTParamInfoPtr param);
+
+
+ /**
+ * These do *not* make copies ***explicit bending of XPCOM rules***.
+ */
+
+ nsXPTType getTypeForParam(in PRUint16 methodIndex,
+ [const] in nsXPTParamInfoPtr param,
+ in PRUint16 dimension);
+
+ PRUint8 getSizeIsArgNumberForParam(in PRUint16 methodIndex,
+ [const] in nsXPTParamInfoPtr param,
+ in PRUint16 dimension);
+
+ PRUint8 getLengthIsArgNumberForParam(in PRUint16 methodIndex,
+ [const] in nsXPTParamInfoPtr param,
+ in PRUint16 dimension);
+
+ PRUint8 getInterfaceIsArgNumberForParam(in PRUint16 methodIndex,
+ [const] in nsXPTParamInfoPtr param);
+
+ PRBool isIID(in nsIIDPtr IID);
+
+ void getNameShared([shared,retval] out string name);
+ void getIIDShared([shared,retval] out nsIIDPtrShared iid);
+
+ PRBool isFunction();
+
+ PRBool hasAncestor(in nsIIDPtr iid);
+
+ [notxpcom] nsresult getIIDForParamNoAlloc(in PRUint16 methodIndex,
+ [const] in nsXPTParamInfoPtr param,
+ out nsIID iid);
+};
+
diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/nsIInterfaceInfoManager.idl b/src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/nsIInterfaceInfoManager.idl
new file mode 100644
index 00000000..48277691
--- /dev/null
+++ b/src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/nsIInterfaceInfoManager.idl
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1999
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* The nsIInterfaceInfoManager public declaration. */
+
+
+#include "nsISupports.idl"
+#include "nsIInterfaceInfo.idl"
+#include "nsIEnumerator.idl"
+#include "nsISimpleEnumerator.idl"
+
+/* this is NOT intended to be scriptable */
+[uuid(8B161900-BE2B-11d2-9831-006008962422)]
+interface nsIInterfaceInfoManager : nsISupports
+{
+ nsIInterfaceInfo getInfoForIID(in nsIIDPtr iid);
+ nsIInterfaceInfo getInfoForName(in string name);
+
+ nsIIDPtr getIIDForName(in string name);
+ string getNameForIID(in nsIIDPtr iid);
+
+ nsIEnumerator enumerateInterfaces();
+
+ void autoRegisterInterfaces();
+
+ nsIEnumerator enumerateInterfacesWhoseNamesStartWith(in string prefix);
+};
+
+[uuid(0ee22850-bc6a-11d5-9134-0010a4e73d9a)]
+interface nsIInterfaceInfoSuperManager : nsIInterfaceInfoManager
+{
+ void addAdditionalManager(in nsIInterfaceInfoManager manager);
+ void removeAdditionalManager(in nsIInterfaceInfoManager manager);
+
+ PRBool hasAdditionalManagers();
+ nsISimpleEnumerator enumerateAdditionalManagers();
+};
+
+%{C++
+#define NS_INTERFACEINFOMANAGER_SERVICE_CLASSNAME \
+ "Interface Information Manager Service"
+
+#define NS_INTERFACEINFOMANAGER_SERVICE_CID \
+ { /* 13bef784-f8e0-4f96-85c1-09f9ef4f9a19 */ \
+ 0x13bef784, 0xf8e0, 0x4f96, \
+ {0x85, 0xc1, 0x09, 0xf9, 0xef, 0x4f, 0x9a, 0x19} }
+
+#define NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID \
+ "@mozilla.org/xpti/interfaceinfomanager-service;1"
+%}
+
diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/nsIXPTLoader.idl b/src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/nsIXPTLoader.idl
new file mode 100644
index 00000000..8918daa3
--- /dev/null
+++ b/src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/nsIXPTLoader.idl
@@ -0,0 +1,100 @@
+/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the external XPT loader interface.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corp.
+ * Portions created by the Initial Developer are Copyright (C) 2002
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * John Bandhauer <jband@netscape.com>
+ * Alec Flett <alecf@netscape.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+
+#include "nsISupports.idl"
+#include "nsILocalFile.idl"
+#include "nsIInputStream.idl"
+
+/**
+ * Implement nsIXPTLoaderSink if you want to enumerate the entries in
+ * an XPT archive of some kind
+ */
+[scriptable, uuid(6E48C500-8682-4730-ADD6-7DB693B9E7BA)]
+interface nsIXPTLoaderSink : nsISupports {
+
+ /**
+ * called by the loader for each entry in the archive
+ * @param itemName the name of this particular item in the archive
+ * @param index the index of the item inthe archive
+ * @param stream contains the contents of the xpt file
+ */
+ void foundEntry(in string itemName,
+ in long index,
+ in nsIInputStream xptData);
+};
+
+/**
+ * The XPT loader interface: implemented by a loader to grab an input
+ * stream which will be consumed by the interface loader.
+ */
+[scriptable, uuid(368A15D9-17A9-4c2b-AC3D-A35B3A22B876)]
+interface nsIXPTLoader : nsISupports {
+ /**
+ * enumerate entries in the given archive
+ * for each entry found, the loader will call the sink's
+ * foundEntry() method with the appropriate information and a
+ * stream that the consumer can read from
+ * @param file the file to read from
+ * @param sink an object which will be called with each file found
+ * in the file
+ */
+ void enumerateEntries(in nsILocalFile file,
+ in nsIXPTLoaderSink sink );
+
+ /**
+ * Load a specific entry from the archive
+ * @param file the file to read from
+ * @param name the name of the xpt within the file
+ * @return an input stream that will read the raw xpt data from
+ * the file
+ */
+ nsIInputStream loadEntry(in nsILocalFile file,
+ in string name);
+};
+
+
+%{C++
+
+// the first part of the contractID for any loader
+// append the type of loader that you need, such as "zip"
+#define NS_XPTLOADER_CONTRACTID_PREFIX \
+ "@mozilla.org/xptinfo/loader;1&type="
+
+%}
diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/xptinfo.h b/src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/xptinfo.h
new file mode 100644
index 00000000..076482a6
--- /dev/null
+++ b/src/libs/xpcom18a4/xpcom/reflect/xptinfo/public/xptinfo.h
@@ -0,0 +1,281 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1999
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* XPTI_PUBLIC_API and XPTI_GetInterfaceInfoManager declarations. */
+
+#ifndef xptiinfo_h___
+#define xptiinfo_h___
+
+#include "prtypes.h"
+#include "xpt_struct.h"
+
+#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
+#define XPTI_GetInterfaceInfoManager VBoxNsxpXPTI_GetInterfaceInfoManager
+#define XPTI_FreeInterfaceInfoManager VBoxNsxpXPTI_FreeInterfaceInfoManager
+#endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
+
+/*
+ * The linkage of XPTI API functions differs depending on whether the file is
+ * used within the XPTI library or not. Any source file within the XPTI
+ * library should define EXPORT_XPTI_API whereas any client of the library
+ * should not.
+ */
+#ifdef EXPORT_XPTI_API
+#define XPTI_PUBLIC_API(t) PR_IMPLEMENT(t)
+#define XPTI_PUBLIC_DATA(t) PR_IMPLEMENT_DATA(t)
+#if defined(_WIN32)
+# define XPTI_EXPORT __declspec(dllexport)
+#elif defined(XP_OS2) && defined(__declspec)
+# define XPTI_EXPORT __declspec(dllexport)
+#elif defined(XP_OS2_VACPP)
+# define XPTI_EXPORT extern
+#else
+# define XPTI_EXPORT
+#endif
+#else
+#if defined(_WIN32)
+# define XPTI_PUBLIC_API(t) __declspec(dllimport) t
+# define XPTI_PUBLIC_DATA(t) __declspec(dllimport) t
+# define XPTI_EXPORT __declspec(dllimport)
+#elif defined(XP_OS2) && defined(__declspec)
+# define XPTI_PUBLIC_API(t) __declspec(dllimport) t
+# define XPTI_PUBLIC_DATA(t) __declspec(dllimport) t
+# define XPTI_EXPORT __declspec(dllimport)
+#elif defined(XP_OS2_VACPP)
+# define XPTI_PUBLIC_API(t) extern t
+# define XPTI_PUBLIC_DATA(t) extern t
+# define XPTI_EXPORT extern
+#else
+# define XPTI_PUBLIC_API(t) PR_IMPLEMENT(t)
+# define XPTI_PUBLIC_DATA(t) t
+# define XPTI_EXPORT
+#endif
+#endif
+#define XPTI_FRIEND_API(t) XPTI_PUBLIC_API(t)
+#define XPTI_FRIEND_DATA(t) XPTI_PUBLIC_DATA(t)
+
+class nsIInterfaceInfoManager;
+PR_BEGIN_EXTERN_C
+// Even if this is a service, it is cool to provide a direct accessor
+XPTI_PUBLIC_API(nsIInterfaceInfoManager*)
+XPTI_GetInterfaceInfoManager();
+
+// Even if this is a service, it is cool to provide a direct accessor
+XPTI_PUBLIC_API(void)
+XPTI_FreeInterfaceInfoManager();
+PR_END_EXTERN_C
+
+
+
+// Flyweight wrapper classes for xpt_struct.h structs.
+// Everything here is dependent upon - and sensitive to changes in -
+// xpcom/typelib/xpt/public/xpt_struct.h!
+
+class nsXPTType : public XPTTypeDescriptorPrefix
+{
+// NO DATA - this a flyweight wrapper
+public:
+ nsXPTType()
+ {} // random contents
+ nsXPTType(const XPTTypeDescriptorPrefix& prefix)
+ {*(XPTTypeDescriptorPrefix*)this = prefix;}
+
+ nsXPTType(const uint8& prefix)
+ {*(uint8*)this = prefix;}
+
+ nsXPTType& operator=(uint8 val)
+ {flags = val; return *this;}
+
+ nsXPTType& operator=(const nsXPTType& other)
+ {flags = other.flags; return *this;}
+
+ operator uint8() const
+ {return flags;}
+
+ PRBool IsPointer() const
+ {return 0 != (XPT_TDP_IS_POINTER(flags));}
+
+ PRBool IsUniquePointer() const
+ {return 0 != (XPT_TDP_IS_UNIQUE_POINTER(flags));}
+
+ PRBool IsReference() const
+ {return 0 != (XPT_TDP_IS_REFERENCE(flags));}
+
+ PRBool IsArithmetic() const // terminology from Harbison/Steele
+ {return flags <= T_WCHAR;}
+
+ PRBool IsInterfacePointer() const
+ { switch (TagPart()) {
+ default:
+ return PR_FALSE;
+ case T_INTERFACE:
+ case T_INTERFACE_IS:
+ return PR_TRUE;
+ }
+ }
+
+ PRBool IsArray() const
+ {return (PRBool) TagPart() == T_ARRAY;}
+
+ // 'Dependent' means that params of this type are dependent upon other
+ // params. e.g. an T_INTERFACE_IS is dependent upon some other param at
+ // runtime to say what the interface type of this param really is.
+ PRBool IsDependent() const
+ { switch (TagPart()) {
+ default:
+ return PR_FALSE;
+ case T_INTERFACE_IS:
+ case TD_ARRAY:
+ case T_PSTRING_SIZE_IS:
+ case T_PWSTRING_SIZE_IS:
+ return PR_TRUE;
+ }
+ }
+
+ uint8 TagPart() const
+ {return (uint8) (flags & XPT_TDP_TAGMASK);}
+
+ enum
+ {
+ T_I8 = TD_INT8 ,
+ T_I16 = TD_INT16 ,
+ T_I32 = TD_INT32 ,
+ T_I64 = TD_INT64 ,
+ T_U8 = TD_UINT8 ,
+ T_U16 = TD_UINT16 ,
+ T_U32 = TD_UINT32 ,
+ T_U64 = TD_UINT64 ,
+ T_FLOAT = TD_FLOAT ,
+ T_DOUBLE = TD_DOUBLE ,
+ T_BOOL = TD_BOOL ,
+ T_CHAR = TD_CHAR ,
+ T_WCHAR = TD_WCHAR ,
+ T_VOID = TD_VOID ,
+ T_IID = TD_PNSIID ,
+ T_DOMSTRING = TD_DOMSTRING ,
+ T_CHAR_STR = TD_PSTRING ,
+ T_WCHAR_STR = TD_PWSTRING ,
+ T_INTERFACE = TD_INTERFACE_TYPE ,
+ T_INTERFACE_IS = TD_INTERFACE_IS_TYPE,
+ T_ARRAY = TD_ARRAY ,
+ T_PSTRING_SIZE_IS = TD_PSTRING_SIZE_IS ,
+ T_PWSTRING_SIZE_IS = TD_PWSTRING_SIZE_IS ,
+ T_UTF8STRING = TD_UTF8STRING ,
+ T_CSTRING = TD_CSTRING ,
+ T_ASTRING = TD_ASTRING
+ };
+// NO DATA - this a flyweight wrapper
+};
+
+class nsXPTParamInfo : public XPTParamDescriptor
+{
+// NO DATA - this a flyweight wrapper
+public:
+ nsXPTParamInfo(const XPTParamDescriptor& desc)
+ {*(XPTParamDescriptor*)this = desc;}
+
+
+ PRBool IsIn() const {return 0 != (XPT_PD_IS_IN(flags));}
+ PRBool IsOut() const {return 0 != (XPT_PD_IS_OUT(flags));}
+ PRBool IsRetval() const {return 0 != (XPT_PD_IS_RETVAL(flags));}
+ PRBool IsShared() const {return 0 != (XPT_PD_IS_SHARED(flags));}
+ PRBool IsDipper() const {return 0 != (XPT_PD_IS_DIPPER(flags));}
+ const nsXPTType GetType() const {return type.prefix;}
+
+ // NOTE: other activities on types are done via methods on nsIInterfaceInfo
+
+private:
+ nsXPTParamInfo(); // no implementation
+// NO DATA - this a flyweight wrapper
+};
+
+class nsXPTMethodInfo : public XPTMethodDescriptor
+{
+// NO DATA - this a flyweight wrapper
+public:
+ nsXPTMethodInfo(const XPTMethodDescriptor& desc)
+ {*(XPTMethodDescriptor*)this = desc;}
+
+ PRBool IsGetter() const {return 0 != (XPT_MD_IS_GETTER(flags) );}
+ PRBool IsSetter() const {return 0 != (XPT_MD_IS_SETTER(flags) );}
+ PRBool IsNotXPCOM() const {return 0 != (XPT_MD_IS_NOTXPCOM(flags));}
+ PRBool IsConstructor() const {return 0 != (XPT_MD_IS_CTOR(flags) );}
+ PRBool IsHidden() const {return 0 != (XPT_MD_IS_HIDDEN(flags) );}
+ const char* GetName() const {return name;}
+ uint8 GetParamCount() const {return num_args;}
+ /* idx was index before I got _sick_ of the warnings on Unix, sorry jband */
+ const nsXPTParamInfo GetParam(uint8 idx) const
+ {
+ NS_PRECONDITION(idx < GetParamCount(),"bad arg");
+ return params[idx];
+ }
+ const nsXPTParamInfo GetResult() const
+ {return *result;}
+private:
+ nsXPTMethodInfo(); // no implementation
+// NO DATA - this a flyweight wrapper
+};
+
+
+// forward declaration
+struct nsXPTCMiniVariant;
+
+class nsXPTConstant : public XPTConstDescriptor
+{
+// NO DATA - this a flyweight wrapper
+public:
+ nsXPTConstant(const XPTConstDescriptor& desc)
+ {*(XPTConstDescriptor*)this = desc;}
+
+ const char* GetName() const
+ {return name;}
+
+ const nsXPTType GetType() const
+ {return type.prefix;}
+
+ // XXX this is ugly. But sometimes you gotta do what you gotta do.
+ // A reinterpret_cast won't do the trick here. And this plain C cast
+ // works correctly and is safe enough.
+ // See http://bugzilla.mozilla.org/show_bug.cgi?id=49641
+ const nsXPTCMiniVariant* GetValue() const
+ {return (nsXPTCMiniVariant*) &value;}
+private:
+ nsXPTConstant(); // no implementation
+// NO DATA - this a flyweight wrapper
+};
+
+#endif /* xptiinfo_h___ */