BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlb::IndexSpan Class Reference

#include <bdlb_indexspan.h>

Public Types

typedef bsl::size_t size_type
 The type of the position and length attributes.
 

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (IndexSpan, bsl::is_trivially_copyable)
 
 BSLMF_NESTED_TRAIT_DECLARATION (IndexSpan, bdlb::HasPrintMethod)
 
 IndexSpan ()
 Create an IndexSpan object with position and length of 0.
 
 IndexSpan (size_type position, size_type length)
 
 IndexSpan (const IndexSpan &original)=default
 
 ~IndexSpan ()=default
 
IndexSpanoperator= (const IndexSpan &rhs)=default
 
bool isEmpty () const
 
size_type length () const
 Return the length attribute.
 
size_type position () const
 Return the position attribute.
 
bsl::ostream & print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
 

Detailed Description

A constrained attribute type that represents a position and a length. The constraint is that the sum of the position and length attributes must be representable by the bsl::size_t type.

See bdlb_indexspan

Member Typedef Documentation

◆ size_type

typedef bsl::size_t bdlb::IndexSpan::size_type

Constructor & Destructor Documentation

◆ IndexSpan() [1/3]

bdlb::IndexSpan::IndexSpan ( )
inline

◆ IndexSpan() [2/3]

bdlb::IndexSpan::IndexSpan ( size_type  position,
size_type  length 
)
inline

Create an IndexSpan object with the specified position and length. The behavior is undefined unless position <= bsl::numeric_limits<size_t>::max() - length.

◆ IndexSpan() [3/3]

bdlb::IndexSpan::IndexSpan ( const IndexSpan original)
default

Create an index span having the value of the specified original index span. Note that this trivial copy constructor is generated by the compiler.

◆ ~IndexSpan()

bdlb::IndexSpan::~IndexSpan ( )
default

Destroy this index span object. Note that this trivial destructor is generated by the compiler.

Member Function Documentation

◆ BSLMF_NESTED_TRAIT_DECLARATION() [1/2]

bdlb::IndexSpan::BSLMF_NESTED_TRAIT_DECLARATION ( IndexSpan  ,
bdlb::HasPrintMethod   
)

◆ BSLMF_NESTED_TRAIT_DECLARATION() [2/2]

bdlb::IndexSpan::BSLMF_NESTED_TRAIT_DECLARATION ( IndexSpan  ,
bsl::is_trivially_copyable   
)

◆ isEmpty()

bool bdlb::IndexSpan::isEmpty ( ) const
inline

Return true if the length attribute is 0; and return false otherwise.

◆ length()

IndexSpan::size_type bdlb::IndexSpan::length ( ) const
inline

◆ operator=()

IndexSpan & bdlb::IndexSpan::operator= ( const IndexSpan rhs)
default

Assign to this index span the value of the specified rhs index span, and return a reference providing modifiable access to this object. Note that this trivial assignment operation is generated by the compiler.

◆ position()

IndexSpan::size_type bdlb::IndexSpan::position ( ) const
inline

◆ print()

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

Format this object to the specified output stream at the (absolute value of) the optionally specified indentation level and return a reference to stream. If level is specified, optionally specify spacesPerLevel, 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.


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