StdInc.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * StdInc.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../Global.h"
  12. #define VCMI_EDITOR_NAME "VCMI Map Editor"
  13. #include <QtWidgets>
  14. #include <QStringList>
  15. #include <QSet>
  16. #include <QVector>
  17. #include <QList>
  18. #include <QString>
  19. #include <QFile>
  20. #include "../vcmiqt/convpathqstring.h"
  21. VCMI_LIB_USING_NAMESPACE
  22. using NumericPointer = typename std::conditional_t<sizeof(void *) == sizeof(unsigned long long),
  23. unsigned long long, unsigned int>;
  24. template<class Type>
  25. NumericPointer data_cast(Type * _pointer)
  26. {
  27. static_assert(sizeof(Type *) == sizeof(NumericPointer),
  28. "Cannot compile for that architecture, see NumericPointer definition");
  29. return reinterpret_cast<NumericPointer>(_pointer);
  30. }
  31. template<class Type>
  32. Type * data_cast(NumericPointer _numeric)
  33. {
  34. static_assert(sizeof(Type *) == sizeof(NumericPointer),
  35. "Cannot compile for that architecture, see NumericPointer definition");
  36. return reinterpret_cast<Type *>(_numeric);
  37. }