Botan  1.11.15
src/lib/utils/version.h
Go to the documentation of this file.
00001 /*
00002 * Version Information
00003 * (C) 1999-2011 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_VERSION_H__
00009 #define BOTAN_VERSION_H__
00010 
00011 #include <botan/types.h>
00012 #include <string>
00013 
00014 namespace Botan {
00015 
00016 /*
00017 * Get information describing the version
00018 */
00019 
00020 /**
00021 * Get a human-readable string identifying the version of Botan.
00022 * No particular format should be assumed.
00023 * @return version string
00024 */
00025 BOTAN_DLL std::string version_string();
00026 
00027 BOTAN_DLL const char* version_cstr();
00028 
00029 /**
00030 * Return the date this version of botan was released, in an integer of
00031 * the form YYYYMMDD. For instance a version released on May 21, 2013
00032 * would return the integer 20130521. If the currently running version
00033 * is not an official release, this function will return 0 instead.
00034 *
00035 * @return release date, or zero if unreleased
00036 */
00037 BOTAN_DLL u32bit version_datestamp();
00038 
00039 /**
00040 * Get the major version number.
00041 * @return major version number
00042 */
00043 BOTAN_DLL u32bit version_major();
00044 
00045 /**
00046 * Get the minor version number.
00047 * @return minor version number
00048 */
00049 BOTAN_DLL u32bit version_minor();
00050 
00051 /**
00052 * Get the patch number.
00053 * @return patch number
00054 */
00055 BOTAN_DLL u32bit version_patch();
00056 
00057 /*
00058 * Macros for compile-time version checks
00059 */
00060 #define BOTAN_VERSION_CODE_FOR(a,b,c) ((a << 16) | (b << 8) | (c))
00061 
00062 /**
00063 * Compare using BOTAN_VERSION_CODE_FOR, as in
00064 *  # if BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,8,0)
00065 *  #    error "Botan version too old"
00066 *  # endif
00067 */
00068 #define BOTAN_VERSION_CODE BOTAN_VERSION_CODE_FOR(BOTAN_VERSION_MAJOR, \
00069                                                   BOTAN_VERSION_MINOR, \
00070                                                   BOTAN_VERSION_PATCH)
00071 
00072 }
00073 
00074 #endif