19 #define RAPIDJSON_NAMESPACE my::rapid::json 20 #define RAPIDJSON_NAMESPACE_BEGIN namespace my { namespace rapid { namespace json { 21 #define RAPIDJSON_NAMESPACE_END } } } 32 static const char json[] =
"{\"hello\":\"world\",\"t\":true,\"f\":false,\"n\":null,\"i\":123,\"pi\":3.1416,\"a\":[1,2,3,4]}";
34 TEST(NamespaceTest,Using) {
40 EXPECT_TRUE(!doc.HasParseError());
43 TEST(NamespaceTest,Direct) {
48 typedef RAPIDJSON_NAMESPACE::Writer<StringBuffer> WriterType;
52 WriterType writer(buffer);
55 reader.
Parse(s, writer);
59 EXPECT_TRUE(writer.IsComplete());
63 EXPECT_TRUE(!doc.HasParseError());
69 EXPECT_TRUE(writer.IsComplete());
GenericReader< UTF8< char >, UTF8< char >, CrtAllocator > Reader
size_t GetSize() const
Get the size of string in bytes in the string buffer.
ParseResult Parse(InputStream &is, Handler &handler)
Parse JSON text.
const Ch * GetString() const
#define RAPIDJSON_NAMESPACE
TEST(NamespaceTest, Using)
A document for parsing JSON text as DOM.
GenericDocument< UTF8<> > Document
GenericDocument with UTF8 encoding.
GenericStringStream< UTF8< char > > StringStream
GenericStringBuffer< UTF8< char >, CrtAllocator > StringBuffer
C-runtime library allocator.