Skip to content

Commit fbf7efb

Browse files
committed
masternodeconfig files code styling cleanup.
1 parent 8a07010 commit fbf7efb

File tree

2 files changed

+16
-74
lines changed

2 files changed

+16
-74
lines changed

src/masternodeconfig.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) 2014-2015 The Dash developers
22
// Copyright (c) 2015-2019 The PIVX developers
3-
// Distributed under the MIT/X11 software license, see the accompanying
4-
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
3+
// Distributed under the MIT software license, see the accompanying
4+
// file COPYING or https://www.opensource.org/licenses/mit-license.php.
55

66
#include "netbase.h"
77
#include "masternodeconfig.h"

src/masternodeconfig.h

Lines changed: 14 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) 2014-2015 The Dash developers
22
// Copyright (c) 2015-2019 The PIVX developers
3-
// Distributed under the MIT/X11 software license, see the accompanying
4-
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
3+
// Distributed under the MIT software license, see the accompanying
4+
// file COPYING or https://www.opensource.org/licenses/mit-license.php.
55

66
#ifndef SRC_MASTERNODECONFIG_H_
77
#define SRC_MASTERNODECONFIG_H_
@@ -11,7 +11,6 @@
1111
#include <string>
1212
#include <vector>
1313

14-
1514
class CMasternodeConfig;
1615
extern CMasternodeConfig masternodeConfig;
1716

@@ -28,88 +27,31 @@ class CMasternodeConfig
2827
std::string outputIndex;
2928

3029
public:
31-
CMasternodeEntry(std::string alias, std::string ip, std::string privKey, std::string txHash, std::string outputIndex)
32-
{
33-
this->alias = alias;
34-
this->ip = ip;
35-
this->privKey = privKey;
36-
this->txHash = txHash;
37-
this->outputIndex = outputIndex;
38-
}
39-
40-
const std::string& getAlias() const
41-
{
42-
return alias;
43-
}
44-
45-
void setAlias(const std::string& alias)
46-
{
47-
this->alias = alias;
48-
}
49-
50-
const std::string& getOutputIndex() const
51-
{
52-
return outputIndex;
53-
}
30+
CMasternodeEntry(std::string& _alias, std::string& _ip, std::string& _privKey, std::string& _txHash, std::string& _outputIndex) :
31+
alias(_alias), ip(_ip), privKey(_privKey), txHash(_txHash), outputIndex(_outputIndex) { }
5432

33+
const std::string& getAlias() const { return alias; }
34+
const std::string& getOutputIndex() const { return outputIndex; }
5535
bool castOutputIndex(int& n) const;
56-
57-
void setOutputIndex(const std::string& outputIndex)
58-
{
59-
this->outputIndex = outputIndex;
60-
}
61-
62-
const std::string& getPrivKey() const
63-
{
64-
return privKey;
65-
}
66-
67-
void setPrivKey(const std::string& privKey)
68-
{
69-
this->privKey = privKey;
70-
}
71-
72-
const std::string& getTxHash() const
73-
{
74-
return txHash;
75-
}
76-
77-
void setTxHash(const std::string& txHash)
78-
{
79-
this->txHash = txHash;
80-
}
81-
82-
const std::string& getIp() const
83-
{
84-
return ip;
85-
}
86-
87-
void setIp(const std::string& ip)
88-
{
89-
this->ip = ip;
90-
}
36+
const std::string& getPrivKey() const { return privKey; }
37+
const std::string& getTxHash() const { return txHash; }
38+
const std::string& getIp() const { return ip; }
9139
};
9240

93-
CMasternodeConfig()
94-
{
95-
entries = std::vector<CMasternodeEntry>();
96-
}
41+
CMasternodeConfig() { entries = std::vector<CMasternodeEntry>(); }
9742

98-
void clear();
43+
void clear() { entries.clear(); }
9944
bool read(std::string& strErr);
10045
CMasternodeConfig::CMasternodeEntry* add(std::string alias, std::string ip, std::string privKey, std::string txHash, std::string outputIndex);
10146
void remove(std::string alias);
10247

103-
std::vector<CMasternodeEntry>& getEntries()
104-
{
105-
return entries;
106-
}
48+
std::vector<CMasternodeEntry>& getEntries() { return entries; }
10749

10850
int getCount()
10951
{
11052
int c = -1;
111-
for (CMasternodeEntry e : entries) {
112-
if (e.getAlias() != "") c++;
53+
for (const auto& e : entries) {
54+
if (!e.getAlias().empty()) c++;
11355
}
11456
return c;
11557
}

0 commit comments

Comments
 (0)