Feature friendly names.

This commit is contained in:
JoelKatz
2013-05-30 14:50:14 -07:00
parent 69a904133f
commit 8acb34db91
2 changed files with 20 additions and 12 deletions

View File

@@ -9,6 +9,7 @@ void FeatureTable::addInitialFeatures()
// getCreateFeature. Set any vetoes or defaults. A pointer to the FeatureState can be stashed // getCreateFeature. Set any vetoes or defaults. A pointer to the FeatureState can be stashed
testFeature = getCreateFeature(uint256("1234"), true); testFeature = getCreateFeature(uint256("1234"), true);
testFeature->setFriendlyName("testFeature");
} }
FeatureState* FeatureTable::getCreateFeature(const uint256& featureHash, bool create) FeatureState* FeatureTable::getCreateFeature(const uint256& featureHash, bool create)
@@ -299,6 +300,9 @@ Json::Value FeatureTable::getJson(int)
{ {
Json::Value& v(ret[it.first.GetHex()] = Json::objectValue); Json::Value& v(ret[it.first.GetHex()] = Json::objectValue);
if (!it.second.mFriendlyName.empty())
v["name"] = it.second.mFriendlyName;
v["supported"] = it.second.mSupported; v["supported"] = it.second.mSupported;
if (it.second.mEnabled) if (it.second.mEnabled)

View File

@@ -21,24 +21,28 @@ public:
class FeatureState class FeatureState
{ {
public: public:
bool mVetoed; // We don't want this feature enabled bool mVetoed; // We don't want this feature enabled
bool mEnabled; bool mEnabled;
bool mSupported; bool mSupported;
bool mDefault; // Include in genesis ledger bool mDefault; // Include in genesis ledger
uint32 mFirstMajority; // First time we saw a majority (close time) uint32 mFirstMajority; // First time we saw a majority (close time)
uint32 mLastMajority; // Most recent time we saw a majority (close time) uint32 mLastMajority; // Most recent time we saw a majority (close time)
std::string mFriendlyName;
FeatureState() FeatureState()
: mVetoed(false), mEnabled(false), mSupported(false), mDefault(false), : mVetoed(false), mEnabled(false), mSupported(false), mDefault(false),
mFirstMajority(0), mLastMajority(0) { ; } mFirstMajority(0), mLastMajority(0) { ; }
void setVeto() { mVetoed = true; } void setVeto() { mVetoed = true; }
void setDefault() { mDefault = true; } void setDefault() { mDefault = true; }
bool isDefault() { return mDefault; } bool isDefault() { return mDefault; }
bool isSupported() { return mSupported; } bool isSupported() { return mSupported; }
bool isVetoed() { return mVetoed; } bool isVetoed() { return mVetoed; }
bool isEnabled() { return mEnabled; } bool isEnabled() { return mEnabled; }
const std::string& getFiendlyName() { return mFriendlyName; }
void setFriendlyName(const std::string& n) { mFriendlyName = n; }
}; };