Skip to content

Commit

Permalink
Merge pull request #1694 from John-Colvin/patch-5
Browse files Browse the repository at this point in the history
Documetation fixes

Conflicts:
	std/json.d
  • Loading branch information
MartinNowak committed Dec 16, 2013
2 parents d5ddbb4 + 8550c88 commit 436f284
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions std/json.d
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ enum JSON_TYPE : byte
/// Indicates the type of a $(D JSONValue).
STRING,
INTEGER, /// ditto
UINTEGER,/// integers > 2^63-1
UINTEGER,/// ditto
FLOAT, /// ditto
OBJECT, /// ditto
ARRAY, /// ditto
Expand Down Expand Up @@ -248,17 +248,28 @@ struct JSONValue
}
}


/**
* Constructor for $(D JSONValue). If $(D arg) is a $(D JSONValue)
* its value and type will be copied to the new $(D JSONValue).
* Note that this is a shallow copy: if type is $(D JSON_TYPE.OBJECT)
* or $(D JSON_TYPE.ARRAY) then only the reference to the data will
* be copied.
* Otherwise, $(D arg) must be implicitly convertible to one of the
* following types: $(D typeof(null)), $(D string), $(D ulong),
* $(D long), $(D real), an associative array $(D V[K]) for any $(D V)
* and $(D K) i.e. a JSON object, any array or $(D bool). The type will
* be set accordingly.
*/
this(T)(T arg) if(!isStaticArray!T)
{
assign(arg);
}

/// Ditto
this(T)(ref T arg) if(isStaticArray!T)
{
assignRef(arg);
}

/// Ditto
this(T : JSONValue)(inout T arg) inout
{
store = arg.store;
Expand Down Expand Up @@ -293,6 +304,7 @@ struct JSONValue
return store.object[k];
}

/// Implements the foreach $(D opApply) interface for json arrays.
int opApply(int delegate(size_t index, ref JSONValue) dg)
{
enforceEx!JSONException(type == JSON_TYPE.ARRAY,
Expand All @@ -309,7 +321,7 @@ struct JSONValue
return result;
}

/// Implements foreach interface json objects.
/// Implements the foreach $(D opApply) interface for json objects.
int opApply(int delegate(string key, ref JSONValue) dg)
{
enforceEx!JSONException(type == JSON_TYPE.OBJECT,
Expand Down

0 comments on commit 436f284

Please sign in to comment.