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
61f8c4ef
Commit
61f8c4ef
authored
Mar 05, 2017
by
John Stiles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Quoted strings to String() or Key() are auto-sized by template
Same fix as previous commit, to prettywriter
parent
dd97ede8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
prettywriter.h
include/rapidjson/prettywriter.h
+14
-4
No files found.
include/rapidjson/prettywriter.h
View file @
61f8c4ef
...
...
@@ -107,7 +107,8 @@ public:
return
Base
::
WriteString
(
str
,
length
);
}
bool
String
(
const
Ch
*
str
,
SizeType
length
,
bool
copy
=
false
)
{
template
<
typename
T
>
bool
String
(
const
T
*
str
,
SizeType
length
,
bool
copy
=
false
,
RAPIDJSON_ENABLEIF
((
internal
::
IsSame
<
Ch
,
T
>
)))
{
RAPIDJSON_ASSERT
(
str
!=
0
);
(
void
)
copy
;
PrettyPrefix
(
kStringType
);
...
...
@@ -126,7 +127,8 @@ public:
return
Base
::
WriteStartObject
();
}
bool
Key
(
const
Ch
*
str
,
SizeType
length
,
bool
copy
=
false
)
{
return
String
(
str
,
length
,
copy
);
}
template
<
typename
T
>
bool
Key
(
const
T
*
str
,
SizeType
length
,
bool
copy
=
false
,
RAPIDJSON_ENABLEIF
((
internal
::
IsSame
<
Ch
,
T
>
)))
{
return
String
(
str
,
length
,
copy
);
}
#if RAPIDJSON_HAS_STDSTRING
bool
Key
(
const
std
::
basic_string
<
Ch
>&
str
)
{
...
...
@@ -184,8 +186,16 @@ public:
//@{
//! Simpler but slower overload.
bool
String
(
const
Ch
*
str
)
{
return
String
(
str
,
internal
::
StrLen
(
str
));
}
bool
Key
(
const
Ch
*
str
)
{
return
Key
(
str
,
internal
::
StrLen
(
str
));
}
template
<
typename
T
>
bool
String
(
const
T
*
const
&
str
,
RAPIDJSON_ENABLEIF
((
internal
::
IsSame
<
Ch
,
T
>
)))
{
return
String
(
str
,
internal
::
StrLen
(
str
));
}
template
<
typename
T
>
bool
Key
(
const
T
*
const
&
str
,
RAPIDJSON_ENABLEIF
((
internal
::
IsSame
<
Ch
,
T
>
)))
{
return
Key
(
str
,
internal
::
StrLen
(
str
));
}
//! The compiler can give us the length of quoted strings for free.
template
<
typename
T
,
size_t
N
>
bool
String
(
const
T
(
&
str
)[
N
],
RAPIDJSON_ENABLEIF
((
internal
::
IsSame
<
Ch
,
T
>
)))
{
return
String
(
str
,
N
-
1
);
}
template
<
typename
T
,
size_t
N
>
bool
Key
(
const
T
(
&
str
)[
N
],
RAPIDJSON_ENABLEIF
((
internal
::
IsSame
<
Ch
,
T
>
)))
{
return
Key
(
str
,
N
-
1
);
}
//@}
...
...
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