#include <slice.hpp>
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 Types | |
using | base_type = ConstSliceBase< storage_type, data_type > |
Protected Member Functions | |
ConstSliceBase< storage_type, const data_type > | to_const_base () const noexcept |
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_ |
This class provides all public-facing non-const-qualified methods of slices. It only re-implements the const-qualified versions as non-const.
|
inline |
Obtain a reference to the element with the specified index in the slice.
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().
|
inlinenoexcept |
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::Internal::MutableSliceBase< storage_type, data_type >::subSlice().
|
inlinenoexcept |
Obtain an iterator to the first element beyond the slice.
References Exiv2::Internal::ConstSliceBase< storage_type, data_type >::storage_.
Referenced by Exiv2::Internal::MutableSliceBase< storage_type, data_type >::subSlice().
|
inlineprotected |
Create a mutable sub-slice with the given bounds (with respect to the current slice).
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::MutableSliceBase< storage_type, data_type >::begin(), Exiv2::Internal::SliceBase::begin_, Exiv2::Internal::MutableSliceBase< storage_type, data_type >::end(), Exiv2::Internal::SliceBase::rangeCheck(), and Exiv2::Internal::ConstSliceBase< storage_type, data_type >::storage_.
|
inlineprotectednoexcept |
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.
References Exiv2::Internal::SliceBase::begin_, and Exiv2::Internal::ConstSliceBase< storage_type, data_type >::storage_.