deprecated use of unsigned overloadings for functions in class timer
This commit is contained in:
parent
18c11541a7
commit
fbe04436d4
@ -38,7 +38,9 @@ namespace nana
|
|||||||
timer& operator=(timer&&) = delete;
|
timer& operator=(timer&&) = delete;
|
||||||
public:
|
public:
|
||||||
timer();
|
timer();
|
||||||
timer(unsigned int ms) : timer{} { interval(ms); } /// Accepts an initial interval in ms
|
[[deprecated("prefer a std::chrono::duration (like std::chrono::milliseconds) over "
|
||||||
|
"raw integers for durations")]]
|
||||||
|
timer(unsigned int ms) : timer{} { interval_(ms); } /// Accepts an initial interval in ms
|
||||||
template <typename Rep, typename Period> /// Accepts an initial interval in any chrono unit
|
template <typename Rep, typename Period> /// Accepts an initial interval in any chrono unit
|
||||||
explicit timer(std::chrono::duration<Rep, Period> const & time) : timer{} { interval(time); }
|
explicit timer(std::chrono::duration<Rep, Period> const & time) : timer{} { interval(time); }
|
||||||
|
|
||||||
@ -55,11 +57,13 @@ namespace nana
|
|||||||
bool started() const;
|
bool started() const;
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
void interval(unsigned milliseconds); ///< Set the duration between calls (millisec ??)
|
[[deprecated("prefer a std::chrono::duration (like std::chrono::milliseconds) over "
|
||||||
|
"raw integers for durations")]]
|
||||||
|
inline void interval(unsigned milliseconds) { interval_(milliseconds); }
|
||||||
template <typename Rep, typename Period>
|
template <typename Rep, typename Period>
|
||||||
inline void interval(std::chrono::duration<Rep, Period> const & time_interval) ///< Set the duration between calls, accepts std::chrono
|
inline void interval(std::chrono::duration<Rep, Period> const & time_interval) ///< Set the duration between calls, accepts std::chrono
|
||||||
{
|
{
|
||||||
interval(std::chrono::duration_cast<std::chrono::milliseconds>(time_interval).count());
|
interval_(std::chrono::duration_cast<std::chrono::milliseconds>(time_interval).count());
|
||||||
}
|
}
|
||||||
unsigned interval() const;
|
unsigned interval() const;
|
||||||
template <typename Duration = std::chrono::milliseconds>
|
template <typename Duration = std::chrono::milliseconds>
|
||||||
@ -67,6 +71,8 @@ namespace nana
|
|||||||
{
|
{
|
||||||
return std::chrono::duration_cast<Duration>(std::chrono::milliseconds(interval));
|
return std::chrono::duration_cast<Duration>(std::chrono::milliseconds(interval));
|
||||||
}
|
}
|
||||||
|
private:
|
||||||
|
void interval_(unsigned milliseconds); ///< Set the duration between calls (millisec ??)
|
||||||
private:
|
private:
|
||||||
nana::basic_event<arg_elapse> elapse_;
|
nana::basic_event<arg_elapse> elapse_;
|
||||||
implement * const impl_;
|
implement * const impl_;
|
||||||
|
|||||||
@ -220,7 +220,7 @@ namespace nana
|
|||||||
timer_driver::instance().destroy(tmid);
|
timer_driver::instance().destroy(tmid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void timer::interval(unsigned ms)
|
void timer::interval_(unsigned ms)
|
||||||
{
|
{
|
||||||
if (ms != impl_->interval)
|
if (ms != impl_->interval)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user