ʻOhana
Population structure, admixture history, and selection using learning methods.
jade.version.hpp
1 /* -------------------------------------------------------------------------
2  Ohana
3  Copyright (c) 2015-2020 Jade Cheng (\___/)
4  Jade Cheng <info@jade-cheng.com> (='.'=)
5  ------------------------------------------------------------------------- */
6 
7 #ifndef JADE_VERSION_HPP__
8 #define JADE_VERSION_HPP__
9 
10 #include "jade.system.hpp"
11 
12 namespace jade
13 {
14  ///
15  /// A template for a class that displays version and build information.
16  ///
17  template <typename TChar>
18  class basic_version {
19  public:
20  /// The character type.
21  typedef TChar char_type;
22 
23  /// The output stream type.
24  typedef std::basic_ostream<char_type> ostream_type;
25 
26  ///
27  /// Writes the string displayed to the user.
28  ///
29  static void write(
30  char_type const * const title, ///< The program name.
31  ostream_type & out) ///< The output stream.
32  {
33  static const values current { 0, 1, 7666, 41124, 2015, 2020 };
34 
35  out << "ohana/" << title << ' '
36  << current.major << '.'
37  << current.minor << '.'
38  << current.build << '.'
39  << current.revision << std::endl
40  << "Copyright (c) " << current.year_min << "-"
41  << current.year_max << " Jade Cheng" << std::endl
42  << "Jade Cheng <info@jade-cheng.com>" << std::endl;
43  }
44 
45  private:
46  // --------------------------------------------------------------------
47  struct values
48  {
49  int major;
50  int minor;
51  int build;
52  int revision;
53  int year_min;
54  int year_max;
55  };
56  };
57 
58  ///
59  /// A class that displays version and build information.
60  ///
61  typedef basic_version<char> version;
62 }
63 
64 #endif // JADE_VERSION_HPP__
jade::basic_version
A template for a class that displays version and build information.
Definition: jade.version.hpp:18
jade::basic_version::char_type
TChar char_type
The character type.
Definition: jade.version.hpp:21
jade::basic_version::write
static void write(char_type const *const title, ostream_type &out)
Writes the string displayed to the user.
Definition: jade.version.hpp:29
jade::basic_version::ostream_type
std::basic_ostream< char_type > ostream_type
The output stream type.
Definition: jade.version.hpp:24