LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
MaybeDisplayParent.cc
Go to the documentation of this file.
2 #include "cetlib/exempt_ptr.h"
3 #include "cetlib/split_by_regex.h"
5 
6 #include <cctype>
7 #include <regex>
8 #include <sstream>
9 #include <vector>
10 
11 //===================================================================================
12 namespace fhicl {
13  namespace detail {
14 
15  std::vector<std::string>
16  MaybeDisplayParent::get_parents(std::string const& k)
17  {
18  std::regex const r_index{"\\[(\\d+)\\]"};
19  std::vector<std::string> parents;
20  for (auto const& key : cet::split_by_regex(k, "\\."))
21  for (auto const& token :
22  cet::split_by_regex(std::regex_replace(key, r_index, ",$1"), ","))
23  parents.push_back(token);
24 
25  // Skip first key, which is something like "<some_label>" in the context
26  // whenever this function is called.
27  return std::vector<std::string>(parents.begin() + 1, parents.end());
28  }
29  }
30 }
31 
32 // Local variables:
33 // mode: c++
34 // End:
parameter set interface
std::vector< std::string > get_parents(std::string const &k)