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
5e220bbf
Commit
5e220bbf
authored
May 17, 2015
by
miloyip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change schema literal strings to Value type, eliminates StrLen()
parent
a92c3b69
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
schema.h
include/rapidjson/schema.h
+11
-9
No files found.
include/rapidjson/schema.h
View file @
5e220bbf
...
...
@@ -96,8 +96,8 @@ inline void PrintValidatorPointers(unsigned depth, const wchar_t* s, const wchar
#define RAPIDJSON_INVALID_KEYWORD_RETURN(keyword)\
RAPIDJSON_MULTILINEMACRO_BEGIN\
context.invalidKeyword = keyword;\
RAPIDJSON_INVALID_KEYWORD_VERBOSE(keyword);\
context.invalidKeyword = keyword
.GetString()
;\
RAPIDJSON_INVALID_KEYWORD_VERBOSE(keyword
.GetString()
);\
return false;\
RAPIDJSON_MULTILINEMACRO_END
...
...
@@ -843,9 +843,10 @@ public:
// Generate functions for string literal according to Ch
#define RAPIDJSON_STRING_(name, ...) \
static const
Ch*
Get##name##String() {\
static const
ValueType&
Get##name##String() {\
static const Ch s[] = { __VA_ARGS__, '\0' };\
return s;\
static const ValueType v(s, sizeof(s) / sizeof(Ch) - 1);\
return v;\
}
RAPIDJSON_STRING_
(
Null
,
'n'
,
'u'
,
'l'
,
'l'
);
...
...
@@ -924,27 +925,27 @@ private:
}
template
<
typename
ValueType
>
static
const
ValueType
*
GetMember
(
const
ValueType
&
value
,
const
Ch
*
name
)
{
static
const
ValueType
*
GetMember
(
const
ValueType
&
value
,
const
ValueType
&
name
)
{
typename
ValueType
::
ConstMemberIterator
itr
=
value
.
FindMember
(
name
);
return
itr
!=
value
.
MemberEnd
()
?
&
(
itr
->
value
)
:
0
;
}
template
<
typename
ValueType
>
static
void
AssignIfExist
(
bool
&
out
,
const
ValueType
&
value
,
const
Ch
*
name
)
{
static
void
AssignIfExist
(
bool
&
out
,
const
ValueType
&
value
,
const
ValueType
&
name
)
{
if
(
const
ValueType
*
v
=
GetMember
(
value
,
name
))
if
(
v
->
IsBool
())
out
=
v
->
GetBool
();
}
template
<
typename
ValueType
>
static
void
AssignIfExist
(
SizeType
&
out
,
const
ValueType
&
value
,
const
Ch
*
name
)
{
static
void
AssignIfExist
(
SizeType
&
out
,
const
ValueType
&
value
,
const
ValueType
&
name
)
{
if
(
const
ValueType
*
v
=
GetMember
(
value
,
name
))
if
(
v
->
IsUint64
()
&&
v
->
GetUint64
()
<=
SizeType
(
~
0
))
out
=
static_cast
<
SizeType
>
(
v
->
GetUint64
());
}
template
<
typename
DocumentType
,
typename
ValueType
,
typename
PointerType
>
void
AssignIfExist
(
SchemaArray
&
out
,
const
DocumentType
&
document
,
const
PointerType
&
p
,
const
ValueType
&
value
,
const
Ch
*
name
)
{
void
AssignIfExist
(
SchemaArray
&
out
,
const
DocumentType
&
document
,
const
PointerType
&
p
,
const
ValueType
&
value
,
const
ValueType
&
name
)
{
if
(
const
ValueType
*
v
=
GetMember
(
value
,
name
))
{
if
(
v
->
IsArray
()
&&
v
->
Size
()
>
0
)
{
PointerType
q
=
p
.
Append
(
name
);
...
...
@@ -1315,8 +1316,9 @@ private:
bool
HandleRefSchema
(
const
PointerType
&
source
,
const
SchemaType
**
schema
,
const
ValueType
&
v
)
{
static
const
Ch
kRefString
[]
=
{
'$'
,
'r'
,
'e'
,
'f'
,
'\0'
};
static
const
ValueType
kRefValue
(
kRefString
,
4
);
typename
ValueType
::
ConstMemberIterator
itr
=
v
.
FindMember
(
kRef
String
);
typename
ValueType
::
ConstMemberIterator
itr
=
v
.
FindMember
(
kRef
Value
);
if
(
itr
==
v
.
MemberEnd
())
return
false
;
...
...
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