BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdld::DatumError Class Reference

#include <bdld_datumerror.h>

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (DatumError, bsl::is_trivially_copyable)
 
 BSLMF_NESTED_TRAIT_DECLARATION (DatumError, bdlb::HasPrintMethod)
 
 DatumError ()
 
 DatumError (int code)
 
 DatumError (int code, const bslstl::StringRef &message)
 
 DatumError (const DatumError &origin)=default
 
 ~DatumError ()=default
 
DatumErroroperator= (const DatumError &rhs)=default
 
int code () const
 Return the error code.
 
bslstl::StringRef message () const
 
bsl::ostream & print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
 

Detailed Description

This component class provides a complex constrained attribute type, bdld::DatumError, that represents an error code with an optional descriptive error message. Note that this class holds a reference to the error message and does not make a copy of it.

See bdld_datumerror

Constructor & Destructor Documentation

◆ DatumError() [1/4]

bdld::DatumError::DatumError ( )
inline

Create a DatumError object having the default error code of 0 and an empty error message.

◆ DatumError() [2/4]

bdld::DatumError::DatumError ( int  code)
inlineexplicit

Create a DatumError object having the specified error code value and and empty error message.

◆ DatumError() [3/4]

bdld::DatumError::DatumError ( int  code,
const bslstl::StringRef message 
)
inline

Create a DatumError object having the specified error code value and the specified error message value. Note that the message is held by the reference and not copied.

◆ DatumError() [4/4]

bdld::DatumError::DatumError ( const DatumError origin)
default

◆ ~DatumError()

bdld::DatumError::~DatumError ( )
default

Member Function Documentation

◆ BSLMF_NESTED_TRAIT_DECLARATION() [1/2]

bdld::DatumError::BSLMF_NESTED_TRAIT_DECLARATION ( DatumError  ,
bdlb::HasPrintMethod   
)

◆ BSLMF_NESTED_TRAIT_DECLARATION() [2/2]

bdld::DatumError::BSLMF_NESTED_TRAIT_DECLARATION ( DatumError  ,
bsl::is_trivially_copyable   
)

◆ code()

int bdld::DatumError::code ( ) const
inline

◆ message()

bslstl::StringRef bdld::DatumError::message ( ) const
inline

Return a reference to the non-modifyable error message. The returned reference remains valid as long as the underlying message is not modified or destroyed – irrespective of the state (or existence) of this object. The behavior is undefined unless the underlying error message has been modified or destroyed since this object was created.

◆ operator=()

DatumError & bdld::DatumError::operator= ( const DatumError rhs)
default

◆ print()

bsl::ostream & bdld::DatumError::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 reference to the modifyable 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, suppress all but the initial indentation (as governed by level). For readability the entire output is formatted on one line, regardless of the spacesPerLevel value. If stream is not valid on entry, this operation has no effect. Note that this human-readable format is not fully specified, and can change without notice.


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