MythTV master
mythversion.cpp
Go to the documentation of this file.
1#include "mythversion.h"
2
3#include "version.h"
4
5#include <QRegularExpression>
6
8{
9 return MYTH_SOURCE_VERSION;
10}
11
12const char *GetMythSourcePath()
13{
14 return MYTH_SOURCE_PATH;
15}
16
17// Require major version. Optional minor and point versions. Optional
18// '-pre' tag. If present, must be in this order.
19//
20// Match 1: major
21// Match 2: .minor
22// Match 3: minor
23// Match 4: .point
24// Match 5: point
25// Match 6: -pre
26bool ParseMythSourceVersion(bool& devel, uint& major, uint& minor, const char *version)
27{
28 static const QRegularExpression themeparts
29 { R"(\Av([0-9]+)(\.([0-9]+))?(\.([0-9]+))?(-pre)?)",
30 QRegularExpression::CaseInsensitiveOption };
31
32 if (nullptr == version)
33 version = MYTH_SOURCE_VERSION;
34 auto match = themeparts.match(version);
35 if (!match.isValid() || !match.hasMatch())
36 return false;
37 devel = !match.captured(6).isEmpty();
38 major = match.captured(1).toUInt();
39 minor = match.captured(3).toUInt();
40 return true;
41}
42
43/* vim: set expandtab tabstop=4 shiftwidth=4: */
#define minor(X)
Definition: compat.h:74
unsigned int uint
Definition: freesurround.h:24
const char * GetMythSourceVersion()
Definition: mythversion.cpp:7
bool ParseMythSourceVersion(bool &devel, uint &major, uint &minor, const char *version)
Definition: mythversion.cpp:26
const char * GetMythSourcePath()
Definition: mythversion.cpp:12
string version
Definition: giantbomb.py:185