MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / BuildName

Function BuildName

Source/Engine/Debug/DebugCommands.cpp:190–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188 Array<CommandData> Commands;
189
190 void BuildName(CommandData& cmd, const MClass* mclass, const StringAnsiView& itemName)
191 {
192 StringAnsiView mclassName = mclass->GetName();
193 StringAnsiView mclassFullname = mclass->GetFullName();
194 StringAnsiView mclassNamespace = mclass->GetNamespace();
195
196 Array<Char, InlinedAllocation<200>> buffer; // Stack-based but with option to alloc in case of very long commands
197 buffer.Resize(mclassFullname.Length() - mclassNamespace.Length() + itemName.Length() + 1);
198 Char* bufferPtr = buffer.Get();
199
200 // Check if class is nested, then include outer class name for hierarchy
201 if (mclassNamespace.Length() + mclassName.Length() + 1 != mclassFullname.Length())
202 {
203 StringAnsiView outerName(mclassFullname.Get() + mclassNamespace.Length() + 1, mclassFullname.Length() - mclassNamespace.Length() - 2 - mclassName.Length());
204 StringUtils::Copy(bufferPtr, outerName.Get(), outerName.Length());
205 bufferPtr += outerName.Length();
206 *bufferPtr++ = '.';
207 }
208 StringUtils::Copy(bufferPtr, mclassName.Get(), mclassName.Length());
209 bufferPtr += mclassName.Length();
210 *bufferPtr++ = '.';
211 StringUtils::Copy(bufferPtr, itemName.Get(), itemName.Length());
212 bufferPtr += itemName.Length();
213 *bufferPtr = 0;
214
215 cmd.Name.Set(buffer.Get(), (int32)(bufferPtr - buffer.Get()));
216 }
217
218 void FindDebugCommands(BinaryModule* module)
219 {

Callers 1

FindDebugCommandsFunction · 0.85

Calls 6

GetNamespaceMethod · 0.80
GetNameMethod · 0.45
ResizeMethod · 0.45
LengthMethod · 0.45
GetMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected