fwdtest.cpp
Go to the documentation of this file.
1 // Tencent is pleased to support the open source community by making RapidJSON available.
2 //
3 // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
4 //
5 // Licensed under the MIT License (the "License"); you may not use this file except
6 // in compliance with the License. You may obtain a copy of the License at
7 //
8 // http://opensource.org/licenses/MIT
9 //
10 // Unless required by applicable law or agreed to in writing, software distributed
11 // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 // specific language governing permissions and limitations under the License.
14 
15 #include "unittest.h"
16 
17 // Using forward declared types here.
18 
19 #include "rapidjson/fwd.h"
20 
21 #ifdef __GNUC__
22 RAPIDJSON_DIAG_PUSH
23 RAPIDJSON_DIAG_OFF(effc++)
24 #endif
25 
26 using namespace rapidjson;
27 
28 struct Foo {
29  Foo();
30  ~Foo();
31 
32  // encodings.h
43 
44  // allocators.h
47 
48  // stream.h
51 
52  // stringbuffer.h
54 
55  // // filereadstream.h
56  // FileReadStream* filereadstream;
57 
58  // // filewritestream.h
59  // FileWriteStream* filewritestream;
60 
61  // memorybuffer.h
63 
64  // memorystream.h
66 
67  // reader.h
70 
71  // writer.h
73 
74  // prettywriter.h
75  PrettyWriter<StringBuffer, UTF8<char>, UTF8<char>, CrtAllocator, 0>* prettywriter;
76 
77  // document.h
80 
81  // pointer.h
83 
84  // schema.h
87 
88  // char buffer[16];
89 };
90 
91 // Using type definitions here.
92 
93 #include "rapidjson/stringbuffer.h"
96 #include "rapidjson/memorybuffer.h"
97 #include "rapidjson/memorystream.h"
98 #include "rapidjson/document.h" // -> reader.h
99 #include "rapidjson/writer.h"
100 #include "rapidjson/prettywriter.h"
101 #include "rapidjson/schema.h" // -> pointer.h
102 
105 
107  // encodings.h
108  utf8(RAPIDJSON_NEW(UTF8<>)),
109  utf16(RAPIDJSON_NEW(UTF16<>)),
110  utf16be(RAPIDJSON_NEW(UTF16BE<>)),
111  utf16le(RAPIDJSON_NEW(UTF16LE<>)),
112  utf32(RAPIDJSON_NEW(UTF32<>)),
113  utf32be(RAPIDJSON_NEW(UTF32BE<>)),
114  utf32le(RAPIDJSON_NEW(UTF32LE<>)),
115  ascii(RAPIDJSON_NEW(ASCII<>)),
116  autoutf(RAPIDJSON_NEW(AutoUTF<unsigned>)),
117  transcoder(RAPIDJSON_NEW(TranscoderUtf8ToUtf8)),
118 
119  // allocators.h
120  crtallocator(RAPIDJSON_NEW(CrtAllocator)),
121  memorypoolallocator(RAPIDJSON_NEW(MemoryPoolAllocator<>)),
122 
123  // stream.h
124  stringstream(RAPIDJSON_NEW(StringStream)(NULL)),
125  insitustringstream(RAPIDJSON_NEW(InsituStringStream)(NULL)),
126 
127  // stringbuffer.h
128  stringbuffer(RAPIDJSON_NEW(StringBuffer)),
129 
130  // // filereadstream.h
131  // filereadstream(RAPIDJSON_NEW(FileReadStream)(stdout, buffer, sizeof(buffer))),
132 
133  // // filewritestream.h
134  // filewritestream(RAPIDJSON_NEW(FileWriteStream)(stdout, buffer, sizeof(buffer))),
135 
136  // memorybuffer.h
137  memorybuffer(RAPIDJSON_NEW(MemoryBuffer)),
138 
139  // memorystream.h
140  memorystream(RAPIDJSON_NEW(MemoryStream)(NULL, 0)),
141 
142  // reader.h
143  basereaderhandler(RAPIDJSON_NEW(BaseReaderHandlerUtf8Void)),
144  reader(RAPIDJSON_NEW(Reader)),
145 
146  // writer.h
148 
149  // prettywriter.h
150  prettywriter(RAPIDJSON_NEW(PrettyWriter<StringBuffer>)),
151 
152  // document.h
154  document(RAPIDJSON_NEW(Document)),
155 
156  // pointer.h
158 
159  // schema.h
160  schemadocument(RAPIDJSON_NEW(SchemaDocument)(*document)),
161  schemavalidator(RAPIDJSON_NEW(SchemaValidator)(*schemadocument))
162 {
163 
164 }
165 
167  // encodings.h
178 
179  // allocators.h
182 
183  // stream.h
186 
187  // stringbuffer.h
189 
190  // // filereadstream.h
191  // RAPIDJSON_DELETE(filereadstream);
192 
193  // // filewritestream.h
194  // RAPIDJSON_DELETE(filewritestream);
195 
196  // memorybuffer.h
198 
199  // memorystream.h
201 
202  // reader.h
205 
206  // writer.h
208 
209  // prettywriter.h
211 
212  // document.h
215 
216  // pointer.h
218 
219  // schema.h
222 }
223 
224 TEST(Fwd, Fwd) {
225  Foo f;
226 }
227 
228 #ifdef __GNUC__
229 RAPIDJSON_DIAG_POP
230 #endif
Transcoder< UTF8<>, UTF8<> > TranscoderUtf8ToUtf8
Definition: fwdtest.cpp:103
ASCII< char > * ascii
Definition: fwdtest.cpp:40
AutoUTF< unsigned > * autoutf
Definition: fwdtest.cpp:41
Encoding conversion.
Definition: encodings.h:658
MemoryPoolAllocator< CrtAllocator > * memorypoolallocator
Definition: fwdtest.cpp:46
Represents an in-memory input byte stream.
Definition: memorystream.h:40
UTF16< wchar_t > * utf16
Definition: fwdtest.cpp:34
Definition: fwdtest.cpp:28
JSON writer.
Definition: fwd.h:95
Default implementation of Handler.
Definition: fwd.h:85
f
UTF16BE< wchar_t > * utf16be
Definition: fwdtest.cpp:35
JSON schema document.
Definition: fwd.h:136
SchemaValidator * schemavalidator
Definition: fwdtest.cpp:86
Read-only string stream.
Definition: fwd.h:47
Represents an in-memory output byte stream.
Definition: fwd.h:74
Foo()
Definition: fwdtest.cpp:106
Value * value
Definition: fwdtest.cpp:78
MemoryStream * memorystream
Definition: fwdtest.cpp:65
StringBuffer * stringbuffer
Definition: fwdtest.cpp:53
CrtAllocator * crtallocator
Definition: fwdtest.cpp:45
SchemaDocument * schemadocument
Definition: fwdtest.cpp:85
#define RAPIDJSON_NEW(TypeName)
! customization point for global new
Definition: rapidjson.h:599
Represents a JSON Pointer. Use Pointer for UTF8 encoding and default allocator.
Definition: fwd.h:126
InsituStringStream * insitustringstream
Definition: fwdtest.cpp:50
UTF8< char > * utf8
Definition: fwdtest.cpp:33
UTF32BE< unsigned > * utf32be
Definition: fwdtest.cpp:38
UTF32< unsigned > * utf32
Definition: fwdtest.cpp:37
TEST(Fwd, Fwd)
Definition: fwdtest.cpp:224
MemoryBuffer * memorybuffer
Definition: fwdtest.cpp:62
UTF16LE< wchar_t > * utf16le
Definition: fwdtest.cpp:36
StringStream * stringstream
Definition: fwdtest.cpp:49
#define RAPIDJSON_DELETE(x)
! customization point for global delete
Definition: rapidjson.h:603
main RapidJSON namespace
~Foo()
Definition: fwdtest.cpp:166
BaseReaderHandler< UTF8< char >, void > * basereaderhandler
Definition: fwdtest.cpp:68
C-runtime library allocator.
Definition: allocators.h:62
Represents an in-memory output stream.
Definition: fwd.h:59
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1222
Writer< StringBuffer, UTF8< char >, UTF8< char >, CrtAllocator, 0 > * writer
Definition: fwdtest.cpp:72
BaseReaderHandler< UTF8<>, void > BaseReaderHandlerUtf8Void
Definition: fwdtest.cpp:104
Reader * reader
Definition: fwdtest.cpp:69
PrettyWriter< StringBuffer, UTF8< char >, UTF8< char >, CrtAllocator, 0 > * prettywriter
Definition: fwdtest.cpp:75
Transcoder< UTF8< char >, UTF8< char > > * transcoder
Definition: fwdtest.cpp:42
const GenericPointer< typename T::ValueType > & pointer
Definition: pointer.h:1121
UTF32LE< unsigned > * utf32le
Definition: fwdtest.cpp:39
JSON Schema Validator.
Definition: fwd.h:145
Writer with indentation and spacing.
Definition: fwd.h:100
Pointer * pointer
Definition: fwdtest.cpp:82
Document * document
Definition: fwdtest.cpp:79


choreo_rapidjson
Author(s):
autogenerated on Thu Jul 18 2019 03:59:09