OpenVPN 3 Core Library
Loading...
Searching...
No Matches
indexed_title.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#pragma once
13
14#include <string>
15
17
18namespace openvpn {
19
20// TITLE class for representing an object name and index.
21// Useful for referring to array indices when generating errors.
23{
24 public:
25 IndexedTitle(const char *title, const size_t index)
26 : title_(title),
27 index_(index)
28 {
29 }
30
31 std::string to_string() const
32 {
33 return std::string(title_) + '.' + std::to_string(index_);
34 }
35
36 bool empty() const
37 {
38 return false;
39 }
40
41 private:
42 const char *title_;
43 size_t index_;
44};
45
46} // namespace openvpn
IndexedTitle(const char *title, const size_t index)
std::string to_string() const