@@ -150,16 +150,56 @@ namespace json
150
150
// / Constructor creating a JSON string value
151
151
// / </summary>
152
152
// / <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);
154
169
155
170
// / <summary>
156
171
// / Constructor creating a JSON string value
157
172
// / </summary>
158
173
// / <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,
160
181
// / 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);
163
203
164
204
// / <summary>
165
205
// / Copy constructor
@@ -217,8 +257,24 @@ namespace json
217
257
// / </summary>
218
258
// / <param name="value">The C++ value to create a JSON value from</param>
219
259
// / <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>
220
264
static _ASYNCRTIMP value __cdecl string (utility::string_t value);
221
265
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
+
222
278
#ifdef _MS_WINDOWS
223
279
private:
224
280
// Only used internally by JSON parser.
0 commit comments