Merge branch 'master' into schema

# Conflicts:
#	.gitignore
#	include/rapidjson/internal/stack.h
This commit is contained in:
Milo Yip
2016-01-26 15:24:04 +08:00
75 changed files with 3215 additions and 580 deletions

View File

@@ -312,7 +312,7 @@ TEST(Pointer, Parse_URIFragment) {
GenericPointer<GenericValue<UTF16<> > > p(L"#/%C2%A2");
EXPECT_TRUE(p.IsValid());
EXPECT_EQ(1u, p.GetTokenCount());
EXPECT_EQ(0x00A2, p.GetTokens()[0].name[0]);
EXPECT_EQ(static_cast<UTF16<>::Ch>(0x00A2), p.GetTokens()[0].name[0]);
EXPECT_EQ(1u, p.GetTokens()[0].length);
}
@@ -321,7 +321,7 @@ TEST(Pointer, Parse_URIFragment) {
GenericPointer<GenericValue<UTF16<> > > p(L"#/%E2%82%AC");
EXPECT_TRUE(p.IsValid());
EXPECT_EQ(1u, p.GetTokenCount());
EXPECT_EQ(0x20AC, p.GetTokens()[0].name[0]);
EXPECT_EQ(static_cast<UTF16<>::Ch>(0x20AC), p.GetTokens()[0].name[0]);
EXPECT_EQ(1u, p.GetTokens()[0].length);
}
@@ -1462,3 +1462,38 @@ TEST(Pointer, Ambiguity) {
EXPECT_EQ(456, Pointer("/0/1").Get(d)->GetInt());
}
}
// https://github.com/miloyip/rapidjson/issues/483
namespace myjson {
class MyAllocator
{
public:
static const bool kNeedFree = true;
void * Malloc(size_t _size) { return malloc(_size); }
void * Realloc(void *_org_p, size_t _org_size, size_t _new_size) { (void)_org_size; return realloc(_org_p, _new_size); }
static void Free(void *_p) { return free(_p); }
};
typedef rapidjson::GenericDocument<
rapidjson::UTF8<>,
rapidjson::MemoryPoolAllocator< MyAllocator >,
MyAllocator
> Document;
typedef rapidjson::GenericPointer<
::myjson::Document::ValueType,
MyAllocator
> Pointer;
typedef ::myjson::Document::ValueType Value;
}
TEST(Pointer, Issue483) {
std::string mystr, path;
myjson::Document document;
myjson::Value value(rapidjson::kStringType);
value.SetString(mystr.c_str(), static_cast<SizeType>(mystr.length()), document.GetAllocator());
myjson::Pointer(path.c_str()).Set(document, value, document.GetAllocator());
}