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 
7 const char *GetMythSourceVersion()
8 {
9  return MYTH_SOURCE_VERSION;
10 }
11 
12 const 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
26 bool 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: */
GetMythSourceVersion
const char * GetMythSourceVersion()
Definition: mythversion.cpp:7
ParseMythSourceVersion
bool ParseMythSourceVersion(bool &devel, uint &major, uint &minor, const char *version)
Definition: mythversion.cpp:26
minor
#define minor(X)
Definition: compat.h:78
GetMythSourcePath
const char * GetMythSourcePath()
Definition: mythversion.cpp:12
nv_python_libs.bbciplayer.bbciplayer_api.version
string version
Definition: bbciplayer_api.py:77
uint
unsigned int uint
Definition: freesurround.h:24