Quick Links: |
#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 () | |
Error & | operator= (const Error &rhs) |
Error & | operator= (bslmf::MovableRef< Error > rhs) |
Error & | reset () |
Error & | setLocation (const Location &value) |
Error & | setMessage (const bsl::string_view &value) |
void | swap (Error &other) |
const Location & | location () const |
const bsl::string & | message () const |
bslma::Allocator * | allocator () const |
bsl::ostream & | print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const |
Friends | |
void | swap (Error &, Error &) |
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.
bdljsn::Error::Error | ( | ) |
bdljsn::Error::Error | ( | bslma::Allocator * | basicAllocator | ) | [explicit] |
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.
bdljsn::Error::Error | ( | const Location & | location, | |
const bsl::string_view & | message, | |||
bslma::Allocator * | basicAllocator = 0 | |||
) |
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.
bdljsn::Error::Error | ( | const Error & | original, | |
bslma::Allocator * | basicAllocator = 0 | |||
) |
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.
bdljsn::Error::Error | ( | bslmf::MovableRef< Error > | original | ) |
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.
bdljsn::Error::Error | ( | bslmf::MovableRef< Error > | original, | |
bslma::Allocator * | basicAllocator | |||
) |
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.
bdljsn::Error::~Error | ( | ) |
Destroy this object.
bdljsn::Error::BSLMF_NESTED_TRAIT_DECLARATION | ( | Error | , | |
bslma::UsesBslmaAllocator | ||||
) |
bdljsn::Error::BSLMF_NESTED_TRAIT_DECLARATION | ( | Error | , | |
bslmf::IsBitwiseMoveable | ||||
) |
Assign to this object the value of the specified rhs
object, and return a non-'const' reference to this object.
Error& bdljsn::Error::operator= | ( | bslmf::MovableRef< Error > | rhs | ) |
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).
Error& bdljsn::Error::reset | ( | ) |
Reset this object to the default value (i.e., its value upon default construction).
Set the location
attribute of this object to the specified value
.
Error& bdljsn::Error::setMessage | ( | const bsl::string_view & | value | ) |
Set the message
attribute of this object to the specified value
.
void bdljsn::Error::swap | ( | Error & | other | ) |
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
.
const Location& bdljsn::Error::location | ( | ) | const |
Return the location
attribute of this object.
const bsl::string& bdljsn::Error::message | ( | ) | const |
Return the message
attribute of this object.
bslma::Allocator* bdljsn::Error::allocator | ( | ) | const |
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.
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.
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.