null -> nullRef

This commit is contained in:
Christopher Dunn 2015-03-03 01:25:33 -06:00
parent 70cd04d49a
commit effd732aa1

View File

@ -882,7 +882,7 @@ Value& Value::operator[](ArrayIndex index) {
if (it != value_.map_->end() && (*it).first == key)
return (*it).second;
ObjectValues::value_type defaultValue(key, null);
ObjectValues::value_type defaultValue(key, nullRef);
it = value_.map_->insert(it, defaultValue);
return (*it).second;
}
@ -899,11 +899,11 @@ const Value& Value::operator[](ArrayIndex index) const {
type_ == nullValue || type_ == arrayValue,
"in Json::Value::operator[](ArrayIndex)const: requires arrayValue");
if (type_ == nullValue)
return null;
return nullRef;
CZString key(index);
ObjectValues::const_iterator it = value_.map_->find(key);
if (it == value_.map_->end())
return null;
return nullRef;
return (*it).second;
}
@ -937,7 +937,7 @@ Value& Value::resolveReference(const char* key) {
if (it != value_.map_->end() && (*it).first == actualKey)
return (*it).second;
ObjectValues::value_type defaultValue(actualKey, null);
ObjectValues::value_type defaultValue(actualKey, nullRef);
it = value_.map_->insert(it, defaultValue);
Value& value = (*it).second;
return value;
@ -957,7 +957,7 @@ Value& Value::resolveReference(char const* key, char const* end)
if (it != value_.map_->end() && (*it).first == actualKey)
return (*it).second;
ObjectValues::value_type defaultValue(actualKey, null);
ObjectValues::value_type defaultValue(actualKey, nullRef);
it = value_.map_->insert(it, defaultValue);
Value& value = (*it).second;
return value;
@ -965,7 +965,7 @@ Value& Value::resolveReference(char const* key, char const* end)
Value Value::get(ArrayIndex index, const Value& defaultValue) const {
const Value* value = &((*this)[index]);
return value == &null ? defaultValue : *value;
return value == &nullRef ? defaultValue : *value;
}
bool Value::isValidIndex(ArrayIndex index) const { return index < size(); }
@ -984,13 +984,13 @@ Value const* Value::find(char const* key, char const* end) const
const Value& Value::operator[](const char* key) const
{
Value const* found = find(key, key + strlen(key));
if (!found) return null;
if (!found) return nullRef;
return *found;
}
Value const& Value::operator[](std::string const& key) const
{
Value const* found = find(key.data(), key.data() + key.length());
if (!found) return null;
if (!found) return nullRef;
return *found;
}
@ -1013,7 +1013,7 @@ Value& Value::operator[](const CppTL::ConstString& key) {
Value const& Value::operator[](CppTL::ConstString const& key) const
{
Value const* found = find(key.c_str(), key.end_c_str());
if (!found) return null;
if (!found) return nullRef;
return *found;
}
#endif
@ -1023,7 +1023,7 @@ Value& Value::append(const Value& value) { return (*this)[size()] = value; }
Value Value::get(char const* key, char const* end, Value const& defaultValue) const
{
const Value* value = &((*this)[key]);
return value == &null ? defaultValue : *value;
return value == &nullRef ? defaultValue : *value;
}
Value Value::get(char const* key, Value const& defaultValue) const
{
@ -1061,7 +1061,7 @@ Value Value::removeMember(const char* key)
JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == objectValue,
"in Json::Value::removeMember(): requires objectValue");
if (type_ == nullValue)
return null;
return nullRef;
Value removed; // null
removeMember(key, key + strlen(key), &removed);
@ -1448,7 +1448,7 @@ const Value& Path::resolve(const Value& root) const {
// Error: unable to resolve path (object value expected at position...)
}
node = &((*node)[arg.key_]);
if (node == &Value::null) {
if (node == &Value::nullRef) {
// Error: unable to resolve path (object has no member named '' at
// position...)
}
@ -1469,7 +1469,7 @@ Value Path::resolve(const Value& root, const Value& defaultValue) const {
if (!node->isObject())
return defaultValue;
node = &((*node)[arg.key_]);
if (node == &Value::null)
if (node == &Value::nullRef)
return defaultValue;
}
}