12 #include "tbb/concurrent_unordered_map.h" 20 namespace friendlyname {
24 static std::regex
const reColons(
"::");
25 static std::regex
const reComma(
",");
44 static std::regex
const reWrapper(
"edm::Wrapper<(.*)>");
45 static std::regex
const reString(
"std::basic_string<char>");
46 static std::regex
const reString2(
"std::string");
47 static std::regex
const reString3(
"std::basic_string<char,std::char_traits<char> >");
49 static std::regex
const reCXX11(
"std::__cxx11::");
50 static std::regex
const reSorted(
"edm::SortedCollection<(.*), *edm::StrictWeakOrdering<\\1 *> >");
51 static std::regex
const reclangabi(
"std::__1::");
53 static std::regex
const reLongLong(
"Long64_t");
54 static std::regex
const reUnsigned(
"unsigned ");
55 static std::regex
const reLong(
"long ");
56 static std::regex
const reVector(
"std::vector");
57 static std::regex
const reSharedPtr(
"std::shared_ptr");
58 static std::regex
const reUniquePtr(
"std::unique_ptr");
59 static std::regex
const reAIKR(
", *edm::helper::AssociationIdenticalKeyReference");
62 static std::regex
const reOwnVector(
"edm::OwnVector<(.*), *edm::ClonePolicy<\\1 *> >");
66 static std::regex
const reOneToOne(
"edm::AssociationMap< *edm::OneToOne<(.*?),(.*?), *u[a-z]*> >");
67 static std::regex
const reOneToMany(
"edm::AssociationMap< *edm::OneToMany<(.*?),(.*?), *u[a-z]*> >");
68 static std::regex
const reOneToValue(
"edm::AssociationMap< *edm::OneToValue<(.*?),(.*?), *u[a-z]*> >");
69 static std::regex
const reOneToManyWithQuality(
"edm::AssociationMap<edm::OneToManyWithQuality<(.*?), *(.*?), *(.*?), *u[a-z]*> >");
70 static std::regex
const reToVector(
"edm::AssociationVector<(.*), *(.*), *edm::Ref.*,.*>");
72 static std::regex
const reToRangeMap(
"edm::RangeMap< *(.*), *(.*), *edm::ClonePolicy<([^>]*)> >");
74 static std::regex
const reToRefs1(
"edm::RefVector< *(.*)< *(.*) *>, *\\2 *, *edm::refhelper::FindUsingAdvance< *\\1< *\\2 *> *, *\\2 *> *>");
75 static std::regex
const reToRefs2(
"edm::RefVector< *(.*) *, *(.*) *, *edm::refhelper::FindUsingAdvance< *\\1, *\\2 *> *>");
76 static std::regex
const reToRefsAssoc(
"edm::RefVector< *Association(.*) *, *edm::helper(.*), *Association(.*)::Find>");
80 using std::regex_replace;
83 name = regex_replace(name,
rePointer,
"ptr");
84 name = regex_replace(name,reAIKR,
"");
85 name = regex_replace(name,reclangabi,
"std::");
86 name = regex_replace(name,reCXX11,
"std::");
87 name = regex_replace(name,reString,
"String");
88 name = regex_replace(name,reString2,
"String");
89 name = regex_replace(name,reString3,
"String");
90 name = regex_replace(name,reSorted,
"sSorted<$1>");
91 name = regex_replace(name,reULongLong,
"ull");
92 name = regex_replace(name,reLongLong,
"ll");
93 name = regex_replace(name,reUnsigned,
"u");
94 name = regex_replace(name,reLong,
"l");
95 name = regex_replace(name,reVector,
"s");
96 name = regex_replace(name,reSharedPtr,
"SharedPtr");
97 name = regex_replace(name,reUniquePtr,
"UniquePtr");
98 name = regex_replace(name,reOwnVector,
"sOwned<$1>");
99 name = regex_replace(name,reToVector,
"AssociationVector<$1,To,$2>");
100 name = regex_replace(name,reOneToOne,
"Association<$1,ToOne,$2>");
101 name = regex_replace(name,reOneToMany,
"Association<$1,ToMany,$2>");
102 name = regex_replace(name,reOneToValue,
"Association<$1,ToValue,$2>");
103 name = regex_replace(name,reOneToManyWithQuality,
"Association<$1,ToMany,$2,WithQuantity,$3>");
104 name = regex_replace(name,reToRangeMap,
"RangeMap<$1,$2>");
105 name = regex_replace(name,reToRefs1,
"Refs<$1<$2>>");
106 name = regex_replace(name,reToRefs2,
"Refs<$1,$2>");
107 name = regex_replace(name,reToRefsAssoc,
"Refs<Association$1>");
124 regex
const eMatch(
std::string(
"(^[^<]*)<")+aMatch+
">");
125 result = regex_replace(result,eMatch,theSub+
"$1");
133 bool shouldStop =
false;
135 if(std::string::npos != result.find_first_of(
"<")) {
142 result = regex_replace(result, regex(templateClass),friendlierName);
146 std::cout <<
" no template match for \""<<result<<
"\""<<std::endl;
147 assert(0 ==
"failed to find a match for template class");
153 result = regex_replace(result,
reComma,
"");
157 typedef tbb::concurrent_unordered_map<std::string, std::string> Map;
158 static Map s_fillToFriendlyName;
159 auto itFound = s_fillToFriendlyName.find(iFullName);
160 if(s_fillToFriendlyName.end()==itFound) {
163 return itFound->second;
static std::regex const reToRefs1("edm::RefVector< *(.*)< *(.*) *>, *\\2 *, *edm::refhelper::FindUsingAdvance< *\\1< *\\2 *> *, *\\2 *> *>")
static std::regex const reEndSpace(" +$")
static std::regex const reToRangeMap("edm::RangeMap< *(.*), *(.*), *edm::ClonePolicy<([^>]*)> >")
static std::regex const reCXX11("std::__cxx11::")
static std::regex const reAIKR(", *edm::helper::AssociationIdenticalKeyReference")
static std::regex const reString3("std::basic_string<char,std::char_traits<char> >")
static std::regex const reUnsigned("unsigned ")
std::string removeAllSpaces(std::string const &iIn)
std::string subFriendlyName(std::string const &iFullName)
static std::regex const reSharedPtr("std::shared_ptr")
static std::regex const rePointer("\\*")
static std::regex const reOneToManyWithQuality("edm::AssociationMap<edm::OneToManyWithQuality<(.*?), *(.*?), *(.*?), *u[a-z]*> >")
static std::regex const reToVector("edm::AssociationVector<(.*), *(.*), *edm::Ref.*,.*>")
static std::regex const reLong("long ")
static std::regex const reOneToMany("edm::AssociationMap< *edm::OneToMany<(.*?),(.*?), *u[a-z]*> >")
static std::regex const reOwnVector("edm::OwnVector<(.*), *edm::ClonePolicy<\\1 *> >")
static std::regex const reSorted("edm::SortedCollection<(.*), *edm::StrictWeakOrdering<\\1 *> >")
static std::regex const reLongLong("Long64_t")
Container::value_type value_type
static std::regex const reComma(",")
std::string friendlyName(std::string const &iFullName)
static std::regex const reOneToOne("edm::AssociationMap< *edm::OneToOne<(.*?),(.*?), *u[a-z]*> >")
std::string handleNamespaces(std::string const &iIn)
static std::regex const reWrapper("edm::Wrapper<(.*)>")
static std::regex const reTemplateArgs("[^<]*<(.*)>$")
static std::regex const reToRefsAssoc("edm::RefVector< *Association(.*) *, *edm::helper(.*), *Association(.*)::Find>")
static std::regex const reULongLong("ULong64_t")
static std::regex const reVector("std::vector")
std::string standardRenames(std::string const &iIn)
static std::regex const reUniquePtr("std::unique_ptr")
static std::regex const reColons("::")
std::string handleTemplateArguments(std::string const &)
static std::regex const reTemplateClass("([^<>,]+<[^<>]*>)")
static std::string const emptyString("")
static std::regex const reBeginSpace("^ +")
static std::regex const reclangabi("std::__1::")
static std::regex const reString2("std::string")
static std::regex const reString("std::basic_string<char>")
static std::regex const reAllSpaces(" +")
static std::regex const reOneToValue("edm::AssociationMap< *edm::OneToValue<(.*?),(.*?), *u[a-z]*> >")
static std::regex const reToRefs2("edm::RefVector< *(.*) *, *(.*) *, *edm::refhelper::FindUsingAdvance< *\\1, *\\2 *> *>")
std::string removeExtraSpaces(std::string const &iIn)