1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00
vcmi/mapeditor/StdInc.h
Johannes Schauer Marin Rodrigues a1a5bc28c2
convert line endings from CRLF (Windows) to LF (Linux/Unix)
Mixed line endings cause problems when exporting patches with
git-format-patch and then trying to "git am" a patch with mixed and
non-matching line endings. In such a situation git will fail to apply
the patch.

This commit runs the dos2unix tools on the remaining files with CRLF
(\r\n) line endings to convert them to line-feeds (\n) only.

Files that are Windows specific like *.vcxproj and *.props files were
not converted.

Closes: #3073
2023-10-19 16:23:21 +02:00

56 lines
1.3 KiB
C++

#pragma once
#include "../Global.h"
#define VCMI_EDITOR_VERSION "0.2"
#define VCMI_EDITOR_NAME "VCMI Map Editor"
#include <QtWidgets>
#include <QStringList>
#include <QSet>
#include <QVector>
#include <QList>
#include <QString>
#include <QFile>
VCMI_LIB_USING_NAMESPACE
using NumericPointer = typename std::conditional<sizeof(void *) == sizeof(unsigned long long),
unsigned long long, unsigned int>::type;
template<class Type>
NumericPointer data_cast(Type * _pointer)
{
static_assert(sizeof(Type *) == sizeof(NumericPointer),
"Cannot compile for that architecture, see NumericPointer definition");
return reinterpret_cast<NumericPointer>(_pointer);
}
template<class Type>
Type * data_cast(NumericPointer _numeric)
{
static_assert(sizeof(Type *) == sizeof(NumericPointer),
"Cannot compile for that architecture, see NumericPointer definition");
return reinterpret_cast<Type *>(_numeric);
}
inline QString pathToQString(const boost::filesystem::path & path)
{
#ifdef VCMI_WINDOWS
return QString::fromStdWString(path.wstring());
#else
return QString::fromStdString(path.string());
#endif
}
inline boost::filesystem::path qstringToPath(const QString & path)
{
#ifdef VCMI_WINDOWS
return boost::filesystem::path(path.toStdWString());
#else
return boost::filesystem::path(path.toUtf8().data());
#endif
}