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
c1c9ba7c
Commit
c1c9ba7c
authored
Aug 31, 2014
by
Philipp A. Hartmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
always define RAPIDJSON_HAS_STDSTRING (default: 0)
parent
5656078a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
document.h
include/rapidjson/document.h
+8
-6
valuetest.cpp
test/unittest/valuetest.cpp
+1
-1
No files found.
include/rapidjson/document.h
View file @
c1c9ba7c
...
...
@@ -39,15 +39,17 @@ RAPIDJSON_DIAG_OFF(effc++)
///////////////////////////////////////////////////////////////////////////////
// RAPIDJSON_HAS_STDSTRING
#ifndef RAPIDJSON_HAS_STDSTRING
#ifdef RAPIDJSON_DOXYGEN_RUNNING
#define RAPIDJSON_HAS_STDSTRING 1 // force generation of documentation
#else
#define RAPIDJSON_HAS_STDSTRING 0 // no std::string support by default
#endif
#ifdef RAPIDJSON_HAS_STDSTRING
/*! \def RAPIDJSON_HAS_STDSTRING
\ingroup RAPIDJSON_CONFIG
\brief Enable RapidJSON support for \c std::string
By defining this preprocessor symbol, several convenience functions for using
By defining this preprocessor symbol
to \c 1
, several convenience functions for using
\ref rapidjson::GenericValue with \c std::string are enabled, especially
for construction and comparison.
...
...
@@ -363,7 +365,7 @@ inline GenericStringRef<CharType> StringRef(const CharType* str, size_t length)
return
GenericStringRef
<
CharType
>
(
str
,
SizeType
(
length
));
}
#if
def
RAPIDJSON_HAS_STDSTRING
#if RAPIDJSON_HAS_STDSTRING
//! Mark a string object as constant string
/*! Mark a string object (e.g. \c std::string) as a "string literal".
This function can be used to avoid copying a string to be referenced as a
...
...
@@ -524,7 +526,7 @@ public:
//! Constructor for copy-string (i.e. do make a copy of string)
GenericValue
(
const
Ch
*
s
,
Allocator
&
allocator
)
:
data_
(),
flags_
()
{
SetStringRaw
(
StringRef
(
s
),
allocator
);
}
#if
def
RAPIDJSON_HAS_STDSTRING
#if RAPIDJSON_HAS_STDSTRING
//! Constructor for copy-string from a string object (i.e. do make a copy of string)
/*! \note Requires the definition of the preprocessor symbol \ref RAPIDJSON_HAS_STDSTRING.
*/
...
...
@@ -689,7 +691,7 @@ public:
//! Equal-to operator with const C-string pointer
bool
operator
==
(
const
Ch
*
rhs
)
const
{
return
*
this
==
GenericValue
(
StringRef
(
rhs
));
}
#if
def
RAPIDJSON_HAS_STDSTRING
#if RAPIDJSON_HAS_STDSTRING
//! Equal-to operator with string object
/*! \note Requires the definition of the preprocessor symbol \ref RAPIDJSON_HAS_STDSTRING.
*/
...
...
@@ -1303,7 +1305,7 @@ int z = a[0u].GetInt(); // This works too.
*/
GenericValue
&
SetString
(
const
Ch
*
s
,
Allocator
&
allocator
)
{
return
SetString
(
s
,
internal
::
StrLen
(
s
),
allocator
);
}
#if
def
RAPIDJSON_HAS_STDSTRING
#if RAPIDJSON_HAS_STDSTRING
//! Set this value as a string by copying from source string.
/*! \param s source string.
\param allocator Allocator for allocating copied buffer. Commonly use GenericDocument::GetAllocator().
...
...
test/unittest/valuetest.cpp
View file @
c1c9ba7c
...
...
@@ -558,7 +558,7 @@ TEST(Value, String) {
EXPECT_STREQ
(
"World"
,
w
.
GetString
());
EXPECT_EQ
(
5u
,
w
.
GetStringLength
());
#if
def
RAPIDJSON_HAS_STDSTRING
#if RAPIDJSON_HAS_STDSTRING
{
std
::
string
str
=
"Hello World"
;
str
[
5
]
=
'\0'
;
...
...
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