Quick Links:

bal | bbl | bdl | bsl

Public Types | Public Member Functions

bdlb::IndexSpan Class Reference

#include <bdlb_indexspan.h>

List of all members.

Public Types

typedef bsl::size_t size_type

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (IndexSpan, bsl::is_trivially_copyable)
 BSLMF_NESTED_TRAIT_DECLARATION (IndexSpan, bdlb::HasPrintMethod)
 IndexSpan ()
 IndexSpan (size_type position, size_type length)
bool isEmpty () const
size_type length () const
size_type position () const
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 Component bdlb_indexspan


Member Typedef Documentation

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

Constructor & Destructor Documentation

bdlb::IndexSpan::IndexSpan (  ) 

Create an IndexSpan object with position and length of 0.

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

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


Member Function Documentation

bdlb::IndexSpan::BSLMF_NESTED_TRAIT_DECLARATION ( IndexSpan  ,
bsl::is_trivially_copyable   
)
bdlb::IndexSpan::BSLMF_NESTED_TRAIT_DECLARATION ( IndexSpan  ,
bdlb::HasPrintMethod   
)
bool bdlb::IndexSpan::isEmpty (  )  const

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

size_type bdlb::IndexSpan::length (  )  const

Return the length attribute.

size_type bdlb::IndexSpan::position (  )  const

Return the position attribute.

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: