Back to index

lightning-sunbird  0.9+nobinonly
Static Public Member Functions
TypeInfo Class Reference

List of all members.

Static Public Member Functions

static nsresult GetParentInfo (nsIInterfaceInfo *aIInfo, nsIInterfaceInfo **aParentInfo, PRUint16 *aParentMethodCount, PRUint16 *aParentConstCount)
static nsresult GetInterfaceName (nsIInterfaceInfo *aIInfo, PRUint16 aMethodIndex, const nsXPTParamInfo *aParamInfo, char **aResult)

Detailed Description

Definition at line 59 of file GenerateJavaInterfaces.cpp.


Member Function Documentation

static nsresult TypeInfo::GetInterfaceName ( nsIInterfaceInfo aIInfo,
PRUint16  aMethodIndex,
const nsXPTParamInfo aParamInfo,
char **  aResult 
) [inline, static]

Definition at line 88 of file GenerateJavaInterfaces.cpp.

  {
    static const char isupp_str[] = "nsISupports";

    nsIID* iid;
    nsresult rv = aIInfo->GetIIDForParam(aMethodIndex, aParamInfo, &iid);
    if (NS_FAILED(rv)) {
      // GetIIDForParam will sometimes fail to find an interface, particularly
      // if that interface is not defined in an IDL file.  In those cases, just
      // return |nsISupports|.
      //
      // For example, the |onStreamComplete| method for the interface
      // |nsIUnicharStreamLoaderObserver| takes a param of
      // |nsIUnicharInputStream|, which is defined in a simple header file, not
      // an IDL file.
      *aResult = (char*) nsMemory::Clone(isupp_str, sizeof(isupp_str));
      rv = (*aResult == nsnull) ? NS_ERROR_OUT_OF_MEMORY : NS_OK;

    } else {

      // In JavaXPCOM, we handle weak references internally; no need for the
      // |nsIWeakReference| interface.  So just return |nsISupports|.
      if (iid->Equals(NS_GET_IID(nsIWeakReference))) {
        *aResult = (char*) nsMemory::Clone(isupp_str, sizeof(isupp_str));
        rv = (*aResult == nsnull) ? NS_ERROR_OUT_OF_MEMORY : NS_OK;

      } else {

        // Some methods take parameters of non-scriptable interfaces.  But we
        // only output scriptable interfaces.  So if one of the param types is
        // a non-scriptable interface, output |nsISupports| instead of the
        // interface name.
        nsCOMPtr<nsIInterfaceInfo> info;
        nsCOMPtr<nsIInterfaceInfoManager> iim = XPTI_GetInterfaceInfoManager();
        NS_ASSERTION(iim, "could not get interface info manager");
        rv = iim->GetInfoForIID(iid, getter_AddRefs(info));
        NS_ENSURE_SUCCESS(rv, rv);
        PRBool scriptable;
        if (NS_SUCCEEDED(rv)) {
          info->IsScriptable(&scriptable);
        }
        if (NS_FAILED(rv) || !scriptable) {
          *aResult = (char*) nsMemory::Clone(isupp_str, sizeof(isupp_str));
          rv = (*aResult == nsnull) ? NS_ERROR_OUT_OF_MEMORY : NS_OK;
        } else {

          // If is scriptable, get name for given IID
          rv = iim->GetNameForIID(iid, aResult);
        }
      }

      nsMemory::Free(iid);
    }

    return rv;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

static nsresult TypeInfo::GetParentInfo ( nsIInterfaceInfo aIInfo,
nsIInterfaceInfo **  aParentInfo,
PRUint16 aParentMethodCount,
PRUint16 aParentConstCount 
) [inline, static]

Definition at line 62 of file GenerateJavaInterfaces.cpp.

  {
    nsCOMPtr<nsIInterfaceInfo> parent;
    nsresult rv = aIInfo->GetParent(getter_AddRefs(parent));
    NS_ENSURE_SUCCESS(rv, rv);

    if (!parent) {
      *aParentInfo = nsnull;
      *aParentMethodCount = 0;
      *aParentConstCount = 0;
      return NS_OK;
    }

    rv = parent->GetMethodCount(aParentMethodCount);
    NS_ENSURE_SUCCESS(rv, rv);
    rv = parent->GetConstantCount(aParentConstCount);
    NS_ENSURE_SUCCESS(rv, rv);

    *aParentInfo = parent;
    NS_ADDREF(*aParentInfo);
    return rv;
  }

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: