BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdljsn::Error Class Reference

#include <bdljsn_error.h>

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (Error, bslma::UsesBslmaAllocator)
 
 BSLMF_NESTED_TRAIT_DECLARATION (Error, bslmf::IsBitwiseMoveable)
 
 Error ()
 
 Error (bslma::Allocator *basicAllocator)
 
 Error (const Location &location, const bsl::string_view &message, bslma::Allocator *basicAllocator=0)
 
 Error (const Error &original, bslma::Allocator *basicAllocator=0)
 
 Error (bslmf::MovableRef< Error > original) BSLS_KEYWORD_NOEXCEPT
 
 Error (bslmf::MovableRef< Error > original, bslma::Allocator *basicAllocator)
 
 ~Error ()
 Destroy this object.
 
Erroroperator= (const Error &rhs)
 
Erroroperator= (bslmf::MovableRef< Error > rhs)
 
Errorreset ()
 
ErrorsetLocation (const Location &value)
 
ErrorsetMessage (const bsl::string_view &value)
 Set the message attribute of this object to the specified value.
 
void swap (Error &other)
 
const Locationlocation () const
 Return the location attribute of this object.
 
const bsl::stringmessage () const
 Return the message attribute of this object.
 
bslma::Allocatorallocator () const
 
bsl::ostream & print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
 

Friends

void swap (Error &, Error &)
 

Detailed Description

This unconstrained (value-semantic) attribute class specifies a description of an error in processing a (JSON) document. See the {Attributes} section under {DESCRIPTION} in the component-level documentation for information on the class attributes. Note that the class invariants are identically the constraints on the individual attributes.

See bdljsn_error

Constructor & Destructor Documentation

◆ Error() [1/6]

bdljsn::Error::Error ( )
inline

◆ Error() [2/6]

bdljsn::Error::Error ( bslma::Allocator basicAllocator)
inlineexplicit

Create an Error object having the default value (see {Attributes}). Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used.

◆ Error() [3/6]

bdljsn::Error::Error ( const Location location,
const bsl::string_view message,
bslma::Allocator basicAllocator = 0 
)
inline

Create an Error object having the specified location and message. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used.

◆ Error() [4/6]

bdljsn::Error::Error ( const Error original,
bslma::Allocator basicAllocator = 0 
)
inline

Create an Error object having the value of the specified original object. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used.

◆ Error() [5/6]

bdljsn::Error::Error ( bslmf::MovableRef< Error original)
inline

Create a Error object having the same value and the same allocator as the specified original object. The value of original becomes unspecified but valid, and its allocator remains unchanged.

◆ Error() [6/6]

bdljsn::Error::Error ( bslmf::MovableRef< Error original,
bslma::Allocator basicAllocator 
)
inline

Create a Error object having the same value as the specified original object, and using the specified basicAllocator to supply memory. If basicAllocator is 0, the currently installed default allocator is used. The allocator of original remains unchanged. If original and the newly created object have the same allocator then the value of original becomes unspecified but valid, and no exceptions will be thrown; otherwise original is unchanged and an exception may be thrown.

◆ ~Error()

bdljsn::Error::~Error ( )
inline

Member Function Documentation

◆ allocator()

bslma::Allocator * bdljsn::Error::allocator ( ) const
inline

Return the allocator used by this object to supply memory. Note that if no allocator was supplied at construction the default allocator in effect at construction is used.

◆ BSLMF_NESTED_TRAIT_DECLARATION() [1/2]

bdljsn::Error::BSLMF_NESTED_TRAIT_DECLARATION ( Error  ,
bslma::UsesBslmaAllocator   
)

◆ BSLMF_NESTED_TRAIT_DECLARATION() [2/2]

bdljsn::Error::BSLMF_NESTED_TRAIT_DECLARATION ( Error  ,
bslmf::IsBitwiseMoveable   
)

◆ location()

const Location & bdljsn::Error::location ( ) const
inline

◆ message()

const bsl::string & bdljsn::Error::message ( ) const
inline

◆ operator=() [1/2]

Error & bdljsn::Error::operator= ( bslmf::MovableRef< Error rhs)
inline

Assign to this object the value of the specified rhs object, and return a non-const reference to this object. The allocators of this object and rhs both remain unchanged. If rhs and this object have the same allocator then the value of rhs becomes unspecified but valid, and no exceptions will be thrown; otherwise rhs is unchanged (and an exception may be thrown).

◆ operator=() [2/2]

Error & bdljsn::Error::operator= ( const Error 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::Error::print ( bsl::ostream &  stream,
int  level = 0,
int  spacesPerLevel = 4 
) const

Write the value of this object to the specified output stream in a human-readable format, and return a non-const reference to stream. Optionally specify an initial indentation level, whose absolute value is incremented recursively for nested objects. If level is specified, optionally specify spacesPerLevel, whose absolute value indicates the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level). If stream is not valid on entry, this operation has no effect. Note that the format is not fully specified, and can change without notice.

◆ reset()

Error & bdljsn::Error::reset ( )
inline

Reset this object to the default value (i.e., its value upon default construction).

◆ setLocation()

Error & bdljsn::Error::setLocation ( const Location value)
inline

Set the location attribute of this object to the specified value.

◆ setMessage()

Error & bdljsn::Error::setMessage ( const bsl::string_view value)
inline

◆ swap()

void bdljsn::Error::swap ( Error other)
inline

Efficiently exchange the value of this object with the value of the specified other object. This method provides the no-throw exception-safety guarantee. The behavior is undefined unless this object was created with the same allocator as other.

Friends And Related Symbol Documentation

◆ swap

void swap ( Error ,
Error  
)
friend

Exchange the values of the specified a and b objects. This function provides the no-throw exception-safety guarantee if the two objects were created with the same allocator and the basic guarantee otherwise.


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