LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
MaybeDisplayParent.cc
Go to the documentation of this file.
2 #include "cetlib/split_by_regex.h"
3 
4 #include <regex>
5 
6 namespace {
7  std::regex const re_dot{"\\."};
8  std::regex const re_index{"\\[(\\d+)\\]"};
9 }
10 
11 namespace fhicl::detail {
12 
13  std::vector<std::string>
14  MaybeDisplayParent::get_parents(std::string const& k)
15  {
16  std::vector<std::string> parents;
17  for (auto const& key : cet::split_by_regex(k, re_dot))
18  for (auto const& token :
19  cet::split_by_regex(std::regex_replace(key, re_index, ",$1"), ","))
20  parents.push_back(token);
21 
22  // Skip first key, which is something like "<some_label>" in the context
23  // whenever this function is called.
24  return std::vector<std::string>(parents.begin() + 1, parents.end());
25  }
26 }
std::vector< std::string > get_parents(std::string const &k)