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

« back to all changes in this revision

Viewing changes to src/sxe/sxeedit.cpp

  • 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:
42
42
    return rid_;
43
43
};
44
44
 
45
 
 
46
 
bool SxeEdit::overrides(const SxeEdit &e) const {
47
 
    if(e.rid() != rid()) {
 
45
bool SxeEdit::isNull() {
 
46
    return null_;
 
47
}
 
48
 
 
49
void SxeEdit::nullify() {
 
50
    null_ = true;
 
51
}
 
52
 
 
53
 
 
54
bool SxeEdit::overridenBy(const SxeEdit &e) const {
 
55
    if(e.rid() == rid()) {
48
56
        if(e.type() == SxeEdit::Remove)
49
57
            return true;
50
58
        else if(type() == SxeEdit::Record && e.type() == SxeEdit::Record) {
56
64
 
57
65
    return false;
58
66
}
 
67
 
 
68
bool SxeEdit::operator<(const SxeEdit &other) const {
 
69
 
 
70
    // Can't compare edits to different records
 
71
    if(rid() != other.rid())  {
 
72
        qDebug() << QString("Comparing SxeEdits to %1 an %2.").arg(rid()).arg(other.rid()).toAscii();
 
73
        return false;
 
74
    }
 
75
 
 
76
    if(type() == other.type()) {
 
77
 
 
78
        // Only Record edits can be unequal with other edits of the same type
 
79
        if(type() == SxeEdit::Record) {
 
80
            const SxeRecordEdit* thisp = dynamic_cast<const SxeRecordEdit*>(this);
 
81
            const SxeRecordEdit* otherp = dynamic_cast<const SxeRecordEdit*>(&other);
 
82
            return (thisp->version() < otherp->version());
 
83
        }
 
84
 
 
85
        return false;
 
86
 
 
87
    } else {
 
88
 
 
89
        // New < Record, Record < Remove
 
90
        if(type() == SxeEdit::New)           return true;
 
91
        if(other.type() == SxeEdit::Remove)  return true;
 
92
        
 
93
        return false;
 
94
 
 
95
    }
 
96
}