BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bdljsn::WriteOptions Class Reference

#include <bdljsn_writeoptions.h>

Detailed Description

This simply constrained (value-semantic) attribute class specifies options for writing a JSON document. See the Attributes for information on the class attributes.

Note
Note that the class invariants are identically the constraints on the individual attributes.

See bdljsn_writeoptions

Public Member Functions

 WriteOptions ()
 
 WriteOptions (const WriteOptions &original)
 
 ~WriteOptions ()
 
WriteOptionsoperator= (const WriteOptions &rhs)
 
WriteOptionsreset ()
 
WriteOptionssetEscapeForwardSlash (bool value)
 
WriteOptionssetInitialIndentLevel (int value)
 
WriteOptionssetSortMembers (bool value)
 
WriteOptionssetSpacesPerLevel (int value)
 
WriteOptionssetStyle (bdljsn::WriteStyle::Enum value)
 
bool escapeForwardSlash () const
 
int initialIndentLevel () const
 
bool sortMembers () const
 
int spacesPerLevel () const
 
bdljsn::WriteStyle::Enum style () const
 
bsl::ostream & print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
 

Static Public Attributes

static const int s_DEFAULT_INITIALIZER_INITIAL_INDENT_LEVEL
 
static const bool s_DEFAULT_INITIALIZER_SORT_MEMBERS
 
static const bool s_DEFAULT_INITIALIZER_ESCAPE_FORWARD_SLASH
 
static const int s_DEFAULT_INITIALIZER_SPACES_PER_LEVEL
 
static const bdljsn::WriteStyle::Enum s_DEFAULT_INITIALIZER_STYLE
 

Constructor & Destructor Documentation

◆ WriteOptions() [1/2]

bdljsn::WriteOptions::WriteOptions ( )

Create an object of type WriteOptions having the (default) attribute values:

sortMembers() == false
style() == e_COMPACT
int initialIndentLevel() const
Return the initialIndentLevel attribute of this object.
Definition bdljsn_writeoptions.h:367
bool escapeForwardSlash() const
Return the escapeForwardSlash attribute of this object.
Definition bdljsn_writeoptions.h:361
bool sortMembers() const
Return the sortMembers attribute of this object.
Definition bdljsn_writeoptions.h:373
int spacesPerLevel() const
Return the spacesPerLevel attribute of this object.
Definition bdljsn_writeoptions.h:379
bdljsn::WriteStyle::Enum style() const
Return the style attribute of this object.
Definition bdljsn_writeoptions.h:385

◆ WriteOptions() [2/2]

bdljsn::WriteOptions::WriteOptions ( const WriteOptions original)
inline

Create an object of type WriteOptions having the value of the specified original object.

◆ ~WriteOptions()

bdljsn::WriteOptions::~WriteOptions ( )
inline

Destroy this object.

Member Function Documentation

◆ escapeForwardSlash()

bool bdljsn::WriteOptions::escapeForwardSlash ( ) const
inline

Return the escapeForwardSlash attribute of this object.

◆ initialIndentLevel()

int bdljsn::WriteOptions::initialIndentLevel ( ) const
inline

Return the initialIndentLevel attribute of this object.

◆ operator=()

WriteOptions & bdljsn::WriteOptions::operator= ( const WriteOptions rhs)
inline

Assign to this object the value of the specified rhs object and return a non-const reference to this object.

◆ print()

bsl::ostream & bdljsn::WriteOptions::print ( bsl::ostream &  stream,
int  level = 0,
int  spacesPerLevel = 4 
) const

Format this object to the specified output stream at the optionally specified indentation level and return a reference to the modifiable stream. If level is specified, optionally specify spacesPerLevel, the number of spaces per indentation level for this and all of its nested objects. Each line is indented by the absolute value of level * spacesPerLevel. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, suppress line breaks and format the entire output on one line. If stream is initially invalid, this operation has no effect.

Note
Note that a trailing newline is provided in multiline mode only. Also note that the format is not fully specified, and can change without notice.

◆ reset()

WriteOptions & bdljsn::WriteOptions::reset ( )

Reset this object to the default value (i.e., its value upon default construction) and return a non-const reference to this object.

◆ setEscapeForwardSlash()

WriteOptions & bdljsn::WriteOptions::setEscapeForwardSlash ( bool  value)
inline

Set the escapeForwardSlash attribute of this object to the specified value and return a non-const reference to this object.

◆ setInitialIndentLevel()

WriteOptions & bdljsn::WriteOptions::setInitialIndentLevel ( int  value)
inline

Set the initialIndentLevel attribute of this object to the specified value and return a non-const reference to this object.

Precondition
The behavior is undefined unless 0 <= value.

◆ setSortMembers()

WriteOptions & bdljsn::WriteOptions::setSortMembers ( bool  value)
inline

Set the sortMembers attribute of this object to the specified value and return a non-const reference to this object.

◆ setSpacesPerLevel()

WriteOptions & bdljsn::WriteOptions::setSpacesPerLevel ( int  value)
inline

Set the spacesPerLevel attribute of this object to the specified value and return a non-const reference to this object.

Precondition
The behavior is undefined unless 0 <= value.

◆ setStyle()

WriteOptions & bdljsn::WriteOptions::setStyle ( bdljsn::WriteStyle::Enum  value)
inline

Set the style attribute of this object to the specified value and return a non-const reference to this object.

◆ sortMembers()

bool bdljsn::WriteOptions::sortMembers ( ) const
inline

Return the sortMembers attribute of this object.

◆ spacesPerLevel()

int bdljsn::WriteOptions::spacesPerLevel ( ) const
inline

Return the spacesPerLevel attribute of this object.

◆ style()

bdljsn::WriteStyle::Enum bdljsn::WriteOptions::style ( ) const
inline

Return the style attribute of this object.

Member Data Documentation

◆ s_DEFAULT_INITIALIZER_ESCAPE_FORWARD_SLASH

const bool bdljsn::WriteOptions::s_DEFAULT_INITIALIZER_ESCAPE_FORWARD_SLASH
static

◆ s_DEFAULT_INITIALIZER_INITIAL_INDENT_LEVEL

const int bdljsn::WriteOptions::s_DEFAULT_INITIALIZER_INITIAL_INDENT_LEVEL
static

◆ s_DEFAULT_INITIALIZER_SORT_MEMBERS

const bool bdljsn::WriteOptions::s_DEFAULT_INITIALIZER_SORT_MEMBERS
static

◆ s_DEFAULT_INITIALIZER_SPACES_PER_LEVEL

const int bdljsn::WriteOptions::s_DEFAULT_INITIALIZER_SPACES_PER_LEVEL
static

◆ s_DEFAULT_INITIALIZER_STYLE

const bdljsn::WriteStyle::Enum bdljsn::WriteOptions::s_DEFAULT_INITIALIZER_STYLE
static

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