xptinfo.h revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
/* -*- 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 ***** */
/* XPTI_PUBLIC_API and XPTI_GetInterfaceInfoManager declarations. */
#ifndef xptiinfo_h___
#define xptiinfo_h___
#include "prtypes.h"
#include "xpt_struct.h"
/*
* 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)
#ifdef _WIN32
#else
# define XPTI_EXPORT
#endif
#else
#ifdef _WIN32
#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)
// Even if this is a service, it is cool to provide a direct accessor
// Even if this is a service, it is cool to provide a direct accessor
XPTI_PUBLIC_API(void)
// Flyweight wrapper classes for xpt_struct.h structs.
// Everything here is dependent upon - and sensitive to changes in -
{
// NO DATA - this a flyweight wrapper
{} // random contents
{return flags;}
{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 IsInterfacePointer() const
{ switch (TagPart()) {
default:
return PR_FALSE;
case T_INTERFACE:
case T_INTERFACE_IS:
return PR_TRUE;
}
}
// '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;
}
}
enum
{
T_CHAR_STR = TD_PSTRING ,
T_CSTRING = TD_CSTRING ,
};
// NO DATA - this a flyweight wrapper
};
{
// NO DATA - this a flyweight wrapper
// NOTE: other activities on types are done via methods on nsIInterfaceInfo
nsXPTParamInfo(); // no implementation
// NO DATA - this a flyweight wrapper
};
{
// NO DATA - this a flyweight wrapper
/* idx was index before I got _sick_ of the warnings on Unix, sorry jband */
{
}
const nsXPTParamInfo GetResult() const
{return *result;}
nsXPTMethodInfo(); // no implementation
// NO DATA - this a flyweight wrapper
};
// forward declaration
struct nsXPTCMiniVariant;
{
// NO DATA - this a flyweight wrapper
const char* GetName() const
{return name;}
// 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.
const nsXPTCMiniVariant* GetValue() const
{return (nsXPTCMiniVariant*) &value;}
nsXPTConstant(); // no implementation
// NO DATA - this a flyweight wrapper
};
#endif /* xptiinfo_h___ */