From: Wolfgang Bangerth Date: Sat, 10 Mar 2018 05:34:58 +0000 (-0700) Subject: Provide a function that returns the version string. X-Git-Tag: v9.0.0-rc1~342^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb8b8c5631087f8e6db1a11ca24535080df2dbbe;p=dealii.git Provide a function that returns the version string. --- diff --git a/include/deal.II/base/utilities.h b/include/deal.II/base/utilities.h index d6009340f5..fd1399f83c 100644 --- a/include/deal.II/base/utilities.h +++ b/include/deal.II/base/utilities.h @@ -61,6 +61,13 @@ DEAL_II_NAMESPACE_OPEN */ namespace Utilities { + /** + * Return a string of the form "deal.II version x.y.z" where "x.y.z" + * identifies the version of deal.II you are using. This information + * is also provided by the DEAL_II_PACKAGE_NAME and + * DEAL_II_PACKAGE_VERSION preprocessor variables. + */ + std::string dealii_version_string (); /** * Convert a number @p value to a string, with as many digits as given to diff --git a/source/base/utilities.cc b/source/base/utilities.cc index 6a1f250b8d..a192cfc3ab 100644 --- a/source/base/utilities.cc +++ b/source/base/utilities.cc @@ -85,12 +85,23 @@ namespace Utilities << "Can't convert the string " << arg1 << " to the desired type"); + + std::string + dealii_version_string () + { + return DEAL_II_PACKAGE_NAME " version " DEAL_II_PACKAGE_VERSION; + } + + + std::string int_to_string (const unsigned int value, const unsigned int digits) { return to_string(value,digits); } + + template std::string to_string (const number value, const unsigned int digits)