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
0e4c3689
Commit
0e4c3689
authored
May 08, 2015
by
miloyip
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into schema
parents
677af55f
771fa987
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
3 deletions
+28
-3
pointer.h
include/rapidjson/pointer.h
+15
-0
pointertest.cpp
test/unittest/pointertest.cpp
+13
-3
No files found.
include/rapidjson/pointer.h
View file @
0e4c3689
...
...
@@ -273,6 +273,21 @@ public:
}
}
//! Append a token by value, and return a new Pointer
/*!
\param value Value (either Uint or String) to be appended.
\param allocator Allocator for the newly return Pointer.
\return A new Pointer with appended token.
*/
GenericPointer
Append
(
const
ValueType
&
token
,
Allocator
*
allocator
=
0
)
const
{
if
(
token
.
IsString
())
return
Append
(
token
.
GetString
(),
token
.
GetStringLength
(),
allocator
);
else
{
RAPIDJSON_ASSERT
(
token
.
IsUint64
());
return
Append
(
static_cast
<
SizeType
>
(
token
.
GetUint64
()),
allocator
);
}
}
//!@name Handling Parse Error
//@{
...
...
test/unittest/pointertest.cpp
View file @
0e4c3689
...
...
@@ -529,10 +529,20 @@ TEST(Pointer, Append) {
Pointer
p
;
Pointer
q
=
p
.
Append
(
"foo"
);
EXPECT_TRUE
(
Pointer
(
"/foo"
)
==
q
);
q
=
q
.
Append
(
0
);
EXPECT_TRUE
(
Pointer
(
"/foo/
0
"
)
==
q
);
q
=
q
.
Append
(
1234
);
EXPECT_TRUE
(
Pointer
(
"/foo/
1234
"
)
==
q
);
q
=
q
.
Append
(
""
);
EXPECT_TRUE
(
Pointer
(
"/foo/0/"
)
==
q
);
EXPECT_TRUE
(
Pointer
(
"/foo/1234/"
)
==
q
);
}
{
Pointer
p
;
Pointer
q
=
p
.
Append
(
Value
(
"foo"
).
Move
());
EXPECT_TRUE
(
Pointer
(
"/foo"
)
==
q
);
q
=
q
.
Append
(
Value
(
1234
).
Move
());
EXPECT_TRUE
(
Pointer
(
"/foo/1234"
)
==
q
);
q
=
q
.
Append
(
Value
(
kStringType
).
Move
());
EXPECT_TRUE
(
Pointer
(
"/foo/1234/"
)
==
q
);
}
#if RAPIDJSON_HAS_STDSTRING
...
...
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