Changeset View
Changeset View
Standalone View
Standalone View
sheets/Condition.cpp
Show First 20 Lines • Show All 375 Lines • ▼ Show 20 Line(s) | |||||
376 | 376 | | |||
377 | void Conditions::operator=(const Conditions & other) | 377 | void Conditions::operator=(const Conditions & other) | ||
378 | { | 378 | { | ||
379 | d = other.d; | 379 | d = other.d; | ||
380 | } | 380 | } | ||
381 | 381 | | |||
382 | bool Conditions::operator==(const Conditions& other) const | 382 | bool Conditions::operator==(const Conditions& other) const | ||
383 | { | 383 | { | ||
384 | if (d->defaultStyle != other.d->defaultStyle) | ||||
385 | return false; | ||||
384 | if (d->conditionList.count() != other.d->conditionList.count()) | 386 | if (d->conditionList.count() != other.d->conditionList.count()) | ||
385 | return false; | 387 | return false; | ||
386 | QLinkedList<Conditional>::ConstIterator end(d->conditionList.end()); | 388 | QLinkedList<Conditional>::ConstIterator end(d->conditionList.end()); | ||
387 | for (QLinkedList<Conditional>::ConstIterator it(d->conditionList.begin()); it != end; ++it) { | 389 | for (QLinkedList<Conditional>::ConstIterator it(d->conditionList.begin()); it != end; ++it) { | ||
388 | bool found = false; | 390 | bool found = false; | ||
389 | QLinkedList<Conditional>::ConstIterator otherEnd(other.d->conditionList.end()); | 391 | QLinkedList<Conditional>::ConstIterator otherEnd(other.d->conditionList.end()); | ||
390 | for (QLinkedList<Conditional>::ConstIterator otherIt(other.d->conditionList.begin()); otherIt != otherEnd; ++otherIt) { | 392 | for (QLinkedList<Conditional>::ConstIterator otherIt(other.d->conditionList.begin()); otherIt != otherEnd; ++otherIt) { | ||
391 | if ((*it) == (*otherIt)) | 393 | if ((*it) == (*otherIt)) | ||
392 | found = true; | 394 | found = true; | ||
393 | } | 395 | } | ||
394 | if (!found) | 396 | if (!found) | ||
395 | return false; | 397 | return false; | ||
396 | } | 398 | } | ||
397 | return true; | 399 | return true; | ||
398 | } | 400 | } | ||
399 | 401 | | |||
400 | uint Calligra::Sheets::qHash(const Conditions &c) | 402 | uint Calligra::Sheets::qHash(const Conditions &c) | ||
401 | { | 403 | { | ||
402 | uint res = 0; | 404 | uint res = qHash(c.defaultStyle()); | ||
403 | foreach (const Conditional& co, c.conditionList()) { | 405 | foreach (const Conditional& co, c.conditionList()) { | ||
404 | res ^= qHash(co); | 406 | res ^= qHash(co); | ||
405 | } | 407 | } | ||
406 | return res; | 408 | return res; | ||
407 | } | 409 | } | ||
408 | 410 | | |||
409 | uint Calligra::Sheets::qHash(const Conditional& c) | 411 | uint Calligra::Sheets::qHash(const Conditional& c) | ||
410 | { | 412 | { | ||
411 | return qHash(c.value1); | 413 | return qHash(c.value1); | ||
412 | } | 414 | } |