Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
cetlib
cetlib
filepath_maker.h
Go to the documentation of this file.
1
#ifndef cetlib_filepath_maker_h
2
#define cetlib_filepath_maker_h
3
4
// ======================================================================
5
//
6
// filepath_maker: A family of related policies governing the translation
7
// of a filename into a fully-qualified filepath
8
//
9
// The semantics of each of the policies are as follows:
10
//
11
// filepath_maker: No lookup at all.
12
//
13
// filepath_lookup: Only lookup permitted.
14
15
// filepath_lookup_nonabsolute: Absolute paths are allowed, but lookup
16
// occurs for non-absolute paths.
17
//
18
// filepath_lookup_after1: No lookup for the first file, and only
19
// lookup for all subsequent files.
20
//
21
// filepath_first_absolute_or_lookup_with_dot: The first file can be
22
// an absolute path, a path relative to '.', or a path that can be
23
// looked up; all subsequent files must be looked up.
24
//
25
// ======================================================================
26
27
#include "
cetlib/search_path.h
"
28
#include <memory>
29
#include <string>
30
31
namespace
cet
{
32
class
filepath_maker;
33
class
filepath_lookup;
34
class
filepath_lookup_nonabsolute;
35
class
filepath_lookup_after1;
36
class
filepath_first_absolute_or_lookup_with_dot;
37
class
lookup_policy_selector;
38
}
39
40
// ----------------------------------------------------------------------
41
42
class
cet::filepath_maker
{
43
public
:
44
virtual
std::string
operator()
(
std::string
const
&
filename
);
45
46
virtual
~filepath_maker
() noexcept =
default
;
47
48
};
// filepath_maker
49
50
// ----------------------------------------------------------------------
51
52
class
cet::filepath_lookup
:
public
cet::filepath_maker
{
53
public
:
54
filepath_lookup
(
std::string
paths);
55
56
std::string
operator()
(
std::string
const
&
filename
)
override
;
57
58
private
:
59
cet::search_path
paths
;
60
61
};
// filepath_lookup
62
63
// ----------------------------------------------------------------------
64
65
class
cet::filepath_lookup_nonabsolute
:
public
cet::filepath_maker
{
66
public
:
67
filepath_lookup_nonabsolute
(
std::string
paths);
68
69
std::string
operator()
(
std::string
const
&
filename
)
override
;
70
71
private
:
72
cet::search_path
paths
;
73
74
};
// filepath_lookup_nonabsolute
75
76
// ----------------------------------------------------------------------
77
78
class
cet::filepath_lookup_after1
:
public
cet::filepath_maker
{
79
public
:
80
filepath_lookup_after1
(
std::string
paths);
81
82
std::string
operator()
(
std::string
const
&
filename
)
override
;
83
84
void
reset
();
85
86
private
:
87
bool
after1{
false
};
88
cet::search_path
paths
;
89
90
};
// filepath_lookup_after1
91
92
// ----------------------------------------------------------------------
93
94
class
cet::filepath_first_absolute_or_lookup_with_dot
95
:
public
cet::filepath_maker
{
96
public
:
97
// The provided string must be the *value* of the environment
98
// variable, *not* its name.
99
filepath_first_absolute_or_lookup_with_dot
(
std::string
paths);
100
std::string
operator()
(
std::string
const
&
filename
)
override
;
101
void
reset
();
102
103
private
:
104
bool
first{
true
};
105
cet::search_path
first_paths
;
106
cet::search_path
after_paths
;
107
};
// filepath_first_absolute_or_lookup_with_dot
108
109
// ----------------------------------------------------------------------
110
111
class
cet::lookup_policy_selector
{
112
public
:
113
std::unique_ptr<filepath_maker>
select
(
std::string
const
& spec,
114
std::string
paths)
const
;
115
std::string
help_message()
const
;
116
117
private
:
118
static
constexpr
auto
119
none
() noexcept
120
{
121
return
"none"
;
122
}
123
static
constexpr
auto
124
all
() noexcept
125
{
126
return
"all"
;
127
}
128
static
constexpr
auto
129
nonabsolute
() noexcept
130
{
131
return
"nonabsolute"
;
132
}
133
static
constexpr
auto
134
after1
() noexcept
135
{
136
return
"after1"
;
137
}
138
static
constexpr
auto
139
permissive
() noexcept
140
{
141
return
"permissive"
;
142
}
143
};
144
145
// ======================================================================
146
147
#endif
/* cetlib_filepath_maker_h */
148
149
// Local Variables:
150
// mode: c++
151
// End:
cet::filepath_lookup_after1
Definition:
filepath_maker.h:78
cet::lookup_policy_selector::all
static constexpr auto all() noexcept
Definition:
filepath_maker.h:124
cet::filepath_first_absolute_or_lookup_with_dot
Definition:
filepath_maker.h:94
string
std::string string
Definition:
nybbler.cc:12
cet::filepath_lookup_nonabsolute::paths
cet::search_path paths
Definition:
filepath_maker.h:72
cet::filepath_lookup::paths
cet::search_path paths
Definition:
filepath_maker.h:59
train.filename
string filename
Definition:
train.py:213
cet::lookup_policy_selector::none
static constexpr auto none() noexcept
Definition:
filepath_maker.h:119
cet::filepath_maker
Definition:
filepath_maker.h:42
reset
QTextStream & reset(QTextStream &s)
Definition:
qtextstream.cpp:2048
cet
Definition:
PluginSymbolResolvers.h:8
cet::filepath_lookup
Definition:
filepath_maker.h:52
cet::filepath_maker::operator()
virtual std::string operator()(std::string const &filename)
Definition:
filepath_maker.cc:26
cet::filepath_first_absolute_or_lookup_with_dot::after_paths
cet::search_path after_paths
Definition:
filepath_maker.h:106
cet::filepath_maker::~filepath_maker
virtual ~filepath_maker() noexcept=default
cet::lookup_policy_selector::nonabsolute
static constexpr auto nonabsolute() noexcept
Definition:
filepath_maker.h:129
cet::sqlite::select
auto select(T const &...t)
Definition:
select.h:146
cet::lookup_policy_selector::permissive
static constexpr auto permissive() noexcept
Definition:
filepath_maker.h:139
cet::filepath_first_absolute_or_lookup_with_dot::first_paths
cet::search_path first_paths
Definition:
filepath_maker.h:105
search_path.h
cet::lookup_policy_selector
Definition:
filepath_maker.h:111
cet::filepath_lookup_after1::paths
cet::search_path paths
Definition:
filepath_maker.h:88
cet::search_path
Definition:
search_path.h:36
cet::filepath_lookup_nonabsolute
Definition:
filepath_maker.h:65
cet::lookup_policy_selector::after1
static constexpr auto after1() noexcept
Definition:
filepath_maker.h:134
Generated by
1.8.11