| 479 | } |
| 480 | |
| 481 | bool ScheduleRuleset_Impl::setCustomDay2Schedule(const ScheduleDay& schedule) { |
| 482 | if (OptionalScheduleTypeLimits candidateLimits = schedule.scheduleTypeLimits()) { |
| 483 | if (OptionalScheduleTypeLimits parentLimits = scheduleTypeLimits()) { |
| 484 | if (!isCompatible(*parentLimits, *candidateLimits)) { |
| 485 | return false; |
| 486 | } |
| 487 | } else { |
| 488 | return false; |
| 489 | } |
| 490 | } |
| 491 | |
| 492 | boost::optional<ScheduleDay> existingCustomD2Schedule; |
| 493 | if (!this->isCustomDay2ScheduleDefaulted()) { |
| 494 | ScheduleDay existingCustomD2Schedule = this->customDay2Schedule(); |
| 495 | } |
| 496 | ModelObject clone = schedule.clone(); |
| 497 | bool result = setPointer(OS_Schedule_RulesetFields::CustomDay2ScheduleName, clone.handle()); |
| 498 | OS_ASSERT(result); |
| 499 | if (OptionalScheduleTypeLimits limits = scheduleTypeLimits()) { |
| 500 | result = customDay2Schedule().setScheduleTypeLimits(*limits); |
| 501 | OS_ASSERT(result); |
| 502 | } |
| 503 | if (existingCustomD2Schedule) { |
| 504 | existingCustomD2Schedule->remove(); |
| 505 | } |
| 506 | return result; |
| 507 | } |
| 508 | |
| 509 | void ScheduleRuleset_Impl::resetCustomDay2Schedule() { |
| 510 | boost::optional<ScheduleDay> existingCustomD2Schedule; |
nothing calls this directly
no test coverage detected