vibe.d beta banner
get vibe.d
0.7.30

Json.opBinaryRight - multiple declarations

  • Function Json.opBinaryRight
  • Function Json.opBinaryRight

Function Json.opBinaryRight

Performs binary operations between JSON values.

The two JSON values must be of the same run time type or a JSONException will be thrown. Only the operations listed are allowed for each of the types.

Null
none
Bool
&&, ||
Int
+, -, *, /, %
Float
+, -, *, /, %
String
~
Array
~
Object
in

Prototypes

Json opBinaryRight(string op)(
  bool other
) const;

Json opBinaryRight(string op)(
  long other
) const;

Json opBinaryRight(string op)(
  BigInt other
) const;

Json opBinaryRight(string op)(
  double other
) const;

Json opBinaryRight(string op)(
  string other
) const
if (op == "~");

Json opBinaryRight(string op)(
  Json[] other
);

Function Json.opBinaryRight

Checks wheter a particular key is set and returns a pointer to it.

For field that don't exist or have a type of Type.undefined, the in operator will return null.

Prototype

inout inout(Json)* opBinaryRight(string op)(
  string other
)
if (op == "in");

Example

auto j = Json.emptyObject;
j["a"] = "foo";
j["b"] = Json.undefined;

assert("a" in j);
assert(("a" in j).get!string == "foo");
assert("b" !in j);
assert("c" !in j);

Authors

Sönke Ludwig

Copyright

© 2012-2015 RejectedSoftware e.K.

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.