MCPcopy Create free account
hub / github.com/MyGUI/mygui / stringToUpperCase

Method stringToUpperCase

Tools/LayoutEditor/CodeGenerator.cpp:77–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75 }
76
77 std::string CodeGenerator::stringToUpperCase(std::string_view _str)
78 {
79 // replace lower case sharacters with upper case characters and add '_' between words
80 // words is either Word or WORD, for example TestXMLPanelName return TEST_XML_PANEL_NAME
81 std::string ret;
82 if (_str.empty())
83 return ret;
84 bool previousIsLowerCase = false;
85 for (size_t i = 0; i < _str.length(); i++)
86 {
87 if ((i != 0) &&
88 ((previousIsLowerCase && isupper(_str[i])) ||
89 (isupper(_str[i]) && (i + 1 < _str.length()) && islower(_str[i + 1]))))
90 {
91 ret.push_back('_');
92 }
93 ret.push_back((char)toupper(_str[i]));
94 previousIsLowerCase = (islower(_str[i]) != 0);
95 }
96 return ret;
97 }
98
99 void CodeGenerator::printWidgetDeclaration(WidgetContainer* _container, std::ofstream& _stream)
100 {

Callers

nothing calls this directly

Calls 4

toupperFunction · 0.85
emptyMethod · 0.45
lengthMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected