Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
nsTransferable Class Reference

XP Transferable wrapper. More...

#include <nsTransferable.h>

Inheritance diagram for nsTransferable:
Inheritance graph
[legend]
Collaboration diagram for nsTransferable:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsTransferable ()
virtual ~nsTransferable ()
nsISupportsArray flavorsTransferableCanExport ()
 Computes a list of flavors (mime types as nsISupportsCString) that the transferable can export, either through intrinsic knowledge or output data converters.
void getTransferData (in string aFlavor, out nsISupports aData, out unsigned long aDataLen)
 Given a flavor retrieve the data.
void getAnyTransferData (out string aFlavor, out nsISupports aData, out unsigned long aDataLen)
 Returns the best flavor in the transferable, given those that have been added to it with |AddFlavor()|.
boolean isLargeDataSet ()
 Returns true if the data is large.
nsISupportsArray flavorsTransferableCanImport ()
 Computes a list of flavors (mime types as nsISupportsCString) that the transferable can accept into it, either through intrinsic knowledge or input data converters.
void setTransferData (in string aFlavor, in nsISupports aData, in unsigned long aDataLen)
 Sets the data in the transferable with the specified flavor.
void addDataFlavor (in string aDataFlavor)
 Add the data flavor, indicating that this transferable can receive this type of flavor.
void removeDataFlavor (in string aDataFlavor)
 Removes the data flavor matching the given one (string compare) and the data that goes along with it.

Public Attributes

const long kFlavorHasDataProvider = 0
attribute nsIFormatConverter converter

Protected Member Functions

nsresult GetTransferDataFlavors (nsISupportsArray **aDataFlavorList)

Protected Attributes

nsVoidArraymDataArray
nsCOMPtr< nsIFormatConvertermFormatConv

Detailed Description

XP Transferable wrapper.

Definition at line 56 of file nsTransferable.h.


Constructor & Destructor Documentation

Definition at line 296 of file nsTransferable.cpp.

{
  mDataArray = new nsVoidArray();
}

Here is the call graph for this function:

Definition at line 306 of file nsTransferable.cpp.

{
  for (PRInt32 i=0;i<mDataArray->Count();i++) {
    DataStruct * data = (DataStruct *)mDataArray->ElementAt(i);
    delete data;
  }
  delete mDataArray;
}

Member Function Documentation

void nsITransferable::addDataFlavor ( in string  aDataFlavor) [inherited]

Add the data flavor, indicating that this transferable can receive this type of flavor.

Parameters:
aDataFlavora new data flavor to handle

Computes a list of flavors (mime types as nsISupportsCString) that the transferable can export, either through intrinsic knowledge or output data converters.

Parameters:
aDataFlavorListfills list with supported flavors. This is a copy of the internal list, so it may be edited w/out affecting the transferable.

Computes a list of flavors (mime types as nsISupportsCString) that the transferable can accept into it, either through intrinsic knowledge or input data converters.

Parameters:
outFlavorListfills list with supported flavors. This is a copy of the internal list, so it may be edited w/out affecting the transferable.
void nsITransferable::getAnyTransferData ( out string  aFlavor,
out nsISupports  aData,
out unsigned long  aDataLen 
) [inherited]

Returns the best flavor in the transferable, given those that have been added to it with |AddFlavor()|.

Parameters:
aFlavor(out parameter) the flavor of data that was retrieved
aDatathe data. Some variant of class in nsISupportsPrimitives.idl
aDataLenthe length of the data
void nsITransferable::getTransferData ( in string  aFlavor,
out nsISupports  aData,
out unsigned long  aDataLen 
) [inherited]

Given a flavor retrieve the data.

Parameters:
aFlavor(in parameter) the flavor of data to retrieve
aDatathe data. Some variant of class in nsISupportsPrimitives.idl
aDataLenthe length of the data

Definition at line 324 of file nsTransferable.cpp.

{
  nsresult rv = NS_NewISupportsArray ( aDataFlavorList );
  if (NS_FAILED(rv)) return rv;

  for ( PRInt32 i=0; i<mDataArray->Count(); ++i ) {
    DataStruct * data = (DataStruct *)mDataArray->ElementAt(i);
    nsCOMPtr<nsISupportsCString> flavorWrapper = do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID);
    if ( flavorWrapper ) {
      flavorWrapper->SetData ( data->GetFlavor() );
      nsCOMPtr<nsISupports> genericWrapper ( do_QueryInterface(flavorWrapper) );
      (*aDataFlavorList)->AppendElement( genericWrapper );
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

Returns true if the data is large.

void nsITransferable::removeDataFlavor ( in string  aDataFlavor) [inherited]

Removes the data flavor matching the given one (string compare) and the data that goes along with it.

Parameters:
aDataFlavora data flavor to remove
void nsITransferable::setTransferData ( in string  aFlavor,
in nsISupports  aData,
in unsigned long  aDataLen 
) [inherited]

Sets the data in the transferable with the specified flavor.

The transferable will maintain its own copy the data, so it is not necessary to do that beforehand.

Parameters:
aFlavorthe flavor of data that is being set
aDatathe data, some variant of class in nsISupportsPrimitives.idl, or an nsIFlavorDataProvider (see above)
aDataLenthe length of the data, or 0 if passing a nsIFlavorDataProvider

Member Data Documentation

Definition at line 186 of file nsITransferable.idl.

Definition at line 110 of file nsITransferable.idl.

Definition at line 72 of file nsTransferable.h.

Definition at line 73 of file nsTransferable.h.


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