MCPcopy Create free account
hub / github.com/csyonghe/Spire / EscapeCodeName

Function EscapeCodeName

Source/SpireCore/Naming.cpp:9–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7 using namespace CoreLib;
8
9 CoreLib::String EscapeCodeName(CoreLib::String str)
10 {
11 StringBuilder sb;
12 bool isUnderScore = false;
13 for (auto ch : str)
14 {
15 if (ch == '_' || !((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')))
16 {
17 if (isUnderScore)
18 sb << "I_";
19 else
20 sb << "_";
21 isUnderScore = true;
22 }
23 else
24 {
25 isUnderScore = false;
26 sb << ch;
27 }
28 }
29 if (isUnderScore)
30 sb << "I";
31 return sb.ProduceString();
32 }
33
34 }
35}

Callers 13

AddWorldNameSuffixFunction · 0.85
AssignUniqueNamesFunction · 0.85
ProcessShaderMethod · 0.85
VisitComponentMethod · 0.85
VisitFunctionMethod · 0.85
VisitDeclrVariableMethod · 0.85
CompileMethod · 0.85

Calls 1

ProduceStringMethod · 0.80

Tested by

no test coverage detected