Add explicit qualifier to single-argument FrozenValue constructors

This commit is contained in:
Tristan Penman 2016-11-07 08:06:29 -08:00
parent 032a8bdcf2
commit 22bf9f2278
6 changed files with 12 additions and 10 deletions

View File

@ -229,7 +229,7 @@ public:
*
* @param source the Json11 value to be copied
*/
Json11FrozenValue(const json11::Json &source)
explicit Json11FrozenValue(const json11::Json &source)
: value(source) { }
virtual FrozenValue * clone() const

View File

@ -225,7 +225,7 @@ public:
*
* @param source the JsonCpp value to be copied
*/
JsonCppFrozenValue(const Json::Value &source)
explicit JsonCppFrozenValue(const Json::Value &source)
: value(source) { }
virtual FrozenValue * clone() const

View File

@ -230,7 +230,7 @@ public:
*
* @param source the NlohmannJson value to be copied
*/
NlohmannJsonFrozenValue(const nlohmann::json &source)
explicit NlohmannJsonFrozenValue(const nlohmann::json &source)
: value(source) { }
virtual FrozenValue * clone() const

View File

@ -75,7 +75,7 @@ public:
* Note that this constructor will throw an exception if the value is not
* an array.
*/
PicoJsonArray(const picojson::value &value)
explicit PicoJsonArray(const picojson::value &value)
: value(value)
{
if (!value.is<picojson::array>()) {
@ -232,7 +232,7 @@ public:
*
* @param source the PicoJson value to be copied
*/
PicoJsonFrozenValue(const picojson::value &source)
explicit PicoJsonFrozenValue(const picojson::value &source)
: value(source) { }
virtual FrozenValue * clone() const

View File

@ -77,7 +77,7 @@ public:
* It is assumed that this value contains array-like data, but this is not
* checked due to runtime cost.
*/
PropertyTreeArray(const boost::property_tree::ptree &array)
explicit PropertyTreeArray(const boost::property_tree::ptree &array)
: array(array) { }
/// Return an iterator for the first element in the array.
@ -217,7 +217,8 @@ public:
*
* @param source string containing the POD vlaue
*/
PropertyTreeFrozenValue(const boost::property_tree::ptree::data_type &source)
explicit PropertyTreeFrozenValue(
const boost::property_tree::ptree::data_type &source)
: value(source) { }
/**
@ -225,7 +226,8 @@ public:
*
* @param source the property tree to be copied
*/
PropertyTreeFrozenValue(const boost::property_tree::ptree &source)
explicit PropertyTreeFrozenValue(
const boost::property_tree::ptree &source)
: value(source) { }
virtual FrozenValue * clone() const

View File

@ -254,12 +254,12 @@ class GenericRapidJsonFrozenValue: public FrozenValue
{
public:
GenericRapidJsonFrozenValue(const char *str)
explicit GenericRapidJsonFrozenValue(const char *str)
{
value.SetString(str, allocator);
}
GenericRapidJsonFrozenValue(const std::string &str)
explicit GenericRapidJsonFrozenValue(const std::string &str)
{
value.SetString(str.c_str(), (unsigned int)str.length(), allocator);
}