22 std::regex
const reAllSpaces{
" +"};
23 std::regex
const reAssns{
"art::Assns"};
24 std::regex
const reBeginSpace{
"^ +"};
25 std::regex
const reComma{
","};
26 std::regex
const reEndSpace{
" +$"};
27 std::regex
const reParens{
"(\\(|\\))"};
28 std::regex
const reFirstTwoArgs{
"^([^,]+),([^,]+)"};
29 std::regex
const reLong{
"long "};
30 std::regex
const reLongLong{
"Long64_t"};
31 std::regex
const reMapVector{
"cet::map_vector"};
32 std::regex
const reMapVectorKey{
"cet::map_vector_key"};
33 std::regex
const reString{
"(?:std::basic_string<char>|std::string)"};
34 std::regex
const reTemplateArgs{
"([^<]*)<(.*)>$"};
35 std::regex
const reTemplateClass{
"([^<>,]+<[^<>]*>)"};
36 std::regex
const reULongLong{
"ULong64_t"};
37 std::regex
const reUnsigned{
"unsigned "};
38 std::regex
const reVector{
"std::vector"};
39 std::regex
const reWrapper{
"art::Wrapper<(.*)>"};
46 return std::regex_replace(std::regex_replace(in, reBeginSpace, emptyString),
54 return std::regex_replace(in, reAllSpaces, emptyString);
60 return std::regex_replace(in, reParens,
"\\$1");
67 name = std::regex_replace(
name, reString,
"String");
68 name = std::regex_replace(
name, reUnsigned,
"u");
69 name = std::regex_replace(
name, reLong,
"l");
70 name = std::regex_replace(
name, reULongLong,
"ull");
71 name = std::regex_replace(
name, reLongLong,
"ll");
72 name = std::regex_replace(
name, reVector,
"s");
73 name = std::regex_replace(
name, reMapVectorKey,
"mvk");
74 name = std::regex_replace(
name, reMapVector,
"mv");
86 if (std::regex_match(
result, theMatch, reTemplateArgs)) {
89 std::string const theSub{handleTemplateArguments(cMatch, aMatch)};
94 std::regex
const eMatch{
std::string{
"^"} + escapeParens(cMatch) +
'<' +
95 escapeParens(aMatch) +
'>'};
96 result = std::regex_replace(
result, eMatch, theSub + cMatch);
104 std::smatch theMatch;
105 if (std::regex_search(result, theMatch, reFirstTwoArgs) &&
106 (theMatch.str(1) > theMatch.str(2))) {
107 result = std::regex_replace(result, reFirstTwoArgs,
"$2,$1");
115 bool shouldStop{
false};
116 while (!shouldStop) {
117 if (std::string::npos != result.find_first_of(
"<")) {
118 std::smatch theMatch;
119 if (std::regex_search(result, theMatch, reTemplateClass)) {
122 removeAllSpaces(subFriendlyName(templateClass))};
123 result = std::regex_replace(
124 result, std::regex(templateClass), friendlierName);
127 <<
"No template match for \"" << result <<
'"';
133 if (std::regex_match(cName, reAssns)) {
134 maybeSwapFirstTwoArgs(result);
136 result = std::regex_replace(result, reComma, emptyString);
145 static std::recursive_mutex s_mutex;
146 static std::map<std::string, std::string> s_nameMap;
147 std::lock_guard sentry{s_mutex};
148 auto entry = s_nameMap.find(iFullName);
149 if (
entry == s_nameMap.end()) {
151 s_nameMap.emplace(iFullName, subFriendlyName(standardRenames(iFullName)))
154 return entry->second;
std::string friendlyName(std::string const &iFullName)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception