##// END OF EJS Templates
Ajout du support clang analyser. L'idée est de recompiler le projet avec ninja dans un build dédié pour effectuer l'analyse statique.
Ajout du support clang analyser. L'idée est de recompiler le projet avec ninja dans un build dédié pour effectuer l'analyse statique.

File last commit:

r6:2f8953ec6d3f
r11:50964fafb751
Show More
Version.cpp.in
78 lines | 3.0 KiB | text/plain | TextLexer
#include "Version.h"
/***************************************************
* @SCIQLOP_CMAKE_GENERATION_WARNING@ *
***************************************************/
#include <QtCore/QDateTime>
#include <QtCore/QStringList>
namespace sciqlop {
const char *Version::VERSION_SUFFIX = "@SCIQLOP_VERSION_SUFFIX@";
/**
* From the C99 standard:
* __DATE__: The date of translation of the preprocessing translation unit:
* a character string literal of the form "Mmm dd yyyy", where the names of
* the months are the same as those generated by the asctime function, and
* the first character of dd is a space character if the value is less than
* 10. If the date of translation is not available, an
* implementation-defined valid date shall be supplied.
*/
const char *Version::BUILD_DATE = __DATE__;
/**
* From the C99 standard:
* __TIME__: The time of translation of the preprocessing translation unit:
* a character string literal of the form "hh:mm:ss" as in the time
* generated by the asctime function. If the time of translation is not
* available, an implementation-defined valid time shall be supplied.
*/
const char *Version::BUILD_TIME = __TIME__;
QDateTime Version::buildDateTime()
{
static QDateTime buildDateTime;
if (!buildDateTime.isValid()) {
// Convert BUILD_DATE to a QDate
// The __DATE__ macro return the month name with the asctime() function,
// which doesn't support localization, the month names returned are
// always the same. On the contrary, the "MMM" format on
// QDate::fromString() is localized, so this method can't be used to
// retrieve the month and we must manually do it instead.
QString buildDateStr = QString(BUILD_DATE);
QString buildMonthStr = buildDateStr.left(3);
QString buildDayAndYearStr = buildDateStr.mid(4).trimmed();
QDate buildDate = QDate::fromString(buildDayAndYearStr, "d yyyy");
QStringList monthList = QStringList() << "Jan"
<< "Feb"
<< "Mar"
<< "Apr"
<< "May"
<< "Jun"
<< "Jul"
<< "Aug"
<< "Sep"
<< "Oct"
<< "Nov"
<< "Dec";
for (int i = 0; i < monthList.size(); ++i) {
if (buildMonthStr == monthList.at(i)) {
buildDate.setDate(buildDate.year(), i + 1, buildDate.day());
break;
}
}
// Convert BUILD_TIME to a QTime
QTime buildTime = QTime::fromString(BUILD_TIME, "hh:mm:ss");
// Set the buildDateTime
buildDateTime.setDate(buildDate);
buildDateTime.setTime(buildTime);
}
return buildDateTime;
}
} // namespace sciqlop