ProcessUtils.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //
  2. // Copyright (c) 2008-2013 the Urho3D project.
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. #pragma once
  23. #include "Str.h"
  24. namespace Urho3D
  25. {
  26. class Mutex;
  27. /// Initialize the FPU to round-to-nearest, single precision mode.
  28. void InitFPU();
  29. /// Display an error dialog with the specified title and message.
  30. void ErrorDialog(const String& title, const String& message);
  31. /// Exit the application with an error message to the console.
  32. void ErrorExit(const String& message, int exitCode = 1);
  33. /// Open a console window.
  34. void OpenConsoleWindow();
  35. /// Print Unicode text to the console. Will not be printed to the MSVC output window.
  36. void PrintUnicode(const String& str);
  37. /// Print Unicode text to the console with a newline appended. Will not be printed to the MSVC output window.
  38. void PrintUnicodeLine(const String& str);
  39. /// Print ASCII text to the console with a newline appended. Uses printf() to allow printing into the MSVC output window.
  40. void PrintLine(const String& str);
  41. /// Parse arguments from the command line.
  42. const Vector<String>& ParseArguments(const String& cmdLine);
  43. /// Parse arguments from the command line.
  44. const Vector<String>& ParseArguments(const char* cmdLine);
  45. /// Parse arguments from a wide char command line.
  46. const Vector<String>& ParseArguments(const WString& cmdLine);
  47. /// Parse arguments from a wide char command line.
  48. const Vector<String>& ParseArguments(const wchar_t* cmdLine);
  49. /// Parse arguments from argc & argv
  50. const Vector<String>& ParseArguments(int argc, char** argv);
  51. /// Return previously parsed arguments.
  52. const Vector<String>& GetArguments();
  53. /// Read input from the console window. Return empty if no input.
  54. String GetConsoleInput();
  55. /// Return the runtime platform identifier. Currently either "Windows", "Linux", "Mac OS X" or "Android".
  56. String GetPlatform();
  57. /// Return the number of physical CPU cores.
  58. unsigned GetNumPhysicalCPUs();
  59. /// Return the number of logical CPUs (different from physical if hyperthreading is used.)
  60. unsigned GetNumLogicalCPUs();
  61. /// Return the static library init/shutdown mutex.
  62. Mutex& GetStaticMutex();
  63. }