OpenVPN 3 Core Library
Loading...
Searching...
No Matches
glob.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_COMMON_GLOB_H
13
#define OPENVPN_COMMON_GLOB_H
14
15
#include <glob.h>
16
17
#include <cstring>
18
#include <string>
19
20
namespace
openvpn
{
21
class
Glob
22
{
23
public
:
24
Glob
(
const
std::string &pattern,
const
int
flags)
25
{
26
reset
();
27
status_
= ::glob(pattern.c_str(), flags,
nullptr
, &
glob_
);
28
}
29
30
int
status
()
const
31
{
32
return
status_
;
33
}
34
35
size_t
size
()
const
36
{
37
return
glob_
.gl_pathc;
38
}
39
40
const
char
*
operator[]
(
const
size_t
i)
const
41
{
42
return
glob_
.gl_pathv[i];
43
}
44
45
~Glob
()
46
{
47
::globfree(&
glob_
);
48
}
49
50
private
:
51
void
reset
()
52
{
53
std::memset(&
glob_
, 0,
sizeof
(
glob_
));
54
status_
= 0;
55
}
56
57
Glob
(
const
Glob
&) =
delete
;
58
Glob
&
operator=
(
const
Glob
&) =
delete
;
59
60
::glob_t
glob_
;
61
int
status_
;
62
};
63
}
// namespace openvpn
64
65
#endif
openvpn::Glob
Definition
glob.hpp:22
openvpn::Glob::status
int status() const
Definition
glob.hpp:30
openvpn::Glob::operator[]
const char * operator[](const size_t i) const
Definition
glob.hpp:40
openvpn::Glob::operator=
Glob & operator=(const Glob &)=delete
openvpn::Glob::reset
void reset()
Definition
glob.hpp:51
openvpn::Glob::~Glob
~Glob()
Definition
glob.hpp:45
openvpn::Glob::glob_
::glob_t glob_
Definition
glob.hpp:60
openvpn::Glob::size
size_t size() const
Definition
glob.hpp:35
openvpn::Glob::Glob
Glob(const std::string &pattern, const int flags)
Definition
glob.hpp:24
openvpn::Glob::status_
int status_
Definition
glob.hpp:61
openvpn::Glob::Glob
Glob(const Glob &)=delete
openvpn
Definition
ovpncli.cpp:97
openvpn
common
glob.hpp
Generated by
1.9.8