equal
deleted
inserted
replaced
43 #include "qversitdocument_p.h" |
43 #include "qversitdocument_p.h" |
44 #include "qmobilityglobal.h" |
44 #include "qmobilityglobal.h" |
45 |
45 |
46 #include <QTextCodec> |
46 #include <QTextCodec> |
47 |
47 |
48 QTM_USE_NAMESPACE |
48 QTM_BEGIN_NAMESPACE |
49 |
49 |
50 /*! |
50 /*! |
51 \class QVersitDocument |
51 \class QVersitDocument |
52 \preliminary |
52 \preliminary |
53 \brief The QVersitDocument class is a container for a list of versit properties. |
53 \brief The QVersitDocument class is a container for a list of versit properties. |
73 /*! Constructs a new empty document */ |
73 /*! Constructs a new empty document */ |
74 QVersitDocument::QVersitDocument() : d(new QVersitDocumentPrivate()) |
74 QVersitDocument::QVersitDocument() : d(new QVersitDocumentPrivate()) |
75 { |
75 { |
76 } |
76 } |
77 |
77 |
|
78 /*! Constructs a new empty document with the type set to \a type */ |
|
79 QVersitDocument::QVersitDocument(VersitType type) : d(new QVersitDocumentPrivate()) |
|
80 { |
|
81 d->mVersitType = type; |
|
82 } |
|
83 |
|
84 |
78 /*! Constructs a document that is a copy of \a other */ |
85 /*! Constructs a document that is a copy of \a other */ |
79 QVersitDocument::QVersitDocument(const QVersitDocument& other) : d(other.d) |
86 QVersitDocument::QVersitDocument(const QVersitDocument& other) : d(other.d) |
80 { |
87 { |
81 } |
88 } |
82 |
89 |
103 /*! Returns true if this is not equal to \a other; false otherwise. */ |
110 /*! Returns true if this is not equal to \a other; false otherwise. */ |
104 bool QVersitDocument::operator!=(const QVersitDocument& other) const |
111 bool QVersitDocument::operator!=(const QVersitDocument& other) const |
105 { |
112 { |
106 return !(*this == other); |
113 return !(*this == other); |
107 } |
114 } |
|
115 |
|
116 /*! Returns the hash value for \a key. */ |
|
117 uint qHash(const QVersitDocument &key) |
|
118 { |
|
119 int hash = QT_PREPEND_NAMESPACE(qHash)(key.type()); |
|
120 foreach (const QVersitProperty& property, key.properties()) { |
|
121 hash += qHash(property); |
|
122 } |
|
123 return hash; |
|
124 } |
|
125 |
|
126 #ifndef QT_NO_DEBUG_STREAM |
|
127 QDebug operator<<(QDebug dbg, const QVersitDocument& document) |
|
128 { |
|
129 dbg.nospace() << "QVersitDocument(" << document.type() << ')'; |
|
130 foreach (const QVersitProperty& property, document.properties()) { |
|
131 dbg.space() << '\n' << property; |
|
132 } |
|
133 return dbg.maybeSpace(); |
|
134 } |
|
135 #endif |
108 |
136 |
109 /*! |
137 /*! |
110 * Sets the versit document type to \a type. |
138 * Sets the versit document type to \a type. |
111 */ |
139 */ |
112 void QVersitDocument::setType(VersitType type) |
140 void QVersitDocument::setType(VersitType type) |
175 */ |
203 */ |
176 bool QVersitDocument::isEmpty() const |
204 bool QVersitDocument::isEmpty() const |
177 { |
205 { |
178 return d->mProperties.count() == 0 && d->mVersitType == QVersitDocument::InvalidType; |
206 return d->mProperties.count() == 0 && d->mVersitType == QVersitDocument::InvalidType; |
179 } |
207 } |
|
208 |
|
209 QTM_END_NAMESPACE |