Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
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__
22RAPIDJSON_DIAG_PUSH
23RAPIDJSON_DIAG_OFF(effc++)
24#endif
25
26using namespace rapidjson;
27
28struct 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
68 BaseReaderHandler<UTF8<char>, void>* basereaderhandler;
70
71 // writer.h
73
74 // prettywriter.h
76
77 // document.h
78 Value* value;
80
81 // pointer.h
83
84 // schema.h
87
88 // char buffer[16];
89};
90
91// Using type definitions here.
92
98#include "rapidjson/document.h" // -> reader.h
99#include "rapidjson/writer.h"
101#include "rapidjson/schema.h" // -> pointer.h
102
105
107 // encodings.h
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>)),
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
151
152 // document.h
153 value(RAPIDJSON_NEW(Value)),
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
224TEST(Fwd, Fwd) {
225 Foo f;
226}
227
228#ifdef __GNUC__
229RAPIDJSON_DIAG_POP
230#endif
C-runtime library allocator.
Definition allocators.h:75
Represents a JSON Pointer. Use Pointer for UTF8 encoding and default allocator.
Definition pointer.h:79
JSON schema document.
Definition schema.h:1501
JSON Schema Validator.
Definition schema.h:1767
Default memory allocator used by the parser and DOM.
Definition allocators.h:115
Writer with indentation and spacing.
JSON writer.
Definition writer.h:89
BaseReaderHandler< UTF8<>, void > BaseReaderHandlerUtf8Void
Definition fwdtest.cpp:104
Transcoder< UTF8<>, UTF8<> > TranscoderUtf8ToUtf8
Definition fwdtest.cpp:103
#define TEST(test_case_name, test_name)
Definition gtest.h:2275
Definition UTF8.h:7
main RapidJSON namespace
Definition checked.h:35
#define value
Definition pkcs11.h:157
const GenericPointer< typename T::ValueType > & pointer
Definition pointer.h:1181
#define RAPIDJSON_DELETE(x)
! customization point for global delete
Definition rapidjson.h:631
#define RAPIDJSON_NEW(TypeName)
! customization point for global new
Definition rapidjson.h:627
ASCII encoding.
Definition encodings.h:542
Dynamically select encoding according to stream's runtime-specified UTF encoding type.
Definition encodings.h:615
Default implementation of Handler.
Definition reader.h:196
UTF8< char > * utf8
Definition fwdtest.cpp:33
CrtAllocator * crtallocator
Definition fwdtest.cpp:45
MemoryBuffer * memorybuffer
Definition fwdtest.cpp:62
ASCII< char > * ascii
Definition fwdtest.cpp:40
MemoryPoolAllocator< CrtAllocator > * memorypoolallocator
Definition fwdtest.cpp:46
Foo()
Definition fwdtest.cpp:106
StringStream * stringstream
Definition fwdtest.cpp:49
Reader * reader
Definition fwdtest.cpp:69
Transcoder< UTF8< char >, UTF8< char > > * transcoder
Definition fwdtest.cpp:42
UTF16< wchar_t > * utf16
Definition fwdtest.cpp:34
StringBuffer * stringbuffer
Definition fwdtest.cpp:53
Pointer * pointer
Definition fwdtest.cpp:82
UTF32< unsigned > * utf32
Definition fwdtest.cpp:37
Document * document
Definition fwdtest.cpp:79
SchemaDocument * schemadocument
Definition fwdtest.cpp:85
Writer< StringBuffer, UTF8< char >, UTF8< char >, CrtAllocator, 0 > * writer
Definition fwdtest.cpp:72
Value * value
Definition fwdtest.cpp:78
InsituStringStream * insitustringstream
Definition fwdtest.cpp:50
~Foo()
Definition fwdtest.cpp:166
PrettyWriter< StringBuffer, UTF8< char >, UTF8< char >, CrtAllocator, 0 > * prettywriter
Definition fwdtest.cpp:75
UTF32LE< unsigned > * utf32le
Definition fwdtest.cpp:39
AutoUTF< unsigned > * autoutf
Definition fwdtest.cpp:41
UTF16BE< wchar_t > * utf16be
Definition fwdtest.cpp:35
SchemaValidator * schemavalidator
Definition fwdtest.cpp:86
BaseReaderHandler< UTF8< char >, void > * basereaderhandler
Definition fwdtest.cpp:68
UTF32BE< unsigned > * utf32be
Definition fwdtest.cpp:38
MemoryStream * memorystream
Definition fwdtest.cpp:65
UTF16LE< wchar_t > * utf16le
Definition fwdtest.cpp:36
Represents an in-memory output byte stream.
Read-only string stream.
Definition stream.h:154
Represents an in-memory input byte stream.
Encoding conversion.
Definition encodings.h:658
UTF-16 big endian encoding.
Definition encodings.h:375
UTF-16 encoding.
Definition encodings.h:269
UTF-16 little endian encoding.
Definition encodings.h:342
UTF-32 big endian encoding.
Definition encodings.h:496
UTF-32 encoding.
Definition encodings.h:418
UTF-32 little endian enocoding.
Definition encodings.h:457
UTF-8 encoding.
Definition encodings.h:96