JsonCpp project page | Classes | Namespace | JsonCpp home page

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Json::Features Class Reference

Configuration passed to reader and writer. More...

`#include <json/json_features.h>`

Collaboration diagram for Json::Features:

## Public Member Functions
| Features ()
| Initialize the configuration like JsonConfig::allFeatures;.

## Static Public Member Functions
static Features | all ()
| A configuration that allows all features and assumes all strings are UTF-8.
static Features | strictMode ()
| A configuration that is strictly compatible with the JSON specification.

## Public Attributes
bool | allowComments_ {true}
| `true` if comments are allowed. Default: `true`.
bool | strictRoot_ {false}
| `true` if root must be either an array or an object value.
bool | allowDroppedNullPlaceholders_ {false}
| `true` if dropped null placeholders are allowed. Default: `false`.
bool | allowNumericKeys_ {false}
| `true` if numeric object key are allowed. Default: `false`.

## Detailed Description

Configuration passed to reader and writer.

This configuration object can be used to force the Reader or Writer to behave in a standard conforming way.

Definition at line 22 of file json_features.h.

## Constructor & Destructor Documentation

## ◆ Features()

Json::Features::Features | ( |  | ) |
| default

Initialize the configuration like JsonConfig::allFeatures;.

## Member Function Documentation

## ◆ all()

Features Json::Features::all | ( |  | ) |
| static

A configuration that allows all features and assumes all strings are UTF-8.

- C & C++ comments are allowed
- Root object can be any JSON value
- Assumes Value strings are encoded in UTF-8

Definition at line 67 of file json_reader.cpp.

## ◆ strictMode()

Features Json::Features::strictMode | ( |  | ) |
| static

A configuration that is strictly compatible with the JSON specification.

- Comments are forbidden.
- Root object must be either an array or an object value.
- Assumes Value strings are encoded in UTF-8

Definition at line 69 of file json_reader.cpp.

References allowComments_, allowDroppedNullPlaceholders_, allowNumericKeys_, and strictRoot_.

## Member Data Documentation

## ◆ allowComments_

bool Json::Features::allowComments_ {true}

`true` if comments are allowed. Default: `true`.

Definition at line 45 of file json_features.h.

Referenced by Json::Reader::parse(), and strictMode().

## ◆ allowDroppedNullPlaceholders_

bool Json::Features::allowDroppedNullPlaceholders_ {false}

`true` if dropped null placeholders are allowed. Default: `false`.

Definition at line 52 of file json_features.h.

Referenced by strictMode().

## ◆ allowNumericKeys_

bool Json::Features::allowNumericKeys_ {false}

`true` if numeric object key are allowed. Default: `false`.

Definition at line 55 of file json_features.h.

Referenced by strictMode().

## ◆ strictRoot_

bool Json::Features::strictRoot_ {false}

`true` if root must be either an array or an object value.

Default: `false`.

Definition at line 49 of file json_features.h.

Referenced by Json::Reader::parse(), and strictMode().

The documentation for this class was generated from the following files:

- include/json/json_features.h
- src/lib_json/json_reader.cpp