Skip to content

Commit 6c8855b

Browse files
committed
Add version API
1 parent aebe016 commit 6c8855b

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

include/scratchcpp-render/scratchcpp-render.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,25 @@
22

33
#pragma once
44

5+
#include <string>
6+
57
/*! \brief The main namespace of the library. */
68
namespace scratchcpprender
79
{
810

911
/*! Initializes the library. Call this from main before constructing your Q(Gui)Application object. */
1012
void init();
1113

14+
/*! Returns the version string of the library. */
15+
const std::string &version();
16+
17+
/*! Returns the major version of the library. */
18+
int majorVersion();
19+
20+
/*! Returns the minor version of the library. */
21+
int minorVersion();
22+
23+
/*! Returns the patch version of the library. */
24+
int patchVersion();
25+
1226
} // namespace scratchcpprender

src/global_functions.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,24 @@ void scratchcpprender::init()
88
qputenv("QSG_RENDER_LOOP", "basic");
99
QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
1010
}
11+
12+
const std::string &scratchcpprender::version()
13+
{
14+
static const std::string ret = SCRATCHCPPRENDER_VERSION;
15+
return ret;
16+
}
17+
18+
int scratchcpprender::majorVersion()
19+
{
20+
return SCRATCHCPPRENDER_VERSION_MAJOR;
21+
}
22+
23+
int scratchcpprender::minorVersion()
24+
{
25+
return SCRATCHCPPRENDER_VERSION_MINOR;
26+
}
27+
28+
int scratchcpprender::patchVersion()
29+
{
30+
return SCRATCHCPPRENDER_VERSION_PATCH;
31+
}

0 commit comments

Comments
 (0)