| Exiv2

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
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
using | iterator = typename storage_type<data_type>::iterator
using | const_iterator = typename storage_type<data_type>::const_iterator
using | value_type = typename storage_type<data_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 noexcept
const_iterator | cend () const noexcept
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 noexcept

## Protected Attributes
storage_type< data_type > | storage_
Protected Attributes inherited from Exiv2::Internal::SliceBase
size_t | begin_
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 constructor, requires begin to be smaller than end, otherwise an exception is thrown. Also forwards all parameters to the constructor of storage_

References 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 storage_.

## ◆ cbegin()

template<template< typename data_type > class storage_type, typename data_type>

const_iterator Exiv2::Internal::ConstSliceBase< storage_type, data_type >::cbegin | ( |  | ) | const
| inline nodiscard noexcept

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

References Exiv2::Internal::SliceBase::begin_, and storage_.

## ◆ cend()

template<template< typename data_type > class storage_type, typename data_type>

const_iterator Exiv2::Internal::ConstSliceBase< storage_type, data_type >::cend | ( |  | ) | const
| inline nodiscard noexcept

Obtain a constant iterator to the first beyond the slice.

References 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 nodiscard

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 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 at(), Exiv2::Internal::MutableSliceBase< storage_type, data_type >::at(), Exiv2::Internal::MutableSliceBase< storage_type, data_type >::begin(), cbegin(), cend(), ConstSliceBase(), Exiv2::Internal::MutableSliceBase< storage_type, data_type >::end(), subSlice(), and Exiv2::Internal::MutableSliceBase< storage_type, data_type >::subSlice().

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

- slice.hpp