OpenVPN 3 Core Library
Loading...
Searching...
No Matches
sleep.hpp
Go to the documentation of this file.
1// OpenVPN -- An application to securely tunnel IP networks
2// over a single port, with support for SSL/TLS-based
3// session authentication and key exchange,
4// packet encryption, packet authentication, and
5// packet compression.
6//
7// Copyright (C) 2012- OpenVPN Inc.
8//
9// SPDX-License-Identifier: MPL-2.0 OR AGPL-3.0-only WITH openvpn3-openssl-exception
10//
11
12#ifndef OPENVPN_WIN_SLEEP_H
13#define OPENVPN_WIN_SLEEP_H
14
15#include <windows.h>
16
17#include <string>
18
21
22namespace openvpn {
23
24class WinSleep : public Action
25{
26 public:
28
29 WinSleep(DWORD dwMilliseconds_arg)
30 : dwMilliseconds(dwMilliseconds_arg)
31 {
32 }
33
34 virtual void execute(std::ostream &os) override
35 {
36 os << to_string() << std::endl;
37 ::Sleep(dwMilliseconds);
38 }
39
40 virtual std::string to_string() const override
41 {
42 return "Sleeping for " + openvpn::to_string(dwMilliseconds) + " milliseconds...";
43 }
44
45 private:
47};
48
49} // namespace openvpn
50#endif
The smart pointer class.
Definition rc.hpp:119
DWORD dwMilliseconds
Definition sleep.hpp:46
virtual void execute(std::ostream &os) override
Definition sleep.hpp:34
virtual std::string to_string() const override
Definition sleep.hpp:40
RCPtr< WinSleep > Ptr
Definition sleep.hpp:27
WinSleep(DWORD dwMilliseconds_arg)
Definition sleep.hpp:29
std::string to_string(const T &t)
Convert a value to a string.
Definition to_string.hpp:45
std::ostringstream os