##// END OF EJS Templates
MultiComponent TS almost done, still blows up when built from python with empty data...
MultiComponent TS almost done, still blows up when built from python with empty data Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>

File last commit:

r0:86b06c4cec3c
r76:9a080a34054c
Show More
Version.cpp
78 lines | 3.0 KiB | text/x-c | CppLexer
#include "Version.h"
/***************************************************
* DON'T CHANGE THIS FILE. AUTOGENERATED BY CMAKE. *
***************************************************/
#include <QtCore/QDateTime>
#include <QtCore/QStringList>
namespace sciqlop {
const char *Version::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