kdeui Library API Documentation

KMimeTypeValidator Class Reference

This validator allows you to validate mimetype names (e.g. A QValidator for mime types. More...

#include <kstringvalidator.h>

Inheritance diagram for KMimeTypeValidator:

QValidator List of all members.

Public Member Functions

 KMimeTypeValidator (QObject *parent, const char *name=0)
virtual State validate (QString &input, int &pos) const
 Checks for well-formed mimetype.

virtual void fixup (QString &input) const
 Removes all characters that are forbidden in mimetypes.


Detailed Description

This validator allows you to validate mimetype names (e.g. A QValidator for mime types.

text/plain, image/jpeg). Note that the validation is only syntactically. It will e.g. not reject "foo/bar", although that particular mime type isn't yet registered. It suffices for the name to adhere to the production

mime-type := token "/" token ; 'token' is defined in rfc2045

The fixup will simply remove all non-token characters.

Author:
Marc Mutz <mutz@kde.org>

Definition at line 112 of file kstringvalidator.h.


Member Function Documentation

QValidator::State KMimeTypeValidator::validate QString input,
int &  pos
const [virtual]
 

Checks for well-formed mimetype.

Returns

  • Acceptable iff input ~= /^[:allowed chars:]+\/[:allowed chars:]+$/
  • Intermediate iff input ~= /^[:allowed chars:]*\/?[:allowed chars:]*$/
  • Invalid else

Reimplemented from QValidator.

Definition at line 66 of file kstringvalidator.cpp.

References QRegExp::exactMatch(), and QString::isEmpty().

void KMimeTypeValidator::fixup QString input  )  const [virtual]
 

Removes all characters that are forbidden in mimetypes.

Reimplemented from QValidator.

Definition at line 84 of file kstringvalidator.cpp.

References QString::replace().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 27 22:15:09 2005 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001