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

Method Execute

Source/Engine/Debug/DebugCommands.cpp:384–423  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382DebugCommandsService DebugCommandsServiceInstance;
383
384void DebugCommands::Execute(StringView command)
385{
386 PROFILE_MEM(EngineDebug);
387 // TODO: fix missing string handle on 1st command execution (command gets invalid after InitCommands due to dotnet GC or dotnet interop handles flush)
388 String commandCopy = command;
389 command = commandCopy;
390
391 // Preprocess command text
392 while (command.HasChars() && StringUtils::IsWhitespace(command[0]))
393 command = StringView(command.Get() + 1, command.Length() - 1);
394 while (command.HasChars() && StringUtils::IsWhitespace(command[command.Length() - 1]))
395 command = StringView(command.Get(), command.Length() - 1);
396 if (command.IsEmpty())
397 return;
398 StringView name = command;
399 StringView args;
400 int32 argsStart = name.Find(' ');
401 if (argsStart != -1)
402 {
403 name = command.Left(argsStart);
404 args = command.Right(argsStart + 1);
405 }
406
407 // Ensure that commands cache has been created
408 EnsureInited();
409 ScopeLock lock(Locker);
410
411 // Find command to run
412 for (const CommandData& cmd : Commands)
413 {
414 if (name.Length() == cmd.Name.Length() &&
415 StringUtils::CompareIgnoreCase(name.Get(), cmd.Name.Get(), name.Length()) == 0)
416 {
417 cmd.Invoke(args);
418 return;
419 }
420 }
421
422 LOG(Error, "Unknown command '{}'", name);
423}
424
425void DebugCommands::Search(StringView searchText, Array<StringView>& matches, bool startsWith)
426{

Callers

nothing calls this directly

Calls 10

EnsureInitedFunction · 0.85
LeftMethod · 0.80
RightMethod · 0.80
StringViewClass · 0.50
HasCharsMethod · 0.45
GetMethod · 0.45
LengthMethod · 0.45
IsEmptyMethod · 0.45
FindMethod · 0.45
InvokeMethod · 0.45

Tested by

no test coverage detected