Exiv2::Internal::ConstSliceBase< storage_type, data_type > Struct Template Reference

This class provides the public-facing const-qualified methods of a slice. More...

#include <slice.hpp>

Inheritance diagram for Exiv2::Internal::ConstSliceBase< storage_type, data_type >:

Public Types

typedef storage_type< data_type >::iterator iterator
 
typedef storage_type< data_type >::const_iterator const_iterator
 
typedef storage_type< data_type >::value_type value_type
 

Public Member Functions

 ConstSliceBase (data_type &data, size_t begin, size_t end)
 
const value_type & at (size_t index) const
 
const_iterator cbegin () const throw ()
 
const_iterator cend () const throw ()
 
template<typename slice_type >
slice_type subSlice (size_t begin, size_t end) const
 
- Public Member Functions inherited from Exiv2::Internal::SliceBase
 SliceBase (size_t begin, size_t end)
 
size_t size () const throw ()
 

Protected Attributes

storage_type< data_type > storage_
 
- Protected Attributes inherited from Exiv2::Internal::SliceBase
const size_t begin_
 
const size_t end_
 

Additional Inherited Members

- Protected Member Functions inherited from Exiv2::Internal::SliceBase
void rangeCheck (size_t index) const
 

Detailed Description

template<template< typename data_type > class storage_type, typename data_type>
struct Exiv2::Internal::ConstSliceBase< storage_type, data_type >

This class provides the public-facing const-qualified methods of a slice.

The public methods are implemented in a generic fashion using a storage_type. This type contains the actual reference to the data to which the slice points and provides the following methods:

  • (const) value_type& unsafeAt(size_t index) (const) Return the value at the given index of the underlying container, without promising to perform a range check and without any knowledge of the slices' size
  • const_iterator/iterator unsafeGetIteratorAt(size_t index) (const) Return a (constant) iterator at the given index of the underlying container. Again, no range checks are promised.
  • Constructor(data_type& data, size_t begin, size_t end) Can use begin & end to perform range checks on data, but should not store both values. Must not take ownership of data!
  • Must save data as a public member named data_.
  • Must provide appropriate typedefs for iterator, const_iterator and value_type

Constructor & Destructor Documentation

◆ ConstSliceBase()

template<template< typename data_type > class storage_type, typename data_type>
Exiv2::Internal::ConstSliceBase< storage_type, data_type >::ConstSliceBase ( data_type &  data,
size_t  begin,
size_t  end 
)
inline

Default contructor, requires begin to be smaller than end, otherwise an exception is thrown. Also forwards all parameters to the constructor of storage_

Member Function Documentation

◆ at()

template<template< typename data_type > class storage_type, typename data_type>
const value_type& Exiv2::Internal::ConstSliceBase< storage_type, data_type >::at ( size_t  index) const
inline

Obtain a constant reference to the element with the specified index in the slice.

Exceptions
std::out_of_rangewhen index is out of bounds of the slice

◆ cbegin()

template<template< typename data_type > class storage_type, typename data_type>
const_iterator Exiv2::Internal::ConstSliceBase< storage_type, data_type >::cbegin ( ) const
throw (
)
inline

Obtain a constant iterator to the first element in the slice.

◆ cend()

template<template< typename data_type > class storage_type, typename data_type>
const_iterator Exiv2::Internal::ConstSliceBase< storage_type, data_type >::cend ( ) const
throw (
)
inline

Obtain a constant iterator to the first beyond the slice.

◆ subSlice()

template<template< typename data_type > class storage_type, typename data_type>
template<typename slice_type >
slice_type Exiv2::Internal::ConstSliceBase< storage_type, data_type >::subSlice ( size_t  begin,
size_t  end 
) const
inline

Create a constant sub-slice with the given bounds (with respect to the current slice).

Template Parameters
slice_typeType of the slice that this function shall return. Provide it with the type of the class that derives from mutable_slice_base.

Member Data Documentation

◆ storage_

template<template< typename data_type > class storage_type, typename data_type>
storage_type<data_type> Exiv2::Internal::ConstSliceBase< storage_type, data_type >::storage_
protected

Stores a reference to the actual data.


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