~ubuntu-branches/ubuntu/oneiric/psi/oneiric

« back to all changes in this revision

Viewing changes to src/sxe/sxerecord.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2009-09-25 17:49:51 UTC
  • mfrom: (6.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090925174951-lvm7kdap82o8xhn3
Tags: 0.13-1
* Updated to upstream version 0.13
* Set Standards-Version to 3.8.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
class SxeRecord : public QObject {
30
30
    Q_OBJECT
31
31
 
32
 
    /*! \brief A class used for keeping track of the values at each version.
33
 
     *      Note that this info could be retrieved by analyzing the Edits but would be more troublesome
34
 
     */
35
 
    class VersionData {
36
 
    public:
37
 
        /*! \brief Default constructor */
38
 
        VersionData(QString _parent = QString(), /*QString _ns = QString(),*/ QString _identifier = QString(), QString _data = QString());
39
 
        /*! \brief Copy constructor */
40
 
        VersionData(const VersionData &other);
41
 
        
42
 
        int version;
43
 
        QString parent;
44
 
        double primaryWeight;
45
 
        // QString ns;
46
 
        QString identifier;
47
 
        QString data;
48
 
    };
49
 
 
50
32
    public:
51
33
        /*! \brief Constructor
52
34
         *  Constructs a SxeRecordEdit for \a node.
58
40
        /*! \brief Returns the node that the record underlies. */
59
41
        QDomNode node() const;
60
42
        /*! \brief Applies \a edit to the node. Takes ownership of \a edit. */
61
 
        void apply(QDomDocument &doc, SxeEdit* edit, bool importing);
 
43
        void apply(QDomDocument &doc, SxeEdit* edit);
62
44
        /*! \brief Returns a list of edits to the node.*/
63
45
        QList<const SxeEdit*> edits() const;
64
46
        /*! \brief Returns the rid of the node that the record belongs to. */
118
100
 
119
101
    private:
120
102
        
121
 
        /*! \brief Applies SxeNewEdit \a edit to the node.*/
122
 
        bool applySxeNewEdit(QDomDocument &doc, const SxeNewEdit* edit);
123
 
        /*! \brief Applies SxeRemoveEdit \a edit to the node.*/
124
 
        bool applySxeRemoveEdit(const SxeRemoveEdit* edit);
125
 
        /*! \brief Applies SxeRecordEdit \a edit to the node.*/
126
 
        bool applySxeRecordEdit(const SxeRecordEdit* edit, bool importing = false);
127
 
        
 
103
        /*! \brief Applies SxeNewEdit \a edit to the record.*/
 
104
        bool applySxeNewEdit(QDomDocument &doc, SxeNewEdit* edit);
 
105
        /*! \brief Applies SxeRemoveEdit \a edit to the record.*/
 
106
        bool applySxeRemoveEdit(SxeRemoveEdit* edit);
 
107
        /*! \brief Applies SxeRecordEdit \a edit to the record.*/
 
108
        bool applySxeRecordEdit(SxeRecordEdit* edit);
 
109
 
 
110
        /*! \brief Applies an individual SxeRecordEdit assuming it can be applied to the current version.*/
 
111
        void processInOrderRecordEdit(const SxeRecordEdit* edit);
 
112
        /*! \brief Reorder the edits_ list and reapply edits as necessary. */
 
113
        void reorderEdits();
 
114
        /*! \brief Revert the record to version 0. */
 
115
        void revertToZero();
 
116
 
 
117
        /*! \brief Synchronize the state of the DOM node with the fields of the record. */
 
118
        void updateNode(bool remote);
 
119
 
128
120
        QList<SxeEdit*> edits_;
129
 
        QList<VersionData*> versions_;
 
121
 
130
122
        QDomNode node_;
 
123
 
131
124
        QString rid_;
132
125
        int version_;
 
126
        
 
127
        /* The last* variants hold the values that were last put to the DOM node.*/
 
128
        QString parent_, lastParent_;
 
129
        double primaryWeight_, lastPrimaryWeight_;
 
130
        QString identifier_, lastIdentifier_;
 
131
        QString data_, lastData_;
133
132
};
134
133
 
135
134
#endif