Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
rapidjson
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
rapidjson
Commits
2e237877
Commit
2e237877
authored
Aug 17, 2014
by
Milo Yip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change Reader/Writer's stack allocator to CrtAllocator
parent
4a2ddf80
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
reader.h
include/rapidjson/reader.h
+6
-6
writer.h
include/rapidjson/writer.h
+6
-6
No files found.
include/rapidjson/reader.h
View file @
2e237877
...
...
@@ -347,9 +347,9 @@ template<> inline void SkipWhitespace(StringStream& is) {
\tparam SourceEncoding Encoding of the input stream.
\tparam TargetEncoding Encoding of the parse output.
\tparam Allocator Allocator type for stack.
\tparam
Stack
Allocator Allocator type for stack.
*/
template
<
typename
SourceEncoding
,
typename
TargetEncoding
,
typename
Allocator
=
MemoryPoolAllocator
<>
>
template
<
typename
SourceEncoding
,
typename
TargetEncoding
,
typename
StackAllocator
=
CrtAllocator
>
class
GenericReader
{
public
:
typedef
typename
SourceEncoding
::
Ch
Ch
;
//!< SourceEncoding character type
...
...
@@ -358,7 +358,7 @@ public:
/*! \param allocator Optional allocator for allocating stack memory. (Only use for non-destructive parsing)
\param stackCapacity stack capacity in bytes for storing a single decoded string. (Only use for non-destructive parsing)
*/
GenericReader
(
Allocator
*
allocator
=
0
,
size_t
stackCapacity
=
kDefaultStackCapacity
)
:
stack_
(
a
llocator
,
stackCapacity
),
parseResult_
()
{}
GenericReader
(
StackAllocator
*
stackAllocator
=
0
,
size_t
stackCapacity
=
kDefaultStackCapacity
)
:
stack_
(
stackA
llocator
,
stackCapacity
),
parseResult_
()
{}
//! Parse JSON text.
/*! \tparam parseFlags Combination of \ref ParseFlag.
...
...
@@ -591,12 +591,12 @@ private:
public
:
typedef
typename
TargetEncoding
::
Ch
Ch
;
StackStream
(
internal
::
Stack
<
Allocator
>&
stack
)
:
stack_
(
stack
),
length_
(
0
)
{}
StackStream
(
internal
::
Stack
<
Stack
Allocator
>&
stack
)
:
stack_
(
stack
),
length_
(
0
)
{}
RAPIDJSON_FORCEINLINE
void
Put
(
Ch
c
)
{
*
stack_
.
template
Push
<
Ch
>
()
=
c
;
++
length_
;
}
internal
::
Stack
<
Allocator
>&
stack_
;
internal
::
Stack
<
Stack
Allocator
>&
stack_
;
SizeType
length_
;
private
:
...
...
@@ -1317,7 +1317,7 @@ private:
}
static
const
size_t
kDefaultStackCapacity
=
256
;
//!< Default stack capacity in bytes for storing a single decoded string.
internal
::
Stack
<
Allocator
>
stack_
;
//!< A stack for storing decoded string temporarily during non-destructive parsing.
internal
::
Stack
<
Stack
Allocator
>
stack_
;
//!< A stack for storing decoded string temporarily during non-destructive parsing.
ParseResult
parseResult_
;
};
// class GenericReader
...
...
include/rapidjson/writer.h
View file @
2e237877
...
...
@@ -49,10 +49,10 @@ namespace rapidjson {
\tparam OutputStream Type of output stream.
\tparam SourceEncoding Encoding of source string.
\tparam TargetEncoding Encoding of output stream.
\tparam Allocator Type of allocator for allocating memory of stack.
\tparam
Stack
Allocator Type of allocator for allocating memory of stack.
\note implements Handler concept
*/
template
<
typename
OutputStream
,
typename
SourceEncoding
=
UTF8
<>
,
typename
TargetEncoding
=
UTF8
<>
,
typename
Allocator
=
MemoryPoolAllocator
<>
>
template
<
typename
OutputStream
,
typename
SourceEncoding
=
UTF8
<>
,
typename
TargetEncoding
=
UTF8
<>
,
typename
StackAllocator
=
CrtAllocator
>
class
Writer
{
public
:
typedef
typename
SourceEncoding
::
Ch
Ch
;
...
...
@@ -62,10 +62,10 @@ public:
\param allocator User supplied allocator. If it is null, it will create a private one.
\param levelDepth Initial capacity of stack.
*/
Writer
(
OutputStream
&
os
,
Allocator
*
a
llocator
=
0
,
size_t
levelDepth
=
kDefaultLevelDepth
)
:
os_
(
&
os
),
level_stack_
(
a
llocator
,
levelDepth
*
sizeof
(
Level
)),
hasRoot_
(
false
)
{}
Writer
(
OutputStream
&
os
,
StackAllocator
*
stackA
llocator
=
0
,
size_t
levelDepth
=
kDefaultLevelDepth
)
:
os_
(
&
os
),
level_stack_
(
stackA
llocator
,
levelDepth
*
sizeof
(
Level
)),
hasRoot_
(
false
)
{}
Writer
(
Allocator
*
allocator
=
0
,
size_t
levelDepth
=
kDefaultLevelDepth
)
:
Writer
(
Stack
Allocator
*
allocator
=
0
,
size_t
levelDepth
=
kDefaultLevelDepth
)
:
os_
(
0
),
level_stack_
(
allocator
,
levelDepth
*
sizeof
(
Level
)),
hasRoot_
(
false
)
{}
//! Reset the writer with a new stream.
...
...
@@ -327,7 +327,7 @@ protected:
}
OutputStream
*
os_
;
internal
::
Stack
<
Allocator
>
level_stack_
;
internal
::
Stack
<
Stack
Allocator
>
level_stack_
;
bool
hasRoot_
;
private
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment