@@ -916,6 +916,7 @@ class OurFeatures {
916
916
bool allowNumericKeys_;
917
917
bool allowSingleQuotes_;
918
918
bool failIfExtra_;
919
+ bool rejectDupKeys_;
919
920
int stackLimit_;
920
921
}; // OurFeatures
921
922
@@ -1896,6 +1897,7 @@ CharReader* CharReaderBuilder::newCharReader() const
1896
1897
features.allowSingleQuotes_ = settings_[" allowSingleQuotes" ].asBool ();
1897
1898
features.stackLimit_ = settings_[" stackLimit" ].asInt ();
1898
1899
features.failIfExtra_ = settings_[" failIfExtra" ].asBool ();
1900
+ features.rejectDupKeys_ = settings_[" rejectDupKeys" ].asBool ();
1899
1901
return new OurCharReader (collectComments, features);
1900
1902
}
1901
1903
static void getValidReaderKeys (std::set<std::string>* valid_keys)
@@ -1909,6 +1911,7 @@ static void getValidReaderKeys(std::set<std::string>* valid_keys)
1909
1911
valid_keys->insert (" allowSingleQuotes" );
1910
1912
valid_keys->insert (" stackLimit" );
1911
1913
valid_keys->insert (" failIfExtra" );
1914
+ valid_keys->insert (" rejectDupKeys" );
1912
1915
}
1913
1916
bool CharReaderBuilder::validate (Json::Value* invalid) const
1914
1917
{
@@ -1941,6 +1944,7 @@ void CharReaderBuilder::strictMode(Json::Value* settings)
1941
1944
(*settings)[" allowNumericKeys" ] = false ;
1942
1945
(*settings)[" allowSingleQuotes" ] = false ;
1943
1946
(*settings)[" failIfExtra" ] = true ;
1947
+ (*settings)[" rejectDupKeys" ] = true ;
1944
1948
// ! [CharReaderBuilderStrictMode]
1945
1949
}
1946
1950
// static
@@ -1955,6 +1959,7 @@ void CharReaderBuilder::setDefaults(Json::Value* settings)
1955
1959
(*settings)[" allowSingleQuotes" ] = false ;
1956
1960
(*settings)[" stackLimit" ] = 1000 ;
1957
1961
(*settings)[" failIfExtra" ] = false ;
1962
+ (*settings)[" rejectDupKeys" ] = false ;
1958
1963
// ! [CharReaderBuilderDefaults]
1959
1964
}
1960
1965
0 commit comments