xptcall.h revision be774fd2507ed84a168d42e1cb4512f62a1fa7bb
/* -*- 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
*
* 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 ***** */
/* Public declarations for xptcall. */
#ifndef xptcall_h___
#define xptcall_h___
#include "prtypes.h"
#include "nscore.h"
#include "nsISupports.h"
#include "xpt_struct.h"
#include "xptinfo.h"
#include "nsIInterfaceInfo.h"
/***************************************************************************/
/*
* The linkage of XPTC API functions differs depending on whether the file is
* used within the XPTC library or not. Any source file within the XPTC
* library should define EXPORT_XPTC_API whereas any client of the library
* should not.
*/
#ifdef EXPORT_XPTC_API
#define XPTC_PUBLIC_API(t) PR_IMPLEMENT(t)
#define XPTC_PUBLIC_DATA(t) PR_IMPLEMENT_DATA(t)
#ifdef _WIN32
#else
# ifdef VBOX_HAVE_VISIBILITY_HIDDEN
# else
# define XPTC_EXPORT
# endif
#endif
#else
#ifdef _WIN32
#else
# define XPTC_PUBLIC_API(t) PR_IMPLEMENT(t)
# define XPTC_PUBLIC_DATA(t) t
# define XPTC_EXPORT
#endif
#endif
#define XPTC_FRIEND_API(t) XPTC_PUBLIC_API(t)
#define XPTC_FRIEND_DATA(t) XPTC_PUBLIC_DATA(t)
/***************************************************************************/
struct nsXPTCMiniVariant
{
// No ctors or dtors so that we can use arrays of these on the stack
// with no penalty.
union
{
float f;
double d;
PRBool b;
char c;
void* p;
} val;
};
{
// No ctors or dtors so that we can use arrays of these on the stack
// with no penalty.
// inherits 'val' here
void* ptr;
enum
{
// these are bitflags!
};
void ClearFlags() {flags = 0;}
{
type = t;
flags = f;
if(f & PTR_IS_DATA)
{
}
else
{
switch(t.TagPart()) {
}
}
}
};
/***************************************************************************/
{
// We are going to implement this to force the compiler to generate a
// vtbl for this class. Since this is overridden in the inheriting class
// we expect it to never be called.
// *This is needed by the Irix implementation.*
// Include generated vtbl stub declarations.
// These are virtual and *also* implemented by this class..
#include "xptcstubsdecl.inc"
// The following methods must be provided by inheritor of this class.
// return a refcounted pointer to the InterfaceInfo for this object
// NOTE: on some platforms this MUST not fail or we crash!
// call this method and return result
const nsXPTMethodInfo* info,
nsXPTCMiniVariant* params) = 0;
};
// Used to force linking of these obj for the static library into the dll
extern void xptc_dummy();
extern void xptc_dummy2();
#endif /* xptcall_h___ */