LeechCraft
0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
timer.h
Go to the documentation of this file.
1
/**********************************************************************
2
* LeechCraft - modular cross-platform feature rich internet client.
3
* Copyright (C) 2006-2014 Georg Rudoy
4
*
5
* Distributed under the Boost Software License, Version 1.0.
6
* (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7
**********************************************************************/
8
9
#pragma once
10
11
#include <chrono>
12
#include <coroutine>
13
#include <Qt>
14
#include "
../threadsconfig.h
"
15
16
namespace
LC::Util
17
{
18
namespace
detail
19
{
20
struct
UTIL_THREADS_API
TimerAwaiter
21
{
22
std::chrono::milliseconds
Duration_
;
23
Qt::TimerType
Precision_
;
24
25
bool
await_ready () const noexcept;
26
void
await_suspend (
std
::coroutine_handle<> handle) noexcept;
27
void
await_resume () const noexcept;
28
};
29
}
30
31
template<Qt::TimerType Precision>
32
struct
WithPrecision
33
{
34
std::chrono::milliseconds
Duration_
;
35
36
auto
operator
co_await
()
const
37
{
38
return
detail::TimerAwaiter
{ Duration_, Precision };
39
}
40
};
41
42
using
Precisely
=
WithPrecision<Qt::PreciseTimer>
;
43
using
Coarsely
=
WithPrecision<Qt::CoarseTimer>
;
44
using
VeryCoarsely
=
WithPrecision<Qt::VeryCoarseTimer>
;
45
}
46
47
namespace
LC
48
{
49
UTIL_THREADS_API
Util::detail::TimerAwaiter
operator
co_await
(std::chrono::milliseconds duration);
50
}
LC::Util
Definition
icoreproxy.h:34
LC
Definition
constants.h:15
std
STL namespace.
LC::Util::WithPrecision
Definition
timer.h:33
LC::Util::WithPrecision::Duration_
std::chrono::milliseconds Duration_
Definition
timer.h:34
LC::Util::detail::TimerAwaiter
Definition
timer.h:21
LC::Util::detail::TimerAwaiter::Duration_
std::chrono::milliseconds Duration_
Definition
timer.h:22
LC::Util::detail::TimerAwaiter::Precision_
Qt::TimerType Precision_
Definition
timer.h:23
threadsconfig.h
UTIL_THREADS_API
#define UTIL_THREADS_API
Definition
threadsconfig.h:16
src
util
threads
coro
timer.h
Generated by
1.12.0