/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Internal
{
-
namespace Adaptor
{
-
// LOCAL STUFF
namespace
{
-bool TimerSourceFunc (void *data)
+bool TimerSourceFunc(void* data)
{
Timer* timer = static_cast<Timer*>(data);
return timer->Tick();
}
-}
+} // namespace
/**
* Struct to hide away Windows implementation details
*/
struct Timer::Impl
{
- Impl( unsigned int milliSec ) :
- mId(-1),
+ Impl(unsigned int milliSec)
+ : mId(-1),
mInterval(milliSec)
{
}
unsigned int mInterval;
};
-TimerPtr Timer::New( unsigned int milliSec )
+TimerPtr Timer::New(unsigned int milliSec)
{
- TimerPtr timer( new Timer( milliSec ) );
+ TimerPtr timer(new Timer(milliSec));
return timer;
}
-Timer::Timer( unsigned int milliSec )
+Timer::Timer(unsigned int milliSec)
: mImpl(new Impl(milliSec))
{
}
void Timer::Start()
{
- if( 0 > mImpl->mId )
+ if(0 > mImpl->mId)
{
- mImpl->mId = WindowsPlatformImplementation::SetTimer( mImpl->mInterval, TimerSourceFunc, this );
+ mImpl->mId = WindowsPlatform::SetTimer(mImpl->mInterval, TimerSourceFunc, this);
}
}
void Timer::Stop()
{
- if( 0 <= mImpl->mId )
+ if(0 <= mImpl->mId)
{
- WindowsPlatformImplementation::KillTimer( mImpl->mId );
+ WindowsPlatform::KillTimer(mImpl->mId);
mImpl->mId = -1;
}
}
void Timer::Pause()
{
-
}
void Timer::Resume()
{
-
}
-void Timer::SetInterval( unsigned int interval, bool restart )
+void Timer::SetInterval(unsigned int interval, bool restart)
{
- if( true == restart )
+ if(true == restart)
{
// stop existing timer
Stop();
bool Timer::Tick()
{
// Guard against destruction during signal emission
- Dali::Timer handle( this );
+ Dali::Timer handle(this);
- bool retVal( false );
+ bool retVal(false);
// Override with new signal if used
- if( !mTickSignal.Empty() )
+ if(!mTickSignal.Empty())
{
retVal = mTickSignal.Emit();
// Timer stops if return value is false
- if (retVal == false)
+ if(retVal == false)
{
Stop();
}
else
{
- retVal = true; // continue emission
+ retVal = true; // continue emission
}
}
else // no callbacks registered
} // namespace Internal
} // namespace Dali
-