Skip to content

Commit

Permalink
RESTINIO_VERSION and related macros added.
Browse files Browse the repository at this point in the history
  • Loading branch information
eao197 committed Aug 28, 2019
1 parent 640c66d commit 5532a36
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev/restinio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ SET(RESTINIO_HEADERS_ALL
uri_helpers.hpp
value_or.hpp
variant.hpp
version.hpp
tls_fwd.hpp
impl/acceptor.hpp
impl/connection_base.hpp
Expand Down
2 changes: 2 additions & 0 deletions dev/restinio/all.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#pragma once

#include <restinio/version.hpp>

#include <restinio/asio_include.hpp>
#include <restinio/settings.hpp>
#include <restinio/http_headers.hpp>
Expand Down
64 changes: 64 additions & 0 deletions dev/restinio/version.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* RESTinio
*/

/*!
* @file
* @brief Definition of RESTINIO_VERSION macro
*
* @since v.0.6.0
*/

#pragma once

// The current version is 0.6.0
//
/*!
* The major part of version number.
*
* If RESTinio's version is 0.6.0 then RESTINIO_VERSION_MAJOR==0.
* If RESTinio's version is 1.2.4 then RESTINIO_VERSION_MAJOR==1.
*/
#define RESTINIO_VERSION_MAJOR 0ull

/*!
* The minon part of version number.
*
* If RESTinio's version is 0.6.0 then RESTINIO_VERSION_MINOR==6.
*/
#define RESTINIO_VERSION_MINOR 6ull

/*!
* The patch part of version number.
*
* If RESTinio's version is 0.6.23 then RESTINIO_VERSION_PATCH==23.
*/
#define RESTINIO_VERSION_PATCH 0ull

/*!
* Helper macro for make single number representation of RESTinio's version.
*
* It can be used that way:
* \code
* // Some feature is available only from 1.2.4
* #if RESTINIO_VERSION >= RESTINIO_VERSION_MAKE(1, 2, 4)
* ... // Some 1.2.4 (or above) specific code.
* #endif
* \endcode
*/
#define RESTINIO_VERSION_MAKE(major, minor, patch) \
(((major) * 1000000ull) + \
((minor) * 1000ull) + \
(patch))

/*!
* A single number representation of RESTinio version.
*
* For example it can be 6003ull for RESTinio-0.6.3.
* Or 1004023ull for RESTinio-1.4.23.
*/
#define RESTINIO_VERSION RESTINIO_VERSION_MAKE( \
RESTINIO_VERSION_MAJOR,\
RESTINIO_VERSION_MINOR,\
RESTINIO_VERSION_PATCH)

0 comments on commit 5532a36

Please sign in to comment.