| Exiv2

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
Exiv2::Internal::MutableSliceBase< storage_type, data_type > Struct Template Reference

`#include <slice.hpp>`

Inheritance diagram for Exiv2::Internal::MutableSliceBase< storage_type, data_type >:
[legend]

## Public Types
using | iterator = typename ConstSliceBase<storage_type, data_type>::iterator
using | const_iterator = typename ConstSliceBase<storage_type, data_type>::const_iterator
using | value_type = typename ConstSliceBase<storage_type, data_type>::value_type
Public Types inherited from Exiv2::Internal::ConstSliceBase< storage_type, data_type >
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
value_type & | at (size_t index)
const value_type & | at (size_t index) const
iterator | begin () noexcept
iterator | end () noexcept
Public Member Functions inherited from Exiv2::Internal::ConstSliceBase< storage_type, data_type >
| 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 Member Functions
template<typename slice_type>
slice_type | subSlice (size_t begin, size_t end)
Protected Member Functions inherited from Exiv2::Internal::SliceBase
void | rangeCheck (size_t index) const

## Additional Inherited Members
Protected Attributes inherited from Exiv2::Internal::ConstSliceBase< storage_type, data_type >
storage_type< data_type > | storage_
Protected Attributes inherited from Exiv2::Internal::SliceBase
size_t | begin_
size_t | end_

## Detailed Description

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

This class provides all public-facing non-const-qualified methods of slices. It only re-implements the const-qualified versions as non-const.

## Member Function Documentation

## ◆ at()

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

value_type & Exiv2::Internal::MutableSliceBase< storage_type, data_type >::at | ( | size_t | index | ) |
| inline

Obtain a 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_.

Referenced by Exiv2::getUShort(), and Exiv2::IptcData::printStructure().

## ◆ begin()

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

iterator Exiv2::Internal::MutableSliceBase< storage_type, data_type >::begin | ( |  | ) |
| inline noexcept

Obtain an iterator to the first element in the slice.

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

Referenced by Exiv2::Slice< const T * >::Slice(), and subSlice().

## ◆ end()

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

iterator Exiv2::Internal::MutableSliceBase< storage_type, data_type >::end | ( |  | ) |
| inline noexcept

Obtain an iterator to the first element beyond the slice.

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

Referenced by Exiv2::Slice< const T * >::Slice(), and subSlice().

## ◆ subSlice()

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

slice_type Exiv2::Internal::MutableSliceBase< storage_type, data_type >::subSlice | ( | size_t | begin,
|  | size_t | end )
| inline protected

Explicitly convert this instance into a base-class of the appropriate constant version of this slice.

This function is required to properly implement the subSlice() const function for mutable slices. The problem here is, that a slice<T> and a slice<const T> actually don't share the same base class ConstSliceBase<storage_type, T>. Instead slice<T> inherits from ConstSliceBase<storage_type, T> and slice<const T> inherits from ConstSliceBase<storage_type, const T>.

Now, slice<T> can call the subSlice() const method from its base class, but that will return a mutable slice<T>! Instead we use this function to convert the `slice<T> into the parent of the appropriate slice<const T> and call its subSlice() const, which returns the correct type. */ [[nodiscard]] ConstSliceBase<storage_type, const data_type> to_const_base() const noexcept { return {this->storage_.data_, this->begin_, this->end_}; }

using base_type = ConstSliceBase<storage_type, data_type>;

/*! Create a mutable 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 begin(), Exiv2::Internal::SliceBase::begin_, end(), Exiv2::Internal::SliceBase::rangeCheck(), and Exiv2::Internal::ConstSliceBase< storage_type, data_type >::storage_.

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

- slice.hpp