matador::json_format Class Reference

#include <json_format.hpp>

Public Member Functions

 json_format ()=default
 
 json_format (bool enable_line_break)
 
 json_format (unsigned indentation)
 
 json_format (bool enable_line_break, bool skip_empty, unsigned indentation)
 
bool show_line_break () const
 
bool skip_empty ()
 
unsigned indentation () const
 
char indentation_char () const
 

Static Public Attributes

static json_format compact
 
static json_format pretty
 

Detailed Description

The json_format class defines parameters how the json is formatted when it is written as a string.

Constructor & Destructor Documentation

◆ json_format() [1/4]

matador::json_format::json_format ( )
default

Default constructor

◆ json_format() [2/4]

matador::json_format::json_format ( bool  enable_line_break)
explicit

Creates a json format with enables line break if the given parameter is set to true

Parameters
enable_line_breakIf true json string json has line breaks

◆ json_format() [3/4]

matador::json_format::json_format ( unsigned  indentation)
explicit

Creates a json format with given number of indentation spaces

Parameters
indentationNumber of indentation spaces

◆ json_format() [4/4]

matador::json_format::json_format ( bool  enable_line_break,
bool  skip_empty,
unsigned  indentation 
)

Creates a json format object with flags for enabling line breaks and skip empty json values. Furthermore the number of indentation spaces is defined.

Parameters
enable_line_breakIf true json string json has line breaks
skip_emptyIf true empty json values are skipped
indentationNumber of indentation spaces

Member Function Documentation

◆ indentation()

unsigned matador::json_format::indentation ( ) const

Return the number of indentation spaces.

Returns
Return the number of indentation spaces

◆ indentation_char()

char matador::json_format::indentation_char ( ) const

Returns the indentation character.

Returns
Returns the indentation character

◆ show_line_break()

bool matador::json_format::show_line_break ( ) const

True if line breaks are enabled.

Returns
True if line breaks are enabled

◆ skip_empty()

bool matador::json_format::skip_empty ( )

True if empty json should be skipped.

Returns
True if empty json should be skipped

Member Data Documentation

◆ compact

json_format matador::json_format::compact
static

A default json format object for compact json formatting. Without spaces, linebreaks and indentation.

◆ pretty

json_format matador::json_format::pretty
static

A default json format object resulting in a pretty readable json string.


The documentation for this class was generated from the following file:
  • matador/json/json_format.hpp