Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# TQMacMime Class Reference

The TQMacMime class maps open-standard MIME to Mac flavors. More...

`#include <ntqmime.h>`

List of all member functions.

## Public Members

- TQMacMime ( char t )
- virtual ~TQMacMime ()
- virtual const char * convertorName () = 0
- virtual int countFlavors () = 0
- virtual int flavor ( int index ) = 0
- virtual bool canConvert ( const char * mime, int flav ) = 0
- virtual const char * mimeFor ( int flav ) = 0
- virtual int flavorFor ( const char * mime ) = 0
- virtual TQByteArray convertToMime ( TQValueList<TQByteArray> data, const char * mime, int flav ) = 0
- virtual TQValueList<TQByteArray> convertFromMime ( TQByteArray data, const char * mime, int flav ) = 0

## Static Public Members

- TQPtrList<TQMacMime> all ( TQMacMimeType t )
- TQMacMime * convertor ( TQMacMimeType t, const char * mime, int flav )
- const char * flavorToMime ( TQMacMimeType t, int flav )

## Detailed Description

The TQMacMime class maps open-standard MIME to Mac flavors.

TQt's drag-and-drop and clipboard facilities use the MIME standard. On X11, this maps trivially to the Xdnd protocol, but on Mac although some applications use MIME types to describe clipboard formats, others use arbitrary non-standardized naming conventions, or unnamed built-in Mac formats.

By instantiating subclasses of TQMacMime that provide conversions between Mac flavors and MIME formats, you can convert proprietary clipboard formats to MIME formats.

TQt has predefined support for the following Mac flavors:

- kScrapFlavorTypeUnicode - converted to "text/plain;charset=ISO-10646-UCS-2" and supported by TQTextDrag.
- kScrapFlavorTypeText - converted to "text/plain;charset=system" or "text/plain" and supported by TQTextDrag.
- kScrapFlavorTypePicture - converted to "image/format", where format is a TQt image format, and supported by TQImageDrag.
- kDragFlavorTypeHFS - converted to "text/uri-list", and supported by TQUriDrag.

You can check if a MIME type is convertible using canConvert() and can perform conversions with convertToMime() and convertFromMime().

See also Drag And Drop Classes, Input/Output and Networking, and Miscellaneous Classes.

## Member Function Documentation

### TQMacMime::TQMacMime ( char t )

Constructs a new conversion object of type t, adding it to the globally accessed list of available convertors.

### TQMacMime::~TQMacMime ()`[virtual]`

Destroys a conversion object, removing it from the global list of available convertors.

### TQPtrList<TQMacMime> TQMacMime::all ( TQMacMimeType t )`[static]`

Returns a list of all currently defined TQMacMime objects of type t.

### bool TQMacMime::canConvert ( const char * mime, int flav )`[pure virtual]`

Returns TRUE if the convertor can convert (both ways) between mime and flav; otherwise returns FALSE.

All subclasses must reimplement this pure virtual function.

### TQValueList<TQByteArray> TQMacMime::convertFromMime ( TQByteArray data, const char * mime, int flav )`[pure virtual]`

Returns data converted from MIME type mime to Mac flavor flav.

Note that Mac flavors must all be self-terminating. The return value may contain trailing data.

All subclasses must reimplement this pure virtual function.

### TQByteArray TQMacMime::convertToMime ( TQValueList<TQByteArray> data, const char * mime, int flav )`[pure virtual]`

Returns data converted from Mac flavor flav to MIME type mime.

Note that Mac flavors must all be self-terminating. The input data may contain trailing data.

All subclasses must reimplement this pure virtual function.

### TQMacMime * TQMacMime::convertor ( TQMacMimeType t, const char * mime, int flav )`[static]`

Returns the most-recently created TQMacMime of type t that can convert between the mime and flav formats. Returns 0 if no such convertor exists.

### const char * TQMacMime::convertorName ()`[pure virtual]`

Returns a name for the convertor.

All subclasses must reimplement this pure virtual function.

### int TQMacMime::countFlavors ()`[pure virtual]`

Returns the number of Mac flavors supported by this convertor.

All subclasses must reimplement this pure virtual function.

### int TQMacMime::flavor ( int index )`[pure virtual]`

Returns the Mac flavor supported by this convertor that is ordinarily at position index. This means that flavor(0) returns the first Mac flavor supported, and flavor(countFlavors()-1) returns the last. If index is out of range the return value is undefined.

All subclasses must reimplement this pure virtual function.

### int TQMacMime::flavorFor ( const char * mime )`[pure virtual]`

Returns the Mac flavor used for MIME type mime, or 0 if this convertor does not support mime.

All subclasses must reimplement this pure virtual function.

### const char * TQMacMime::flavorToMime ( TQMacMimeType t, int flav )`[static]`

Returns a MIME type of type t for flav, or 0 if none exists.

### const char * TQMacMime::mimeFor ( int flav )`[pure virtual]`

Returns the MIME type used for Mac flavor flav, or 0 if this convertor does not support flav.

All subclasses must reimplement this pure virtual function.

This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.