From 9c658f9a1107b1879b87aa53dbb1dab60668e2b5 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Thu, 15 Feb 2018 22:20:25 +0100 Subject: Move version information to constants The previous approach of preprocessor definitions was not really sound as these are only present during the compilation of sqlitepp. Therefore the version information is now stored in constants within the sqlitepp namespace. --- Makefile | 2 +- include/sqlitepp/sqlitepp.h | 22 +++++++--------------- src/sqlitepp.cpp | 8 ++++++++ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 14531ae..34bee3b 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ CPPFLAGS += -MMD -MP -I$(INCLUDE_DIR) CPPFLAGS += -DSQLITEPP_VERSION_MAJOR=$(VERSION_MAJOR) \ -DSQLITEPP_VERSION_MINOR=$(VERSION_MINOR) \ -DSQLITEPP_VERSION_PATCH=$(VERSION_PATCH) \ - -DSQLITEPP_VERSION=$(VERSION) + -DSQLITEPP_VERSION=\"$(VERSION)\" CXXFLAGS += -fPIC LDFLAGS += $(LDFLAGS_SQLITE3) LDFLAGS_LIB += -Wl,-soname,lib$(TARGET_NAME_LIB).so.$(VERSION_MAJOR) diff --git a/include/sqlitepp/sqlitepp.h b/include/sqlitepp/sqlitepp.h index 82f4f99..d75aa91 100644 --- a/include/sqlitepp/sqlitepp.h +++ b/include/sqlitepp/sqlitepp.h @@ -105,28 +105,20 @@ /// are destroyed. You can force them to free their resources using the /// `close` methods. -#ifndef SQLITEPP_VERSION_MAJOR +/// \brief Contains all classes of the sqlitepp library. +namespace sqlitepp { + /// \brief The major version of sqlitepp (part x of version number x.y.z). -#define SQLITEPP_VERSION_MAJOR 0 -#endif +extern const unsigned int VERSION_MAJOR; -#ifndef SQLITEPP_VERSION_MINOR /// \brief The minor version of sqlitepp (part y of version number x.y.z). -#define SQLITEPP_VERSION_MINOR 0 -#endif +extern const unsigned int VERSION_MINOR; -#ifndef SQLITEPP_VERSION_PATCH /// \brief The patch version of sqlitepp (part z of version number x.y.z). -#define SQLITEPP_VERSION_PATCH 0 -#endif +extern const unsigned int VERSION_PATCH; -#ifndef SQLITEPP_VERSION /// \brief The sqlitepp version in the format MAJOR.MINOR.PATCH. -#define SQLITEPP_VERSION "0.0.0" -#ifndef - -/// \brief Contains all classes of the sqlitepp library. -namespace sqlitepp { +extern const std::string VERSION; /// \brief A class that forbids copying and assignments for all subclasses. /// diff --git a/src/sqlitepp.cpp b/src/sqlitepp.cpp index 10315e5..fa35b30 100644 --- a/src/sqlitepp.cpp +++ b/src/sqlitepp.cpp @@ -9,6 +9,14 @@ namespace sqlitepp { +const unsigned int VERSION_MAJOR = SQLITEPP_VERSION_MAJOR; + +const unsigned int VERSION_MINOR = SQLITEPP_VERSION_MINOR; + +const unsigned int VERSION_PATCH = SQLITEPP_VERSION_PATCH; + +const std::string VERSION = SQLITEPP_VERSION; + Openable::Openable(const bool open, const std::string& name) : m_open(open), m_name(name) { } -- cgit v1.2.3