MysticQtConfig.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AzCore/std/string/string.h>
  10. #include <QtCore/QString>
  11. #include <MCore/Source/Config.h>
  12. // when we use DLL files, setup the EMFX_API macro
  13. #if defined(MYSTICQT_DLL_EXPORT)
  14. #define MYSTICQT_API MCORE_EXPORT
  15. #else
  16. #if defined(MYSTICQT_DLL)
  17. #define MYSTICQT_API MCORE_IMPORT
  18. #else
  19. #define MYSTICQT_API
  20. #endif
  21. #endif
  22. // memory categories
  23. enum
  24. {
  25. MEMCATEGORY_MYSTICQT = 1491,
  26. MEMCATEGORY_MYSTICQT_CUSTOMWIDGETS = 1492
  27. };
  28. // convert from a QString into an AZStd::string
  29. MCORE_INLINE AZStd::string FromQtString(const QString& s)
  30. {
  31. return { s.toUtf8().data(), static_cast<size_t>(s.toUtf8().length()) };
  32. }
  33. // convert from a QString into an AZStd::string
  34. MCORE_INLINE void FromQtString(const QString& s, AZStd::string* result)
  35. {
  36. *result = AZStd::string{ s.toUtf8().data(), static_cast<size_t>(s.toUtf8().length()) };
  37. }
  38. inline QString FromStdString(AZStd::string_view s)
  39. {
  40. return QString::fromUtf8(s.data(), static_cast<int>(s.size()));
  41. }
  42. // forward declare a MysticQt class
  43. #define MYSTICQT_FORWARD_DECLARE(className) \
  44. namespace MysticQt { class className; }