~ubuntu-branches/ubuntu/karmic/psi/karmic

« back to all changes in this revision

Viewing changes to src/tools/optionstree/varianttree.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2008-08-28 18:46:52 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080828184652-iiik12dl91nq7cdi
Tags: 0.12-2
Uploading to unstable (Closes: Bug#494352)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#ifndef _VARIANTTREE_H_
22
22
#define _VARIANTTREE_H_
23
23
 
24
 
#include <QtCore>
 
24
#include <QObject>
25
25
#include <QVariant>
26
26
#include <QMap>
27
27
 
28
28
class QDomDocument;
29
29
class QDomElement;
 
30
class QDomDocumentFragment;
 
31
 
30
32
 
31
33
/**
32
34
 * \class VariantTree
53
55
        ~VariantTree();
54
56
 
55
57
        void setValue(QString node, QVariant value);
56
 
        QVariant getValue(QString node);
 
58
        QVariant getValue(QString node) const;
 
59
        
 
60
        bool isInternalNode(QString node) const;
57
61
 
58
62
        void setComment(QString node, QString comment);
59
 
        QString getComment(QString node);
 
63
        QString getComment(QString node) const;
60
64
 
 
65
        bool remove(const QString &node, bool internal_nodes = false);
 
66
        
61
67
        QStringList nodeChildren(const QString& node = "", bool direct = false, bool internal_nodes = false) const; 
62
68
 
63
69
        void toXml(QDomDocument &doc, QDomElement& ele) const;
64
70
        void fromXml(const QDomElement &ele);
65
71
 
 
72
        static bool isValidNodeName(const QString &name);
 
73
        
66
74
        static const QVariant missingValue;
67
75
        static const QString missingComment;
68
76
 
69
77
protected:
70
78
        static QVariant elementToVariant(const QDomElement&);
71
79
        static void variantToElement(const QVariant&, QDomElement&);
 
80
        
 
81
        static bool getKeyRest(QString node, QString &key, QString &rest);
72
82
 
73
83
private:
74
84
        QMap<QString, VariantTree*> trees_;
75
85
        QMap<QString, QVariant> values_;
76
86
        QMap<QString, QString> comments_;
 
87
        QMap<QString, QDomDocumentFragment> unknowns_;          // unknown types preservation
 
88
        
 
89
        // needed to have a document for the fragments.
 
90
        static QDomDocument *unknownsDoc;
77
91
        
78
92
}; 
79
93