Loading...
Searching...
No Matches
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 >:
[legend]

## 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_range | when index is out of bounds of the slice

References Exiv2::Internal::SliceBase::begin_, Exiv2::Internal::SliceBase::rangeCheck(), and Exiv2::Internal::ConstSliceBase< storage_type, data_type >::storage_.

## 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.

References Exiv2::Internal::SliceBase::begin_, and Exiv2::Internal::ConstSliceBase< storage_type, data_type >::storage_.

## 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.

References Exiv2::Internal::ConstSliceBase< storage_type, data_type >::storage_.

## 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_type | Type of the slice that this function shall return. Provide it with the type of the class that derives from mutable_slice_base.

References Exiv2::Internal::SliceBase::begin_, Exiv2::Internal::SliceBase::rangeCheck(), and Exiv2::Internal::ConstSliceBase< storage_type, data_type >::storage_.

## 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.

Referenced by Exiv2::Internal::MutableSliceBase< storage_type, data_type >::at(), Exiv2::Internal::ConstSliceBase< storage_type, data_type >::at(), Exiv2::Internal::MutableSliceBase< storage_type, data_type >::begin(), Exiv2::Internal::ConstSliceBase< storage_type, data_type >::cbegin(), Exiv2::Internal::ConstSliceBase< storage_type, data_type >::cend(), Exiv2::Internal::MutableSliceBase< storage_type, data_type >::end(), Exiv2::Internal::MutableSliceBase< storage_type, data_type >::subSlice(), Exiv2::Internal::ConstSliceBase< storage_type, data_type >::subSlice(), and Exiv2::Internal::MutableSliceBase< storage_type, data_type >::to_const_base().

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

- slice.hpp