BsPlatformUtility.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsPlatformDefines.h"
  5. #include "BsString.h"
  6. #include "BsTypes.h"
  7. namespace BansheeEngine
  8. {
  9. /** @addtogroup General
  10. * @{
  11. */
  12. struct MACAddress;
  13. /** Possible type of platform file dialogs. */
  14. enum class FileDialogType
  15. {
  16. OpenFile = 0x0,
  17. OpenFolder = 0x1,
  18. Save = 0x2,
  19. Multiselect = 0x10000,
  20. TypeMask = 0xFFFF
  21. };
  22. /** Provides access to various operating system specific utility functions. */
  23. class BS_UTILITY_EXPORT PlatformUtility
  24. {
  25. public:
  26. /**
  27. * Terminates the current process.
  28. *
  29. * @param[in] force True if the process should be forcefully terminated with no cleanup.
  30. */
  31. static void terminate(bool force = false);
  32. /**
  33. * Adds a string to the clipboard.
  34. *
  35. * @note Thread safe.
  36. */
  37. static void copyToClipboard(const WString& string);
  38. /**
  39. * Reads a string from the clipboard and returns it. If there is no string in the clipboard it returns an empty
  40. * string.
  41. *
  42. * @note
  43. * Both wide and normal strings will be read, but normal strings will be converted to a wide string before returning.
  44. * @note
  45. * Thread safe.
  46. */
  47. static WString copyFromClipboard();
  48. /**
  49. * Converts a keyboard key-code to a Unicode character.
  50. *
  51. * @note
  52. * Normally this will output a single character, but it can happen it outputs multiple in case a accent/diacritic
  53. * character could not be combined with the virtual key into a single character.
  54. */
  55. static WString keyCodeToUnicode(UINT32 keyCode);
  56. /**
  57. * Populates the provided buffer with a MAC address of the first available adapter, if one exists. If no adapters
  58. * exist, returns false.
  59. */
  60. static bool getMACAddress(MACAddress& address);
  61. /** Creates a new universally unique identifier and returns it as a string. */
  62. static String generateUUID();
  63. /**
  64. * Opens the provided file or folder using the default application for that file type, as specified by the operating
  65. * system.
  66. *
  67. * @param[in] path Absolute path to the file or folder to open.
  68. */
  69. static void open(const Path& path);
  70. };
  71. /** Represents a MAC (ethernet) address. */
  72. struct MACAddress
  73. {
  74. UINT8 value[6];
  75. };
  76. /** @} */
  77. }