Back to index

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

#include <nsMime.h>

List of all members.

Public Member Functions

 nsMimeStore ()
virtual ~nsMimeStore ()
virtual const char * format (int n=0) const
virtual QByteArray encodedData (const char *) const
PRBool AddFlavorData (const char *name, const QByteArray &data)
PRBool ContainsFlavor (const char *name)
PRUint32 count ()

Protected Member Functions

nsMimeStoreDataat (int n)

Protected Attributes

QPtrList< nsMimeStoreDatamMimeStore

Detailed Description

Definition at line 61 of file nsMime.h.

Constructor & Destructor Documentation

Definition at line 69 of file nsMime.cpp.


Definition at line 74 of file nsMime.cpp.


Member Function Documentation

PRBool nsMimeStore::AddFlavorData ( const char *  name,
const QByteArray &  data 

Definition at line 129 of file nsMime.cpp.

    if (ContainsFlavor(name))
        return PR_FALSE;
    mMimeStore.append(new nsMimeStoreData(name, data));

    // we're done unless we're given text/unicode,
    // and text/plain is not already advertised,
    if (strcmp(name, kUnicodeMime) || ContainsFlavor(kTextMime))
        return PR_TRUE;
    // in which case we also advertise text/plain
    // which we will convert on our own in nsDataObj::GetText().

    // let's text/plain be first for stupid programs
    // Ownership of |as| is transfered to mMimeStore
    mMimeStore.insert(0,new nsMimeStoreData(kTextMime,,data.count() + 1));
    return PR_TRUE;

Here is the call graph for this function:

Here is the caller graph for this function:

nsMimeStoreData* nsMimeStore::at ( int  n) [protected]

Definition at line 120 of file nsMime.cpp.

    for (nsMimeStoreData *msd = mMimeStore.first(); msd; msd = {
        if (!strcmp(name, msd->flavorName))
            return PR_TRUE;
    return PR_FALSE;

Here is the caller graph for this function:

Definition at line 79 of file nsMime.h.

{ return mMimeStore.count(); }

Here is the caller graph for this function:

QByteArray nsMimeStore::encodedData ( const char *  name) const [virtual]

Definition at line 91 of file nsMime.cpp.

    QByteArray qba;

    QString mime(name);

    /* XXX: for some reason in here we're getting mimetype
     * with charset, eg "text/plain;charset=UTF-8" so here
     * we remove the charset
    int n = mime.findRev(";");
    mime = mime.remove(n, mime.length() - n);

    // because of const
    nsMimeStoreData* msd;
    QPtrList<nsMimeStoreData>::const_iterator it = mMimeStore.begin();
    while ((msd = *it)) {
        if (mime.utf8() == msd->flavorName) {
            qba = msd->flavorData;
            return qba;
#ifdef NS_DEBUG
    printf("nsMimeStore::encodedData requested unknown %s\n", name);
    return qba;

Here is the caller graph for this function:

const char * nsMimeStore::format ( int  n = 0) const [virtual]

Definition at line 78 of file nsMime.cpp.

    if (n >= (int)mMimeStore.count())
        return 0;

    // because of const

    const nsMimeStoreData* msd;
    msd =;

    return msd->flavorName;

Here is the caller graph for this function:

Member Data Documentation

QPtrList<nsMimeStoreData> nsMimeStore::mMimeStore [mutable, protected]

Definition at line 75 of file nsMime.h.

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