BsPlatformUtility.h 2.3 KB

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