This commit is contained in:
rods%netscape.com 1999-05-07 14:13:09 +00:00
Родитель cf5b021334
Коммит 4b0cb3efa1
3 изменённых файлов: 22 добавлений и 26 удалений

Просмотреть файл

@ -43,6 +43,8 @@
#define kGIFImageMime "image/gif"
#define kDropFilesMime "text/dropfiles"
class nsIDataFlavor;
class nsIDataFlavor : public nsISupports {
public:
@ -62,14 +64,22 @@ class nsIDataFlavor : public nsISupports {
*
* @param aMimeStr string to be set
*/
NS_IMETHOD GetMimeType(nsString & aMimeStr) = 0;
NS_IMETHOD GetMimeType(nsString & aMimeStr) const = 0;
/**
* Gets the Human readable version of the mime string
*
* @param aReadableStr string to be set
*/
NS_IMETHOD GetHumanPresentableName(nsString & aReadableStr) = 0;
NS_IMETHOD GetHumanPresentableName(nsString & aReadableStr) const = 0;
/**
* Check to see if aDataFlavor's Mime type is the same
*
* @param aDataFlavor flavor to check
* @returns NS_OK if the Mime Type string are identical otherwise, it returns NS_ERROR_FAILURE
*/
NS_IMETHOD Equals(const nsIDataFlavor * aDataFlavor) = 0;
};

Просмотреть файл

@ -86,7 +86,7 @@ NS_METHOD nsDataFlavor::Init(const nsString & aMimeType, const nsString & aHuman
*
*
*/
NS_METHOD nsDataFlavor::GetMimeType(nsString & aMimeStr)
NS_METHOD nsDataFlavor::GetMimeType(nsString & aMimeStr) const
{
aMimeStr = mMimeType;
return NS_OK;
@ -96,7 +96,7 @@ NS_METHOD nsDataFlavor::GetMimeType(nsString & aMimeStr)
*
*
*/
NS_METHOD nsDataFlavor::GetHumanPresentableName(nsString & aHumanPresentableName)
NS_METHOD nsDataFlavor::GetHumanPresentableName(nsString & aHumanPresentableName) const
{
aHumanPresentableName = mHumanPresentableName;
return NS_OK;
@ -106,17 +106,11 @@ NS_METHOD nsDataFlavor::GetHumanPresentableName(nsString & aHumanPresentableName
*
*
*/
NS_METHOD nsDataFlavor::GetNativeData(void ** aData)
NS_METHOD nsDataFlavor::Equals(const nsIDataFlavor * aDataFlavor)
{
return NS_OK;
}
/**
*
*
*/
NS_METHOD nsDataFlavor::SetNativeData(void * aData)
{
return NS_OK;
nsString mimeInQues;
aDataFlavor->GetMimeType(mimeInQues);
return (mMimeType.Equals(mimeInQues)?NS_OK:NS_ERROR_FAILURE);
}

Просмотреть файл

@ -41,22 +41,14 @@ public:
//nsIDataFlavor
NS_IMETHOD Init(const nsString & aMimeType,
const nsString & aHumanPresentableName);
NS_IMETHOD GetMimeType(nsString & aMimeStr);
NS_IMETHOD GetHumanPresentableName(nsString & aReadableStr);
NS_IMETHOD GetNativeData(void ** aData);
NS_IMETHOD SetNativeData(void * aData);
// Native Methods
PRUint32 GetFormat() { return mNativeClipboardFormat; }
NS_IMETHOD GetMimeType(nsString & aMimeStr) const;
NS_IMETHOD GetHumanPresentableName(nsString & aReadableStr) const;
NS_IMETHOD Equals(const nsIDataFlavor * aDataFlavor);
protected:
nsString mMimeType;
nsString mHumanPresentableName;
PRUint32 mNativeClipboardFormat;
};
#endif // nsDataFlavor_h__