PRCYCoin  2.0.0.7rc1
P2P Digital Currency
clientversion.cpp
Go to the documentation of this file.
1 // Copyright (c) 2012-2014 The Bitcoin 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("PRCY");
16 
20 #define CLIENT_VERSION_SUFFIX ""
21 
22 
39 #ifdef HAVE_BUILD_INFO
41 #include "obj/build.h"
42 #endif
43 
45 #define GIT_ARCHIVE 1
46 #ifdef GIT_ARCHIVE
47 #define GIT_COMMIT_ID "f817001ef362065ac77cab1e39a8657ee4f6174e"
48 #define GIT_COMMIT_DATE "Tue, 10 Dec 2019 01:12:37 +0700"
49 #endif
50 
51 #define BUILD_DESC_WITH_SUFFIX(maj, min, rev, build, suffix) \
52  "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-" DO_STRINGIZE(suffix)
53 
54 #define BUILD_DESC_FROM_COMMIT(maj, min, rev, build, commit) \
55  "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-g" commit
56 
57 #define BUILD_DESC_FROM_UNKNOWN(maj, min, rev, build) \
58  "v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev)
59 
60 #ifndef BUILD_DESC
61 #ifdef BUILD_SUFFIX
62 #define BUILD_DESC BUILD_DESC_WITH_SUFFIX(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, BUILD_SUFFIX)
63 #elif defined(GIT_COMMIT_ID)
64 #define BUILD_DESC BUILD_DESC_FROM_COMMIT(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, GIT_COMMIT_ID)
65 #else
66 #define BUILD_DESC BUILD_DESC_FROM_UNKNOWN(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD)
67 #endif
68 #endif
69 
71 
72 static std::string FormatVersion(int nVersion)
73 {
74  if (nVersion % 100 == 0)
75  return strprintf("%d.%d.%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100);
76  else
77  return strprintf("%d.%d.%d.%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100, nVersion % 100);
78 }
79 
80 std::string FormatFullVersion()
81 {
82  return CLIENT_BUILD;
83 }
84 
88 std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments)
89 {
90  std::ostringstream ss;
91  ss << "/";
92  ss << name << ":" << FormatVersion(nClientVersion);
93  if (!comments.empty()) {
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 }
CLIENT_NAME
const std::string CLIENT_NAME("PRCY")
Name of client reported in the 'version' message.
CLIENT_VERSION_SUFFIX
#define CLIENT_VERSION_SUFFIX
Client version number.
Definition: clientversion.cpp:20
FormatSubVersion
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...
Definition: clientversion.cpp:88
clientversion.h
tinyformat.h
BUILD_DESC
#define BUILD_DESC
Definition: clientversion.cpp:64
name
const char * name
Definition: rest.cpp:34
strprintf
#define strprintf
Definition: tinyformat.h:1056
CLIENT_BUILD
const std::string CLIENT_BUILD(BUILD_DESC CLIENT_VERSION_SUFFIX)
FormatFullVersion
std::string FormatFullVersion()
Definition: clientversion.cpp:80