15 #ifndef OPENSCENARIO_INTERPRETER__NAME_HPP_
16 #define OPENSCENARIO_INTERPRETER__NAME_HPP_
28 template <
typename... Ts>
31 for (
const auto each :
":") {
32 if (find(each) != std::string::npos) {
33 throw SyntaxError(
"Invalid name reference ", std::quoted(*
this),
".");
39 template <
typename Name>
59 explicit Prefixed(
const std::vector<std::string> given)
60 :
absolute(not given.empty() and given.front().empty()),
69 template <std::
size_t N>
79 std::vector<std::string> result;
81 std::size_t prev_pos = 0;
85 while ((pos =
name.find(separator, prev_pos)) != std::string::npos) {
86 result.push_back(
name.substr(prev_pos, pos - prev_pos));
87 prev_pos = pos + separator.size();
90 result.push_back(
name.substr(prev_pos, pos));
97 if (prefixed_name.absolute) {
101 for (
const auto & prefix : prefixed_name.prefixes) {
102 os << (prefix.empty() ?
"{anonymous}" : prefix.c_str()) <<
"::";
105 return os << prefixed_name.name;
Definition: junit5.hpp:25
std::string string
Definition: junit5.hpp:26
Name(Ts &&... xs)
Definition: name.hpp:29
Prefixed(const std::string &given)
Definition: name.hpp:67
Prefixed(bool absolute, const std::list< std::string > &prefixes, const Name &name)
Definition: name.hpp:54
static auto separate(const std::string &name) -> std::vector< std::string >
Definition: name.hpp:75
const bool absolute
Definition: name.hpp:42
Prefixed(const Prefixed &)=delete
Prefixed(Prefixed &&)=default
auto strip() const
Definition: name.hpp:70
const std::list< std::string > prefixes
Definition: name.hpp:44
Prefixed(const std::vector< std::string > given)
Definition: name.hpp:59
friend auto operator<<(std::ostream &os, const Prefixed &prefixed_name) -> std::ostream &
Definition: name.hpp:95
const Name name
Definition: name.hpp:46