Quick Links:

bal | bbl | bdl | bsl

Namespaces

Component bdljsn_jsonnull
[Package bdljsn]

Provide a type that represents the JSON null value. More...

Namespaces

namespace  bdljsn

Detailed Description

Outline
Purpose:
Provide a type that represents the JSON null value.
Classes:
bdljsn::JsonNull type that represents the JSON null value.
See also:
Component bdljsn_json
Description:
This component provides a single value-semantic type, bdljsn::JsonNull, that can represent the JSON null value. This provides a degenerate (extremely limited) set of the conventional functionality. Objects of this class can be:
  • default constructed
  • printed ("null" is output)
  • compared with each other (always equal).
Significantly, there is no way to specify or change the state of these objects. Thus, each object always has the same value as the others.
Additionally, support is provided for hashing via the hashAppend free function and also a swap function.
Usage:
In this section we show intended usage of this component.
Example 1: Basic Syntax:
The scenario below illustrates almost all of the supported operations on the bdljsn::JsonNull type:
First, we create a bdljsn::JsonNull object: Then, we examine the object's printed representation:
  bsl::ostringstream oss;
  oss << a;
  assert("null" == oss.str());
Next, we create a second object of that class and confirm that it equals the object created above.
  bdljsn::JsonNull b;
  assert( (a == b));
  assert(!(a != b));
Finally, we confirm that swapping the two objects has no effect.
  swap(a, b);
  assert(a == b);