Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:28:55

0001 #include "FWCore/ParameterSet/interface/defaultModuleLabel.h"
0002 
0003 #include <algorithm>
0004 
0005 namespace edm {
0006   std::string defaultModuleLabel(std::string label) {
0007     // remove all colons (module type may contain namespace)
0008     label.erase(std::remove(label.begin(), label.end(), ':'), label.end());
0009 
0010     // the following code originates from HLTrigger/HLTcore/interface/defaultModuleLabel.h
0011     // if the label is all uppercase, change it to all lowercase
0012     // if the label starts with more than one uppercase letter, change n-1 to lowercase
0013     // otherwise, change the first letter to lowercase
0014     unsigned int ups = 0;
0015     for (char c : label)
0016       if (std::isupper(c))
0017         ++ups;
0018       else
0019         break;
0020     if (ups > 1 and ups != label.size())
0021       --ups;
0022     for (unsigned int i = 0; i < ups; ++i)
0023       label[i] = std::tolower(label[i]);
0024 
0025     return label;
0026   }
0027 }  // namespace edm