Skip to content

Commit 36dccb8

Browse files
committed
Add version API
1 parent 58c417c commit 36dccb8

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

include/scratchcpp/scratchconfiguration.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ class LIBSCRATCHCPP_EXPORT ScratchConfiguration
4040
static void removeGraphicsEffect(const std::string &name);
4141
static IGraphicsEffect *getGraphicsEffect(const std::string &name);
4242

43+
static const std::string &version();
44+
static int majorVersion();
45+
static int minorVersion();
46+
static int patchVersion();
47+
4348
private:
4449
static const std::vector<std::shared_ptr<IExtension>> getExtensions();
4550

src/scratchconfiguration.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,31 @@ IGraphicsEffect *ScratchConfiguration::getGraphicsEffect(const std::string &name
4949
return it->second.get();
5050
}
5151

52+
/*! Returns the version string of the library. */
53+
const std::string &ScratchConfiguration::version()
54+
{
55+
static const std::string ret = LIBSCRATCHCPP_VERSION;
56+
return ret;
57+
}
58+
59+
/*! Returns the major version of the library. */
60+
int ScratchConfiguration::majorVersion()
61+
{
62+
return LIBSCRATCHCPP_VERSION_MAJOR;
63+
}
64+
65+
/*! Returns the minor version of the library. */
66+
int ScratchConfiguration::minorVersion()
67+
{
68+
return LIBSCRATCHCPP_VERSION_MINOR;
69+
}
70+
71+
/*! Returns the patch version of the library. */
72+
int ScratchConfiguration::patchVersion()
73+
{
74+
return LIBSCRATCHCPP_VERSION_PATCH;
75+
}
76+
5277
const std::vector<std::shared_ptr<IExtension>> ScratchConfiguration::getExtensions()
5378
{
5479
return impl->extensions;

0 commit comments

Comments
 (0)