BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdljsn_jsonnull

Detailed Description

Outline

Purpose

Provide a type that represents the JSON null value.

Classes

See also
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:

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:

Definition bdljsn_jsonnull.h:119

Then, we examine the object's printed representation:

oss << a;
assert("null" == oss.str());
Definition bslstl_ostringstream.h:175
void str(const StringType &value)
Definition bslstl_ostringstream.h:581

Next, we create a second object of that class and confirm that it equals the object created above.

assert( (a == b));
assert(!(a != b));

Finally, we confirm that swapping the two objects has no effect.

swap(a, b);
assert(a == b);