Skip to content

Commit 814ef92

Browse files
committed
Merge branch 'development' of https://git01.codeplex.com/casablanca into misc
2 parents dadb447 + 06a48e8 commit 814ef92

File tree

16 files changed

+689
-173
lines changed

16 files changed

+689
-173
lines changed

CONTRIBUTORS.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@ Brian Wengert (bwengert79)
99
Leslie Brody (Les1966)
1010
Michael M (M1xa)
1111
Matt Peterson (MattPeterson1)
12+
Dmitry Kolomiets (kolomiets)
1213

13-
14+
Illumina Inc.
15+
Gery Vessere ([email protected])

Release/include/cpprest/json.h

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,56 @@ namespace json
150150
/// Constructor creating a JSON string value
151151
/// </summary>
152152
/// <param name="value">The C++ value to create a JSON value from, a C++ STL string of the platform-native character width</param>
153-
_ASYNCRTIMP explicit value(utility::string_t);
153+
/// <remarks>
154+
/// This constructor has O(n) performance because it tries to determine if
155+
/// specified string has characters that should be properly escaped in JSON.
156+
/// <remarks>
157+
_ASYNCRTIMP explicit value(utility::string_t value);
158+
159+
/// <summary>
160+
/// Constructor creating a JSON string value specifying if the string contains characters to escape
161+
/// </summary>
162+
/// <param name="value">The C++ value to create a JSON value from, a C++ STL string of the platform-native character width</param>
163+
/// <param name="has_escape_chars">Whether <paramref name="value" /> contains characters
164+
/// that should be escaped in JSON value</param>
165+
/// <remarks>
166+
/// This constructor has O(1) performance.
167+
/// </remarks>
168+
_ASYNCRTIMP explicit value(utility::string_t value, bool has_escape_chars);
154169

155170
/// <summary>
156171
/// Constructor creating a JSON string value
157172
/// </summary>
158173
/// <param name="value">The C++ value to create a JSON value from, a C++ STL string of the platform-native character width</param>
159-
/// <remarks>This constructor exists in order to avoid string literals matching another constructor,
174+
/// <remarks>
175+
/// <para>
176+
/// This constructor has O(n) performance because it tries to determine if
177+
/// specified string has characters that should be properly escaped in JSON.
178+
/// </para>
179+
/// <para>
180+
/// This constructor exists in order to avoid string literals matching another constructor,
160181
/// as is very likely. For example, conversion to bool does not require a user-defined conversion,
161-
/// and will therefore match first, which means that the JSON value turns up as a boolean.</remarks>
162-
_ASYNCRTIMP explicit value(const utility::char_t *);
182+
/// and will therefore match first, which means that the JSON value turns up as a boolean.
183+
/// </para>
184+
/// </remarks>
185+
_ASYNCRTIMP explicit value(const utility::char_t* value);
186+
187+
/// <summary>
188+
/// Constructor creating a JSON string value
189+
/// </summary>
190+
/// <param name="value">The C++ value to create a JSON value from, a C++ STL string of the platform-native character width</param>
191+
/// <param name="has_escape_chars">Whether <paramref name="value" /> contains characters
192+
/// <remarks>
193+
/// <para>
194+
/// This overload has O(1) performance.
195+
/// </para>
196+
/// <para>
197+
/// This constructor exists in order to avoid string literals matching another constructor,
198+
/// as is very likely. For example, conversion to bool does not require a user-defined conversion,
199+
/// and will therefore match first, which means that the JSON value turns up as a boolean.
200+
/// </para>
201+
/// </remarks>
202+
_ASYNCRTIMP explicit value(const utility::char_t* value, bool has_escape_chars);
163203

164204
/// <summary>
165205
/// Copy constructor
@@ -217,8 +257,24 @@ namespace json
217257
/// </summary>
218258
/// <param name="value">The C++ value to create a JSON value from</param>
219259
/// <returns>A JSON string value</returns>
260+
/// <remarks>
261+
/// This overload has O(n) performance because it tries to determine if
262+
/// specified string has characters that should be properly escaped in JSON.
263+
/// <remarks>
220264
static _ASYNCRTIMP value __cdecl string(utility::string_t value);
221265

266+
/// <summary>
267+
/// Creates a string value specifying if the string contains characters to escape
268+
/// </summary>
269+
/// <param name="value">The C++ value to create a JSON value from</param>
270+
/// <param name="has_escape_chars">Whether <paramref name="value" /> contains characters
271+
/// that should be escaped in JSON value</param>
272+
/// <returns>A JSON string value</returns>
273+
/// <remarks>
274+
/// This overload has O(1) performance.
275+
/// </remarks>
276+
static _ASYNCRTIMP value __cdecl string(utility::string_t value, bool has_escape_chars);
277+
222278
#ifdef _MS_WINDOWS
223279
private:
224280
// Only used internally by JSON parser.

0 commit comments

Comments
 (0)