ProcessUtils.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Copyright (c) 2008-2023 the Urho3D project
  2. // License: MIT
  3. #pragma once
  4. #include "../Container/Str.h"
  5. #include <cstdlib>
  6. namespace Urho3D
  7. {
  8. class Mutex;
  9. /// Initialize the FPU to round-to-nearest, single precision mode.
  10. URHO3D_API void InitFPU();
  11. /// Display an error dialog with the specified title and message.
  12. URHO3D_API void ErrorDialog(const String& title, const String& message);
  13. /// Exit the application with an error message to the console.
  14. URHO3D_API void ErrorExit(const String& message = String::EMPTY, int exitCode = EXIT_FAILURE);
  15. /// Open a console window.
  16. URHO3D_API void OpenConsoleWindow();
  17. /// Print Unicode text to the console. Will not be printed to the MSVC output window.
  18. URHO3D_API void PrintUnicode(const String& str, bool error = false);
  19. /// Print Unicode text to the console with a newline appended. Will not be printed to the MSVC output window.
  20. URHO3D_API void PrintUnicodeLine(const String& str, bool error = false);
  21. /// Print ASCII text to the console with a newline appended. Uses printf() to allow printing into the MSVC output window.
  22. URHO3D_API void PrintLine(const String& str, bool error = false);
  23. /// Print ASCII text to the console with a newline appended. Uses printf() to allow printing into the MSVC output window.
  24. URHO3D_API void PrintLine(const char* str, bool error = false);
  25. /// Parse arguments from the command line. First argument is by default assumed to be the executable name and is skipped.
  26. URHO3D_API const Vector<String>& ParseArguments(const String& cmdLine, bool skipFirstArgument = true);
  27. /// Parse arguments from the command line.
  28. URHO3D_API const Vector<String>& ParseArguments(const char* cmdLine);
  29. /// Parse arguments from a wide char command line.
  30. URHO3D_API const Vector<String>& ParseArguments(const WString& cmdLine);
  31. /// Parse arguments from a wide char command line.
  32. URHO3D_API const Vector<String>& ParseArguments(const wchar_t* cmdLine);
  33. /// Parse arguments from argc & argv.
  34. URHO3D_API const Vector<String>& ParseArguments(int argc, char** argv);
  35. /// Return previously parsed arguments.
  36. URHO3D_API const Vector<String>& GetArguments();
  37. /// Read input from the console window. Return empty if no input.
  38. URHO3D_API String GetConsoleInput();
  39. /// Return the runtime platform identifier, or (?) if not identified.
  40. URHO3D_API String GetPlatform();
  41. /// Return the number of physical CPU cores.
  42. URHO3D_API unsigned GetNumPhysicalCPUs();
  43. /// Return the number of logical CPUs (different from physical if hyperthreading is used).
  44. URHO3D_API unsigned GetNumLogicalCPUs();
  45. /// Set minidump write location as an absolute path. If empty, uses default (UserProfile/AppData/Roaming/urho3D/crashdumps) Minidumps are only supported on MSVC compiler.
  46. URHO3D_API void SetMiniDumpDir(const String& pathName);
  47. /// Return minidump write location.
  48. URHO3D_API String GetMiniDumpDir();
  49. /// Return the total amount of usable memory in bytes.
  50. URHO3D_API unsigned long long GetTotalMemory();
  51. /// Return the name of the currently logged in user, or (?) if not identified.
  52. URHO3D_API String GetLoginName();
  53. /// Return the name of the running machine.
  54. URHO3D_API String GetHostName();
  55. /// Return the version of the currently running OS, or (?) if not identified.
  56. URHO3D_API String GetOSVersion();
  57. } // namespace Urho3D