VR-Vantage 3.0 API Documentation
Home
Modules
Namespaces
Classes
Files
Libraries
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
include
rapidjson
memorystream.h
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
#ifndef RAPIDJSON_MEMORYSTREAM_H_
16
#define RAPIDJSON_MEMORYSTREAM_H_
17
18
#include "
stream.h
"
19
20
#ifdef __clang__
21
RAPIDJSON_DIAG_PUSH
22
RAPIDJSON_DIAG_OFF(unreachable-code)
23
RAPIDJSON_DIAG_OFF(missing-noreturn)
24
#endif
25
26
RAPIDJSON_NAMESPACE_BEGIN
27
29
40
struct
MemoryStream
{
41
typedef
char
Ch
;
// byte
42
43
MemoryStream
(
const
Ch
*
src
,
size_t
size
) :
src_
(src),
begin_
(src),
end_
(src + size),
size_
(size) {}
44
45
Ch
Peek
()
const
{
return
RAPIDJSON_UNLIKELY
(
src_
==
end_
) ?
'\0'
: *
src_
; }
46
Ch
Take
() {
return
RAPIDJSON_UNLIKELY
(
src_
==
end_
) ?
'\0'
: *
src_
++; }
47
size_t
Tell
()
const
{
return
static_cast<
size_t
>
(
src_
-
begin_
); }
48
49
Ch
*
PutBegin
() {
RAPIDJSON_ASSERT
(
false
);
return
0; }
50
void
Put
(
Ch
) {
RAPIDJSON_ASSERT
(
false
); }
51
void
Flush
() {
RAPIDJSON_ASSERT
(
false
); }
52
size_t
PutEnd
(
Ch
*) {
RAPIDJSON_ASSERT
(
false
);
return
0; }
53
54
// For encoding detection only.
55
const
Ch
*
Peek4
()
const
{
56
return
Tell
() + 4 <=
size_
?
src_
: 0;
57
}
58
59
const
Ch
*
src_
;
60
const
Ch
*
begin_
;
61
const
Ch
*
end_
;
62
size_t
size_
;
63
};
64
65
RAPIDJSON_NAMESPACE_END
66
67
#ifdef __clang__
68
RAPIDJSON_DIAG_POP
69
#endif
70
71
#endif // RAPIDJSON_MEMORYBUFFER_H_
Copyright © 2005-2022 MAK Technologies. All Rights Reserved (
www.mak.com
)