Skip to content
Permalink
Browse files

Merge 123d7c8 into 2648a73

  • Loading branch information...
AtnNn committed Sep 12, 2019
2 parents 2648a73 + 123d7c8 commit 0fc8334194cbc0faf012786b2379aee9ebd0448d
Showing with 6 additions and 3 deletions.
  1. +3 −3 include/rapidjson/pointer.h
  2. +3 −0 test/unittest/pointertest.cpp
@@ -488,7 +488,7 @@ class GenericPointer {
v = &((*v)[t->index]);
}
else {
typename ValueType::MemberIterator m = v->FindMember(GenericStringRef<Ch>(t->name, t->length));
typename ValueType::MemberIterator m = v->FindMember(GenericValue<EncodingType>(GenericStringRef<Ch>(t->name, t->length)));
if (m == v->MemberEnd()) {
v->AddMember(ValueType(t->name, t->length, allocator).Move(), ValueType().Move(), allocator);
v = &(--v->MemberEnd())->value; // Assumes AddMember() appends at the end
@@ -543,7 +543,7 @@ class GenericPointer {
switch (v->GetType()) {
case kObjectType:
{
typename ValueType::MemberIterator m = v->FindMember(GenericStringRef<Ch>(t->name, t->length));
typename ValueType::MemberIterator m = v->FindMember(GenericValue<EncodingType>(GenericStringRef<Ch>(t->name, t->length)));
if (m == v->MemberEnd())
break;
v = &m->value;
@@ -779,7 +779,7 @@ class GenericPointer {
switch (v->GetType()) {
case kObjectType:
{
typename ValueType::MemberIterator m = v->FindMember(GenericStringRef<Ch>(t->name, t->length));
typename ValueType::MemberIterator m = v->FindMember(GenericValue<EncodingType>(GenericStringRef<Ch>(t->name, t->length)));
if (m == v->MemberEnd())
return false;
v = &m->value;
@@ -674,6 +674,9 @@ TEST(Pointer, Get) {
EXPECT_EQ(2u, unresolvedTokenIndex);
EXPECT_TRUE(Pointer("/foo/0/a").Get(d, &unresolvedTokenIndex) == 0); // "/foo/0" is an string, cannot further query
EXPECT_EQ(2u, unresolvedTokenIndex);

Pointer::Token tokens[] = { { "foo ...", 3, kPointerInvalidIndex } };
EXPECT_EQ(&d["foo"], Pointer(tokens, 1).Get(d));
}

TEST(Pointer, GetWithDefault) {

0 comments on commit 0fc8334

Please sign in to comment.
You can’t perform that action at this time.