Contents
QVersitDefaultResourceHandler Class Reference
The QVersitDefaultResourceHandler class provides a default implementation of a Versit resource handler. More...
#include <QVersitDefaultResourceHandler>
Inherits QVersitResourceHandler.
Public Functions
QVersitDefaultResourceHandler () | |
virtual | ~QVersitDefaultResourceHandler () |
Reimplemented Public Functions
virtual bool | loadResource ( const QString & location, QByteArray * contents, QString * mimeType ) |
virtual bool | saveResource ( const QByteArray & contents, const QVersitProperty & property, QString * location ) |
- 2 public functions inherited from QVersitResourceHandler
Detailed Description
The QVersitDefaultResourceHandler class provides a default implementation of a Versit resource handler.
An example resource handler implementation:
class MyResourceHandler : public QVersitDefaultResourceHandler {
public:
bool saveResource(const QByteArray& contents, const QVersitProperty& property,
QString* location) {
Q_UNUSED(property)
*location = QString::number(qrand());
QFile file(*location);
file.open(QIODevice::WriteOnly);
file.write(contents); // In a real implementation, consider when this file will be deleted.
return true;
}
bool loadResource(const QString& location, QByteArray* contents, QString* mimeType)
{
return QVersitDefaultResourceHandler::loadResource(location, contents, mimeType);
}
};