CMS 3D CMS Logo

defaultModuleLabel.h
Go to the documentation of this file.
1 #ifndef FWCore_ParameterSet_defaultModuleLabel_h
2 #define FWCore_ParameterSet_defaultModuleLabel_h
3 
4 #include <string>
5 #include <algorithm>
6 
7 namespace edm {
8  std::string defaultModuleLabel(std::string label) { // take by value because we'll copy it anyway
9  // remove all colons (module type may contain namespace)
10  label.erase(std::remove(label.begin(), label.end(), ':'), label.end());
11 
12  // the following code originates from HLTrigger/HLTcore/interface/defaultModuleLabel.h
13  // if the label is all uppercase, change it to all lowercase
14  // if the label starts with more than one uppercase letter, change n-1 to lowercase
15  // otherwise, change the first letter to lowercase
16  unsigned int ups = 0;
17  for (char c : label)
18  if (std::isupper(c))
19  ++ups;
20  else
21  break;
22  if (ups > 1 and ups != label.size())
23  --ups;
24  for (unsigned int i = 0; i < ups; ++i)
25  label[i] = std::tolower(label[i]);
26 
27  return label;
28  }
29 } // namespace edm
30 
31 #endif
char const * label
std::string defaultModuleLabel(std::string label)
def remove(d, key, TELL=False)
Definition: MatrixUtil.py:212
HLT enums.