COSOperator.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // Copyright (C) 2002-2012 Nikolaus Gebhardt
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #pragma once
  5. #include "IOSOperator.h"
  6. namespace irr
  7. {
  8. class CIrrDeviceLinux;
  9. //! The OSOperator provides OS-specific methods and information.
  10. class COSOperator : public IOSOperator
  11. {
  12. public:
  13. // constructor
  14. #if defined(_IRR_COMPILE_WITH_X11_DEVICE_)
  15. COSOperator(const core::stringc &osversion, CIrrDeviceLinux *device);
  16. #endif
  17. COSOperator(const core::stringc &osversion);
  18. ~COSOperator();
  19. COSOperator(const COSOperator &) = delete;
  20. COSOperator &operator=(const COSOperator &) = delete;
  21. //! Get the current OS version as string.
  22. const core::stringc &getOperatingSystemVersion() const override;
  23. //! Copies text to the clipboard
  24. //! \param text: text in utf-8
  25. void copyToClipboard(const c8 *text) const override;
  26. //! Copies text to the primary selection
  27. //! This is a no-op on some platforms.
  28. //! \param text: text in utf-8
  29. void copyToPrimarySelection(const c8 *text) const override;
  30. //! Get text from the clipboard
  31. //! \return Returns 0 if no string is in there, otherwise an utf-8 string.
  32. const c8 *getTextFromClipboard() const override;
  33. //! Get text from the primary selection
  34. //! This is a no-op on some platforms.
  35. //! \return Returns 0 if no string is in there, otherwise an utf-8 string.
  36. const c8 *getTextFromPrimarySelection() const override;
  37. //! Get the total and available system RAM
  38. /** \param totalBytes: will contain the total system memory in Kilobytes (1024 B)
  39. \param availableBytes: will contain the available memory in Kilobytes (1024 B)
  40. \return True if successful, false if not */
  41. bool getSystemMemory(u32 *Total, u32 *Avail) const override;
  42. private:
  43. core::stringc OperatingSystem;
  44. #if defined(_IRR_COMPILE_WITH_X11_DEVICE_)
  45. CIrrDeviceLinux *IrrDeviceLinux;
  46. #endif
  47. #ifdef _IRR_WINDOWS_API_
  48. mutable core::stringc ClipboardBuf;
  49. #endif
  50. #ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
  51. // These need to be freed with SDL_free
  52. mutable char *ClipboardSelectionText = nullptr;
  53. mutable char *PrimarySelectionText = nullptr;
  54. #endif
  55. };
  56. } // end namespace