DCMTK  Version 3.6.6
OFFIS DICOM Toolkit
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. More...
 
typedef const OFdirectory_entrypointer
 OFdirectory_iterator's '->' operator will give you a pointer to a const OFdirectory_entry.
 
typedef const OFdirectory_entryreference
 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). More...
 
 OFdirectory_iterator (const OFdirectory_iterator &rhs)
 Copy construct an OFdirectory_iterator, referring to the same directory entry as the given one. More...
 
OFdirectory_iteratoroperator= (const OFdirectory_iterator &rhs)
 Assign a different OFdirectory_iterator to this one. More...
 
 ~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. More...
 
OFBool operator!= (const OFdirectory_iterator &rhs) const
 Compare an OFdirectory_iterator against another one. More...
 
OFdirectory_iteratoroperator++ ()
 Increment the iterator. More...
 
unspecified operator++ (int)
 Increment the iterator. More...
 
pointer operator-> () const
 Dereference the iterator. More...
 
reference operator* () const
 Dereference the iterator. More...
 

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
paththe 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
rhsthe 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.

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
rhsanother 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).

◆ 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

◆ 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
rhsanother 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.

◆ 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
rhsanother 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).

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


Generated on Thu Jan 14 2021 for DCMTK Version 3.6.6 by Doxygen 1.8.18