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
33443e63
Commit
33443e63
authored
May 25, 2017
by
Milo Yip
Committed by
GitHub
May 25, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #967 from TomaszNo/storage-class-first
Storage class is not first - encodings.h
parents
3202b0a3
77d2fadf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
encodings.h
include/rapidjson/encodings.h
+10
-10
No files found.
include/rapidjson/encodings.h
View file @
33443e63
...
...
@@ -620,28 +620,28 @@ struct AutoUTF {
#define RAPIDJSON_ENCODINGS_FUNC(x) UTF8<Ch>::x, UTF16LE<Ch>::x, UTF16BE<Ch>::x, UTF32LE<Ch>::x, UTF32BE<Ch>::x
template
<
typename
OutputStream
>
RAPIDJSON_FORCEINLINE
static
void
Encode
(
OutputStream
&
os
,
unsigned
codepoint
)
{
static
RAPIDJSON_FORCEINLINE
void
Encode
(
OutputStream
&
os
,
unsigned
codepoint
)
{
typedef
void
(
*
EncodeFunc
)(
OutputStream
&
,
unsigned
);
static
const
EncodeFunc
f
[]
=
{
RAPIDJSON_ENCODINGS_FUNC
(
Encode
)
};
(
*
f
[
os
.
GetType
()])(
os
,
codepoint
);
}
template
<
typename
OutputStream
>
RAPIDJSON_FORCEINLINE
static
void
EncodeUnsafe
(
OutputStream
&
os
,
unsigned
codepoint
)
{
static
RAPIDJSON_FORCEINLINE
void
EncodeUnsafe
(
OutputStream
&
os
,
unsigned
codepoint
)
{
typedef
void
(
*
EncodeFunc
)(
OutputStream
&
,
unsigned
);
static
const
EncodeFunc
f
[]
=
{
RAPIDJSON_ENCODINGS_FUNC
(
EncodeUnsafe
)
};
(
*
f
[
os
.
GetType
()])(
os
,
codepoint
);
}
template
<
typename
InputStream
>
RAPIDJSON_FORCEINLINE
static
bool
Decode
(
InputStream
&
is
,
unsigned
*
codepoint
)
{
static
RAPIDJSON_FORCEINLINE
bool
Decode
(
InputStream
&
is
,
unsigned
*
codepoint
)
{
typedef
bool
(
*
DecodeFunc
)(
InputStream
&
,
unsigned
*
);
static
const
DecodeFunc
f
[]
=
{
RAPIDJSON_ENCODINGS_FUNC
(
Decode
)
};
return
(
*
f
[
is
.
GetType
()])(
is
,
codepoint
);
}
template
<
typename
InputStream
,
typename
OutputStream
>
RAPIDJSON_FORCEINLINE
static
bool
Validate
(
InputStream
&
is
,
OutputStream
&
os
)
{
static
RAPIDJSON_FORCEINLINE
bool
Validate
(
InputStream
&
is
,
OutputStream
&
os
)
{
typedef
bool
(
*
ValidateFunc
)(
InputStream
&
,
OutputStream
&
);
static
const
ValidateFunc
f
[]
=
{
RAPIDJSON_ENCODINGS_FUNC
(
Validate
)
};
return
(
*
f
[
is
.
GetType
()])(
is
,
os
);
...
...
@@ -658,7 +658,7 @@ template<typename SourceEncoding, typename TargetEncoding>
struct
Transcoder
{
//! Take one Unicode codepoint from source encoding, convert it to target encoding and put it to the output stream.
template
<
typename
InputStream
,
typename
OutputStream
>
RAPIDJSON_FORCEINLINE
static
bool
Transcode
(
InputStream
&
is
,
OutputStream
&
os
)
{
static
RAPIDJSON_FORCEINLINE
bool
Transcode
(
InputStream
&
is
,
OutputStream
&
os
)
{
unsigned
codepoint
;
if
(
!
SourceEncoding
::
Decode
(
is
,
&
codepoint
))
return
false
;
...
...
@@ -667,7 +667,7 @@ struct Transcoder {
}
template
<
typename
InputStream
,
typename
OutputStream
>
RAPIDJSON_FORCEINLINE
static
bool
TranscodeUnsafe
(
InputStream
&
is
,
OutputStream
&
os
)
{
static
RAPIDJSON_FORCEINLINE
bool
TranscodeUnsafe
(
InputStream
&
is
,
OutputStream
&
os
)
{
unsigned
codepoint
;
if
(
!
SourceEncoding
::
Decode
(
is
,
&
codepoint
))
return
false
;
...
...
@@ -677,7 +677,7 @@ struct Transcoder {
//! Validate one Unicode codepoint from an encoded stream.
template
<
typename
InputStream
,
typename
OutputStream
>
RAPIDJSON_FORCEINLINE
static
bool
Validate
(
InputStream
&
is
,
OutputStream
&
os
)
{
static
RAPIDJSON_FORCEINLINE
bool
Validate
(
InputStream
&
is
,
OutputStream
&
os
)
{
return
Transcode
(
is
,
os
);
// Since source/target encoding is different, must transcode.
}
};
...
...
@@ -690,19 +690,19 @@ inline void PutUnsafe(Stream& stream, typename Stream::Ch c);
template
<
typename
Encoding
>
struct
Transcoder
<
Encoding
,
Encoding
>
{
template
<
typename
InputStream
,
typename
OutputStream
>
RAPIDJSON_FORCEINLINE
static
bool
Transcode
(
InputStream
&
is
,
OutputStream
&
os
)
{
static
RAPIDJSON_FORCEINLINE
bool
Transcode
(
InputStream
&
is
,
OutputStream
&
os
)
{
os
.
Put
(
is
.
Take
());
// Just copy one code unit. This semantic is different from primary template class.
return
true
;
}
template
<
typename
InputStream
,
typename
OutputStream
>
RAPIDJSON_FORCEINLINE
static
bool
TranscodeUnsafe
(
InputStream
&
is
,
OutputStream
&
os
)
{
static
RAPIDJSON_FORCEINLINE
bool
TranscodeUnsafe
(
InputStream
&
is
,
OutputStream
&
os
)
{
PutUnsafe
(
os
,
is
.
Take
());
// Just copy one code unit. This semantic is different from primary template class.
return
true
;
}
template
<
typename
InputStream
,
typename
OutputStream
>
RAPIDJSON_FORCEINLINE
static
bool
Validate
(
InputStream
&
is
,
OutputStream
&
os
)
{
static
RAPIDJSON_FORCEINLINE
bool
Validate
(
InputStream
&
is
,
OutputStream
&
os
)
{
return
Encoding
::
Validate
(
is
,
os
);
// source/target encoding are the same
}
};
...
...
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