Swapping support added to SizeNotifiable.

This commit is contained in:
King_DuckZ 2014-03-26 10:42:43 +01:00
parent 79fbf0faf7
commit 4d9190b0db
2 changed files with 30 additions and 1 deletions

View file

@ -3,6 +3,7 @@
#include "sdlmain.hpp"
#include <cassert>
#include <ciso646>
#include <algorithm>
namespace cloonel {
namespace implem {
@ -30,6 +31,16 @@ namespace cloonel {
assert(m_sdlmain);
m_sdlmain->UnregisterForResChange(m_id);
}
///----------------------------------------------------------------------
///----------------------------------------------------------------------
void AutoRegister::Swap (AutoRegister& parOther) noexcept {
std::swap(m_sdlmain, parOther.m_sdlmain);
std::swap(m_id, parOther.m_id);
#if !defined(NDEBUG)
std::swap(m_registered, parOther.m_registered);
#endif
}
} //namespace regbehaviuors
///--------------------------------------------------------------------------
@ -37,4 +48,11 @@ namespace cloonel {
void SizeNotifiableBase::NotifyResChanged (const SizeRatio& parSize) {
m_scaleRatio = parSize.Ratio();
}
///--------------------------------------------------------------------------
///--------------------------------------------------------------------------
void SizeNotifiableBase::swap (SizeNotifiableBase& parOther) noexcept {
std::swap(m_scaleRatio.x(), parOther.m_scaleRatio.x());
std::swap(m_scaleRatio.y(), parOther.m_scaleRatio.y());
}
} //namespace cloonel