Skip to content

Commit 0cc2d6f

Browse files
committed
std.json: use proper block comments
1 parent 140aa0d commit 0cc2d6f

File tree

1 file changed

+91
-67
lines changed

1 file changed

+91
-67
lines changed

std/json.d

Lines changed: 91 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,11 @@ struct JSONValue
130130
assert(j["language"].type == JSON_TYPE.STRING);
131131
}
132132

133-
/// Value getter/setter for $(D JSON_TYPE.STRING).
134-
/// Throws: $(D JSONException) for read access if $(D type) is not
135-
/// $(D JSON_TYPE.STRING).
133+
/***
134+
* Value getter/setter for $(D JSON_TYPE.STRING).
135+
* Throws: $(D JSONException) for read access if $(D type) is not
136+
* $(D JSON_TYPE.STRING).
137+
*/
136138
@property string str() const pure @trusted
137139
{
138140
enforce!JSONException(type == JSON_TYPE.STRING,
@@ -158,9 +160,11 @@ struct JSONValue
158160
assert(j["language"].str == "Perl");
159161
}
160162

161-
/// Value getter/setter for $(D JSON_TYPE.INTEGER).
162-
/// Throws: $(D JSONException) for read access if $(D type) is not
163-
/// $(D JSON_TYPE.INTEGER).
163+
/***
164+
* Value getter/setter for $(D JSON_TYPE.INTEGER).
165+
* Throws: $(D JSONException) for read access if $(D type) is not
166+
* $(D JSON_TYPE.INTEGER).
167+
*/
164168
@property inout(long) integer() inout pure @safe
165169
{
166170
enforce!JSONException(type == JSON_TYPE.INTEGER,
@@ -174,9 +178,11 @@ struct JSONValue
174178
return store.integer;
175179
}
176180

177-
/// Value getter/setter for $(D JSON_TYPE.UINTEGER).
178-
/// Throws: $(D JSONException) for read access if $(D type) is not
179-
/// $(D JSON_TYPE.UINTEGER).
181+
/***
182+
* Value getter/setter for $(D JSON_TYPE.UINTEGER).
183+
* Throws: $(D JSONException) for read access if $(D type) is not
184+
* $(D JSON_TYPE.UINTEGER).
185+
*/
180186
@property inout(ulong) uinteger() inout pure @safe
181187
{
182188
enforce!JSONException(type == JSON_TYPE.UINTEGER,
@@ -190,10 +196,12 @@ struct JSONValue
190196
return store.uinteger;
191197
}
192198

193-
/// Value getter/setter for $(D JSON_TYPE.FLOAT). Note that despite
194-
/// the name, this is a $(B 64)-bit `double`, not a 32-bit `float`.
195-
/// Throws: $(D JSONException) for read access if $(D type) is not
196-
/// $(D JSON_TYPE.FLOAT).
199+
/***
200+
* Value getter/setter for $(D JSON_TYPE.FLOAT). Note that despite
201+
* the name, this is a $(B 64)-bit `double`, not a 32-bit `float`.
202+
* Throws: $(D JSONException) for read access if $(D type) is not
203+
* $(D JSON_TYPE.FLOAT).
204+
*/
197205
@property inout(double) floating() inout pure @safe
198206
{
199207
enforce!JSONException(type == JSON_TYPE.FLOAT,
@@ -207,10 +215,11 @@ struct JSONValue
207215
return store.floating;
208216
}
209217

210-
/// Value getter/setter for $(D JSON_TYPE.OBJECT).
211-
/// Throws: $(D JSONException) for read access if $(D type) is not
212-
/// $(D JSON_TYPE.OBJECT).
213-
/* Note: this is @system because of the following pattern:
218+
/***
219+
* Value getter/setter for $(D JSON_TYPE.OBJECT).
220+
* Throws: $(D JSONException) for read access if $(D type) is not
221+
* $(D JSON_TYPE.OBJECT).
222+
* Note: this is @system because of the following pattern:
214223
---
215224
auto a = &(json.object());
216225
json.uinteger = 0; // overwrite AA pointer
@@ -230,30 +239,33 @@ struct JSONValue
230239
return v;
231240
}
232241

233-
/// Value getter for $(D JSON_TYPE.OBJECT).
234-
/// Unlike $(D object), this retrieves the object by value and can be used in @safe code.
235-
///
236-
/// A caveat is that, if the returned value is null, modifications will not be visible:
237-
/// ---
238-
/// JSONValue json;
239-
/// json.object = null;
240-
/// json.objectNoRef["hello"] = JSONValue("world");
241-
/// assert("hello" !in json.object);
242-
/// ---
243-
///
244-
/// Throws: $(D JSONException) for read access if $(D type) is not
245-
/// $(D JSON_TYPE.OBJECT).
242+
/***
243+
* Value getter for $(D JSON_TYPE.OBJECT).
244+
* Unlike $(D object), this retrieves the object by value and can be used in @safe code.
245+
*
246+
* A caveat is that, if the returned value is null, modifications will not be visible:
247+
* ---
248+
* JSONValue json;
249+
* json.object = null;
250+
* json.objectNoRef["hello"] = JSONValue("world");
251+
* assert("hello" !in json.object);
252+
* ---
253+
*
254+
* Throws: $(D JSONException) for read access if $(D type) is not
255+
* $(D JSON_TYPE.OBJECT).
256+
*/
246257
@property inout(JSONValue[string]) objectNoRef() inout pure @trusted
247258
{
248259
enforce!JSONException(type == JSON_TYPE.OBJECT,
249260
"JSONValue is not an object");
250261
return store.object;
251262
}
252263

253-
/// Value getter/setter for $(D JSON_TYPE.ARRAY).
254-
/// Throws: $(D JSONException) for read access if $(D type) is not
255-
/// $(D JSON_TYPE.ARRAY).
256-
/* Note: this is @system because of the following pattern:
264+
/***
265+
* Value getter/setter for $(D JSON_TYPE.ARRAY).
266+
* Throws: $(D JSONException) for read access if $(D type) is not
267+
* $(D JSON_TYPE.ARRAY).
268+
* Note: this is @system because of the following pattern:
257269
---
258270
auto a = &(json.array());
259271
json.uinteger = 0; // overwrite array pointer
@@ -273,20 +285,22 @@ struct JSONValue
273285
return v;
274286
}
275287

276-
/// Value getter for $(D JSON_TYPE.ARRAY).
277-
/// Unlike $(D array), this retrieves the array by value and can be used in @safe code.
278-
///
279-
/// A caveat is that, if you append to the returned array, the new values aren't visible in the
280-
/// JSONValue:
281-
/// ---
282-
/// JSONValue json;
283-
/// json.array = [JSONValue("hello")];
284-
/// json.arrayNoRef ~= JSONValue("world");
285-
/// assert(json.array.length == 1);
286-
/// ---
287-
///
288-
/// Throws: $(D JSONException) for read access if $(D type) is not
289-
/// $(D JSON_TYPE.ARRAY).
288+
/***
289+
* Value getter for $(D JSON_TYPE.ARRAY).
290+
* Unlike $(D array), this retrieves the array by value and can be used in @safe code.
291+
*
292+
* A caveat is that, if you append to the returned array, the new values aren't visible in the
293+
* JSONValue:
294+
* ---
295+
* JSONValue json;
296+
* json.array = [JSONValue("hello")];
297+
* json.arrayNoRef ~= JSONValue("world");
298+
* assert(json.array.length == 1);
299+
* ---
300+
*
301+
* Throws: $(D JSONException) for read access if $(D type) is not
302+
* $(D JSON_TYPE.ARRAY).
303+
*/
290304
@property inout(JSONValue[]) arrayNoRef() inout pure @trusted
291305
{
292306
enforce!JSONException(type == JSON_TYPE.ARRAY,
@@ -411,7 +425,7 @@ struct JSONValue
411425
* $(D long), $(D double), an associative array $(D V[K]) for any $(D V)
412426
* and $(D K) i.e. a JSON object, any array or $(D bool). The type will
413427
* be set accordingly.
414-
*/
428+
*/
415429
this(T)(T arg) if (!isStaticArray!T)
416430
{
417431
assign(arg);
@@ -450,8 +464,10 @@ struct JSONValue
450464
assignRef(arg);
451465
}
452466

453-
/// Array syntax for json arrays.
454-
/// Throws: $(D JSONException) if $(D type) is not $(D JSON_TYPE.ARRAY).
467+
/***
468+
* Array syntax for json arrays.
469+
* Throws: $(D JSONException) if $(D type) is not $(D JSON_TYPE.ARRAY).
470+
*/
455471
ref inout(JSONValue) opIndex(size_t i) inout pure @safe
456472
{
457473
auto a = this.arrayNoRef;
@@ -467,8 +483,10 @@ struct JSONValue
467483
assert( j[1].integer == 43 );
468484
}
469485

470-
/// Hash syntax for json objects.
471-
/// Throws: $(D JSONException) if $(D type) is not $(D JSON_TYPE.OBJECT).
486+
/***
487+
* Hash syntax for json objects.
488+
* Throws: $(D JSONException) if $(D type) is not $(D JSON_TYPE.OBJECT).
489+
*/
472490
ref inout(JSONValue) opIndex(string k) inout pure @safe
473491
{
474492
auto o = this.objectNoRef;
@@ -482,13 +500,15 @@ struct JSONValue
482500
assert( j["language"].str == "D" );
483501
}
484502

485-
/// Operator sets $(D value) for element of JSON object by $(D key).
486-
///
487-
/// If JSON value is null, then operator initializes it with object and then
488-
/// sets $(D value) for it.
489-
///
490-
/// Throws: $(D JSONException) if $(D type) is not $(D JSON_TYPE.OBJECT)
491-
/// or $(D JSON_TYPE.NULL).
503+
/***
504+
* Operator sets $(D value) for element of JSON object by $(D key).
505+
*
506+
* If JSON value is null, then operator initializes it with object and then
507+
* sets $(D value) for it.
508+
*
509+
* Throws: $(D JSONException) if $(D type) is not $(D JSON_TYPE.OBJECT)
510+
* or $(D JSON_TYPE.NULL).
511+
*/
492512
void opIndexAssign(T)(auto ref T value, string key) pure
493513
{
494514
enforceEx!JSONException(type == JSON_TYPE.OBJECT || type == JSON_TYPE.NULL,
@@ -649,18 +669,22 @@ struct JSONValue
649669
return result;
650670
}
651671

652-
/// Implicitly calls $(D toJSON) on this JSONValue.
653-
///
654-
/// $(I options) can be used to tweak the conversion behavior.
672+
/***
673+
* Implicitly calls $(D toJSON) on this JSONValue.
674+
*
675+
* $(I options) can be used to tweak the conversion behavior.
676+
*/
655677
string toString(in JSONOptions options = JSONOptions.none) const @safe
656678
{
657679
return toJSON(this, false, options);
658680
}
659681

660-
/// Implicitly calls $(D toJSON) on this JSONValue, like $(D toString), but
661-
/// also passes $(I true) as $(I pretty) argument.
662-
///
663-
/// $(I options) can be used to tweak the conversion behavior
682+
/***
683+
* Implicitly calls $(D toJSON) on this JSONValue, like $(D toString), but
684+
* also passes $(I true) as $(I pretty) argument.
685+
*
686+
* $(I options) can be used to tweak the conversion behavior
687+
*/
664688
string toPrettyString(in JSONOptions options = JSONOptions.none) const @safe
665689
{
666690
return toJSON(this, true, options);

0 commit comments

Comments
 (0)