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
c1a57c37
Commit
c1a57c37
authored
Oct 24, 2014
by
Milo Yip
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #175 from pah/cleanup/index-operator
GenericValue: improve documentation for operator[]
parents
838d5130
6bd5ecb0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
document.h
include/rapidjson/document.h
+14
-6
No files found.
include/rapidjson/document.h
View file @
c1a57c37
...
...
@@ -795,8 +795,9 @@ public:
//! Check whether the object is empty.
bool
ObjectEmpty
()
const
{
RAPIDJSON_ASSERT
(
IsObject
());
return
data_
.
o
.
size
==
0
;
}
//! Get the value associated with the name.
/*!
//! Get a value from an object associated with the name.
/*! \pre IsObject() == true
\tparam T Either \c Ch or \c const \c Ch (template used for disambiguation with \ref operator[](SizeType))
\note In version 0.1x, if the member is not found, this function returns a null value. This makes issue 7.
Since 0.2, if the name is not correct, it will assert.
If user is unsure whether a member exists, user should use HasMember() first.
...
...
@@ -811,10 +812,15 @@ public:
template
<
typename
T
>
RAPIDJSON_DISABLEIF_RETURN
((
internal
::
NotExpr
<
internal
::
IsSame
<
typename
internal
::
RemoveConst
<
T
>::
Type
,
Ch
>
>
),(
const
GenericValue
&
))
operator
[](
T
*
name
)
const
{
return
const_cast
<
GenericValue
&>
(
*
this
)[
name
];
}
//! Get a value from an object associated with the name.
/*! \pre IsObject() == true
\tparam SourceAllocator Allocator of the \c name value
public
:
// This version is faster because it does not need a StrLen().
// It can also handle string with null character.
\note Compared to \ref operator[](T*), this version is faster because it does not need a StrLen().
And it can also handle strings with embedded null characters.
\note Linear time complexity.
*/
template
<
typename
SourceAllocator
>
GenericValue
&
operator
[](
const
GenericValue
<
Encoding
,
SourceAllocator
>&
name
)
{
MemberIterator
member
=
FindMember
(
name
);
...
...
@@ -1136,7 +1142,9 @@ public:
}
//! Get an element from array by index.
/*! \param index Zero-based index of element.
/*! \pre IsArray() == true
\param index Zero-based index of element.
\see operator[](T*)
*/
GenericValue
&
operator
[](
SizeType
index
)
{
RAPIDJSON_ASSERT
(
IsArray
());
...
...
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