Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

clientversion.cpp
Go to the documentation of this file.
1 // Copyright (c) 2012-2014 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include <clientversion.h>
6 
7 #include <tinyformat.h>
8 
9 
15 const std::string CLIENT_NAME("Dash Core");
16 
20 #define CLIENT_VERSION_SUFFIX ""
21 
22 
39 #ifdef HAVE_BUILD_INFO
41 #include <obj/build.h>
42 #endif
43 
45 #ifdef GIT_ARCHIVE
46 #define GIT_COMMIT_ID "$Format:%h$"
47 #define GIT_COMMIT_DATE "$Format:%cD$"
48 #endif
49 
50 #define BUILD_DESC_WITH_SUFFIX(maj, min, rev, build, suffix) \
51  "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-" DO_STRINGIZE(suffix)
52 
53 #define BUILD_DESC_FROM_COMMIT(maj, min, rev, build, commit) \
54  "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-g" commit
55 
56 #define BUILD_DESC_FROM_UNKNOWN(maj, min, rev, build) \
57  "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-unk"
58 
59 #ifndef BUILD_DESC
60 #ifdef BUILD_SUFFIX
61 #define BUILD_DESC BUILD_DESC_WITH_SUFFIX(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, BUILD_SUFFIX)
62 #elif defined(GIT_COMMIT_ID)
63 #define BUILD_DESC BUILD_DESC_FROM_COMMIT(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, GIT_COMMIT_ID)
64 #else
65 #define BUILD_DESC BUILD_DESC_FROM_UNKNOWN(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD)
66 #endif
67 #endif
68 
70 
71 std::string FormatVersion(int nVersion)
72 {
73  if (nVersion % 100 == 0)
74  return strprintf("%d.%d.%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100);
75  else
76  return strprintf("%d.%d.%d.%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100, nVersion % 100);
77 }
78 
79 std::string FormatFullVersion()
80 {
81  return CLIENT_BUILD;
82 }
83 
87 std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments)
88 {
89  std::ostringstream ss;
90  ss << "/";
91  ss << name << ":" << FormatVersion(nClientVersion);
92  if (!comments.empty())
93  {
94  std::vector<std::string>::const_iterator it(comments.begin());
95  ss << "(" << *it;
96  for(++it; it != comments.end(); ++it)
97  ss << "; " << *it;
98  ss << ")";
99  }
100  ss << "/";
101  return ss.str();
102 }
const std::string CLIENT_BUILD(BUILD_DESC CLIENT_VERSION_SUFFIX)
#define strprintf
Definition: tinyformat.h:1066
#define CLIENT_VERSION_SUFFIX
Client version number.
const std::string CLIENT_NAME("Dash Core")
Name of client reported in the &#39;version&#39; message.
std::string FormatVersion(int nVersion)
const char * name
Definition: rest.cpp:36
std::string FormatFullVersion()
#define BUILD_DESC
std::string FormatSubVersion(const std::string &name, int nClientVersion, const std::vector< std::string > &comments)
Format the subversion field according to BIP 14 spec (https://github.com/bitcoin/bips/blob/master/bip...
Released under the MIT license