DCMTK Version 3.6.9 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
OFdirectory_iterator Class Reference

An iterator for iterating over all the files (and folders) contained in a given filesystem location. More...

## Public Types
typedef OFdirectory_entry | value_type
| A valid OFdirectory_iterator refers to an OFdirectory_entry.
typedef STD_NAMESPACE ptrdiff_t | difference_type
| The distance between to OFdirectory_iterators would be measured as an std::ptrdiff_t.
typedef const OFdirectory_entry * | pointer
| OFdirectory_iterator's '->' operator will give you a pointer to a const OFdirectory_entry.
typedef const OFdirectory_entry & | reference
| OFdirectory_iterator's '*' operator will give you a const reference to an OFdirectory_entry.

## Public Member Functions
| OFdirectory_iterator ()
| Construct a past-the-end OFdirectory_iterator for being used as the sentinel when iterating.
| OFdirectory_iterator (const OFpath &path)
| Construct an OFdirectory_iterator for iterating over all the files (and folders) inside the given location (not recursively).
| OFdirectory_iterator (const OFdirectory_iterator &rhs)
| Copy construct an OFdirectory_iterator, referring to the same directory entry as the given one.
OFdirectory_iterator & | operator= (const OFdirectory_iterator &rhs)
| Assign a different OFdirectory_iterator to this one.
| ~OFdirectory_iterator ()
| Destroy an OFdirectory_iterator freeing the data needed for iterating.
OFBool | operator== (const OFdirectory_iterator &rhs) const
| Compare an OFdirectory_iterator against another one.
OFBool | operator!= (const OFdirectory_iterator &rhs) const
| Compare an OFdirectory_iterator against another one.
OFdirectory_iterator & | operator++ ()
| Increment the iterator.
unspecified | operator++ (int)
| Increment the iterator.
pointer | operator-> () const
| Dereference the iterator.
reference | operator* () const
| Dereference the iterator.

## Detailed Description

An iterator for iterating over all the files (and folders) contained in a given filesystem location.

OFdirectory_iterator implements a subset of the functionality described as std::filesystem::directory_iterator, see http://en.cppreference.com/w/cpp/filesystem/directory_iterator for more information.

## Member Typedef Documentation

## ◆ difference_type

typedef STD_NAMESPACE ptrdiff_t OFdirectory_iterator::difference_type

The distance between to OFdirectory_iterators would be measured as an std::ptrdiff_t.

Well, it cannot be measured since OFdirectory_iterator is an input iterator, but some code might depend on the type being defined, so we define it anyway.

## Constructor & Destructor Documentation

## ◆ OFdirectory_iterator() [1/2]

OFdirectory_iterator::OFdirectory_iterator | ( | const OFpath & | path | ) |

Construct an OFdirectory_iterator for iterating over all the files (and folders) inside the given location (not recursively).

Parameters

  path | the location to search for files in.

Note
  the special files "." and ".." will be skipped.

## ◆ OFdirectory_iterator() [2/2]

OFdirectory_iterator::OFdirectory_iterator | ( | const OFdirectory_iterator & | rhs | ) |

Copy construct an OFdirectory_iterator, referring to the same directory entry as the given one.

Parameters

  rhs | the iterator to copy.

Remarks
  OFdirectory_iterator uses an OFshared_ptr for all information needed for iterating, copy construction is therefore efficient and in constant time.

References OFdirectory_iterator().

## Member Function Documentation

## ◆ operator!=()

OFBool OFdirectory_iterator::operator!= | ( | const OFdirectory_iterator & | rhs | ) | const

Compare an OFdirectory_iterator against another one.

This is primarily used for comparing a potentially valid iterator against the past-the-end iterator OFdirectory_iterator() to determine whether the iterator refers to an directory entry or not.

Parameters

  rhs | another iterator to compare this one against.

Returns
  effectively: !( *this == rhs )

Note
  this operator explicitly does not compare the iterators semantically (i.e. whether both refer to the same directory entry).

References OFdirectory_iterator().

## ◆ operator*()

reference OFdirectory_iterator::operator* | ( |  | ) | const

Dereference the iterator.

Precondition
  *this != OFdirectory_iterator()

Returns
  a const reference the OFdirectory_entry object this iterator refers to.

## ◆ operator++() [1/2]

OFdirectory_iterator & OFdirectory_iterator::operator++ | ( |  | ) |

Increment the iterator.

Incrementing the iterator will make it refer to the next file in the originally given location or to path-the-end in case the current one was the last file.

Precondition
  *this != OFdirectory_iterator()

Returns
  *this

References OFdirectory_iterator(), and operator++().

Referenced by operator++().

## ◆ operator++() [2/2]

unspecified OFdirectory_iterator::operator++ | ( | int |  | ) |

Increment the iterator.

Incrementing the iterator will make it refer to the next file in the originally given location or to path-the-end in case the current one was the last file.

Precondition
  *this != OFdirectory_iterator()

Returns
  an object that, when dereferenced, refers to the directory entry that this iterator referred to before it was incremented.

Note
  Since OFdirectory_iterator is an input iterator, the iterator value from before incrementing it cannot be restored afterwards, such that this post increment operator cannot return an OFdirectory_iterator object as a normal post increment operator would.

## ◆ operator->()

pointer OFdirectory_iterator::operator-> | ( |  | ) | const

Dereference the iterator.

Precondition
  *this != OFdirectory_iterator()

Returns
  a pointer to the const OFdirectory_entry object this iterator refers to.

## ◆ operator=()

OFdirectory_iterator & OFdirectory_iterator::operator= | ( | const OFdirectory_iterator & | rhs | ) |

Assign a different OFdirectory_iterator to this one.

Parameters

  rhs | another iterator that will be copied into this one.

Returns
  *this

Remarks
  OFdirectory_iterator uses an OFshared_ptr for all information needed for iterating, copy assignment is therefore efficient and in constant time.

References OFdirectory_iterator().

## ◆ operator==()

OFBool OFdirectory_iterator::operator== | ( | const OFdirectory_iterator & | rhs | ) | const

Compare an OFdirectory_iterator against another one.

This is primarily used for comparing a potentially valid iterator against the past-the-end iterator OFdirectory_iterator() to determine whether the iterator refers to an directory entry or not.

Parameters

  rhs | another iterator to compare this one against.

Returns
  OFTrue if both iterators refer to past-the-end, OFFalse otherwise unless one of the given iterators was copy constructed or copy assigned from the other one.

Note
  this operator explicitly does not compare the iterators semantically (i.e. whether both refer to the same directory entry).

References OFdirectory_iterator().

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

- ofstd/include/dcmtk/ofstd/offilsys.h

Generated on Sat Mar 1 2025 for DCMTK Version 3.6.9 by Doxygen 1.13.2