OpenVPN 3 Core Library
Loading...
Searching...
No Matches
ostream.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// A helper macro for setting up an arbitrary class
13// to support stringstream concatenation using <<
14
15#ifndef OPENVPN_COMMON_OSTREAM_H
16#define OPENVPN_COMMON_OSTREAM_H
17
18#include <ostream>
19#include <string>
20
21#define OPENVPN_OSTREAM(TYPE, METH) \
22 template <typename Elem, typename Traits> \
23 std::basic_ostream<Elem, Traits> &operator<<( \
24 std::basic_ostream<Elem, Traits> &os, const TYPE &addr) \
25 { \
26 os << addr.METH(); \
27 return os; \
28 }
29
30#endif // OPENVPN_COMMON_OSTREAM_H