Commit 325cb153 authored by Cyrille Berger's avatar Cyrille Berger

add a function to KoRessource for serializing informations about ressources

svn path=/trunk/koffice/; revision=689426
parent c78c4529
......@@ -18,44 +18,59 @@
*/
#include "KoResource.h"
KoResource::KoResource(const QString& filename)
#include <QDomElement>
struct KoResource::Private {
QString name;
QString filename;
bool valid;
};
KoResource::KoResource(const QString& filename) : d(new Private)
{
m_filename = filename;
m_valid = false;
d->filename = filename;
d->valid = false;
}
KoResource::~KoResource()
{
delete d;
}
QString KoResource::filename() const
{
return m_filename;
return d->filename;
}
void KoResource::setFilename(const QString& filename)
{
m_filename = filename;
d->filename = filename;
}
QString KoResource::name() const
{
return m_name;
return d->name;
}
void KoResource::setName(const QString& name)
{
m_name = name;
d->name = name;
}
bool KoResource::valid() const
{
return m_valid;
return d->valid;
}
void KoResource::setValid(bool valid)
{
m_valid = valid;
d->valid = valid;
}
void KoResource::toXML(QDomDocument& , QDomElement& e)
{
e.setAttribute("name", name());
e.setAttribute("filename", filename());
}
#include "KoResource.moc"
......
......@@ -24,6 +24,9 @@
#include <QString>
#include <koresource_export.h>
class QDomDocument;
class QDomElement;
/**
* The KoResource class provides a representation of Krita image resources. This
* includes, but not limited to, brushes and patterns.
......@@ -62,6 +65,8 @@ public:
*/
virtual QImage img() {return QImage(); }
virtual void toXML(QDomDocument& , QDomElement&);
public:
QString filename() const;
void setFilename(const QString& filename);
......@@ -75,9 +80,8 @@ private:
KoResource& operator=(const KoResource&);
private:
QString m_name;
QString m_filename;
bool m_valid;
struct Private;
Private* const d;
};
#endif // KORESOURCE_H_
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment