| 1 | // ************************************************************************** | 
|---|
| 2 | /** @namespace FACT | 
|---|
| 3 |  | 
|---|
| 4 | @brief Namespace to help with some general things in the program initialization | 
|---|
| 5 |  | 
|---|
| 6 | */ | 
|---|
| 7 | // ************************************************************************** | 
|---|
| 8 | #include "FACT.h" | 
|---|
| 9 |  | 
|---|
| 10 | #include <iostream> | 
|---|
| 11 |  | 
|---|
| 12 | #include <boost/version.hpp> | 
|---|
| 13 | #include <boost/filesystem.hpp> | 
|---|
| 14 |  | 
|---|
| 15 | // -------------------------------------------------------------------------- | 
|---|
| 16 | // | 
|---|
| 17 | //! Print version information about FACT++ | 
|---|
| 18 | //! | 
|---|
| 19 | //! From help2man: | 
|---|
| 20 | //! | 
|---|
| 21 | //! The first line of the --version information is assumed to be in one | 
|---|
| 22 | //! of the following formats: | 
|---|
| 23 | //! | 
|---|
| 24 | //! \verbatim | 
|---|
| 25 | //!  - <version> | 
|---|
| 26 | //!  - <program> <version> | 
|---|
| 27 | //!  - {GNU,Free} <program> <version> | 
|---|
| 28 | //!  - <program> ({GNU,Free} <package>) <version> | 
|---|
| 29 | //!  - <program> - {GNU,Free} <package> <version> | 
|---|
| 30 | //! \endverbatim | 
|---|
| 31 | //! | 
|---|
| 32 | //!  and separated from any copyright/author details by a blank line. | 
|---|
| 33 | //! | 
|---|
| 34 | //! Handle multi-line bug reporting sections of the form: | 
|---|
| 35 | //! | 
|---|
| 36 | //! \verbatim | 
|---|
| 37 | //!  - Report <program> bugs to <addr> | 
|---|
| 38 | //!  - GNU <package> home page: <url> | 
|---|
| 39 | //!  - ... | 
|---|
| 40 | //! \endverbatim | 
|---|
| 41 | //! | 
|---|
| 42 | //! @param name | 
|---|
| 43 | //!     name of the program (usually argv[0]). A possible leading "lt-" | 
|---|
| 44 | //!     is removed. | 
|---|
| 45 | //! | 
|---|
| 46 | void FACT::PrintVersion(const char *name) | 
|---|
| 47 | { | 
|---|
| 48 | #if BOOST_VERSION < 104600 | 
|---|
| 49 | const std::string n = boost::filesystem::path(name).filename(); | 
|---|
| 50 | #else | 
|---|
| 51 | const std::string n = boost::filesystem::path(name).filename().string(); | 
|---|
| 52 | #endif | 
|---|
| 53 |  | 
|---|
| 54 | std::cout << | 
|---|
| 55 | n << " - "PACKAGE_STRING"\n" | 
|---|
| 56 | "\n" | 
|---|
| 57 | "Written by Thomas Bretz et al.\n" | 
|---|
| 58 | "\n" | 
|---|
| 59 | "Report bugs to <"PACKAGE_BUGREPORT">\n" | 
|---|
| 60 | "Home page: "PACKAGE_URL"\n" | 
|---|
| 61 | "\n" | 
|---|
| 62 | "Copyright (C) 2011 by the FACT Collaboration.\n" | 
|---|
| 63 | "This is free software; see the source for copying conditions.\n" | 
|---|
| 64 | << std::endl; | 
|---|
| 65 | } | 
|---|