Exiv2
Loading...
Searching...
No Matches
Exiv2::Internal::MutableSliceBase< storage_type, data_type > Struct Template Reference

#include <slice.hpp>

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

Public Types

typedef ConstSliceBase< storage_type, data_type >::iterator iterator
typedef ConstSliceBase< storage_type, data_type >::const_iterator const_iterator
typedef ConstSliceBase< storage_type, data_type >::value_type value_type
Public Types inherited from Exiv2::Internal::ConstSliceBase< storage_type, data_type >
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

 MutableSliceBase (data_type &data, size_t begin, size_t end)
value_type & at (size_t index)
const value_type & at (size_t index) const
iterator begin () throw ()
iterator end () throw ()
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 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 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
const size_t begin_
const 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.

Constructor & Destructor Documentation

◆ MutableSliceBase()

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

Forwards everything to the constructor of const_slice_base

References begin(), Exiv2::Internal::ConstSliceBase< storage_type, data_type >::ConstSliceBase(), and end().

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_rangewhen 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 ( )
throw ( )
inline

◆ end()

template<template< typename > class storage_type, typename data_type>
iterator Exiv2::Internal::MutableSliceBase< storage_type, data_type >::end ( )
throw ( )
inline

Obtain an iterator to the first element beyond the slice.

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

Referenced by MutableSliceBase(), 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 )
inlineprotected

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. */ ConstSliceBase<storage_type, const data_type> to_const_base() const throw() { return ConstSliceBase<storage_type, const data_type>(this->storage_.data_, this->begin_, this->end_); }

typedef ConstSliceBase<storage_type, data_type> base_type;

/*! Create a mutable 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.

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: