Doxygen
Loading...
Searching...
No Matches
DirIterator Class Reference

#include <src/dir.h>

Classes

struct  Private
 

Public Types

using value_type = DirEntry
 
using difference_type = std::ptrdiff_t
 
using pointer = value_type*
 
using reference = value_type&
 
using iterator_category = std::input_iterator_tag
 

Public Member Functions

 DirIterator (const DirIterator &it)
 
DirIteratoroperator= (const DirIterator &it)
 
 DirIterator (DirIterator &&it)
 
DirIteratoroperator= (DirIterator &&it)
 
DirIterator operator++ ()
 
const value_typeoperator* () const
 
const value_typeoperator-> () const
 
 ~DirIterator ()
 

Private Member Functions

 DirIterator ()
 
 DirIterator (const std::string &path)
 

Private Attributes

std::unique_ptr< Privatep
 

Friends

class Dir
 
bool operator== (const DirIterator &it1, const DirIterator &it2)
 
bool operator!= (const DirIterator &it1, const DirIterator &it2)
 
DirIterator begin (DirIterator it)
 
DirIterator end (const DirIterator &)
 

Detailed Description

Definition at line 43 of file dir.h.

Member Typedef Documentation

◆ difference_type

using DirIterator::difference_type = std::ptrdiff_t

Definition at line 47 of file dir.h.

◆ iterator_category

using DirIterator::iterator_category = std::input_iterator_tag

Definition at line 50 of file dir.h.

◆ pointer

Definition at line 48 of file dir.h.

◆ reference

Definition at line 49 of file dir.h.

◆ value_type

Definition at line 46 of file dir.h.

Constructor & Destructor Documentation

◆ DirIterator() [1/4]

DirIterator::DirIterator ( const DirIterator & it)

Definition at line 104 of file dir.cpp.

104 : p(std::make_unique<Private>())
105{
106 p->it = it.p->it;
107 p->ec = it.p->ec;
108 p->current = it.p->current;
109}
std::unique_ptr< Private > p
Definition dir.h:70

References DirIterator(), and p.

Referenced by begin, DirIterator(), DirIterator(), end, operator!=, operator++(), operator=(), operator=(), and operator==.

◆ DirIterator() [2/4]

DirIterator::DirIterator ( DirIterator && it)

Definition at line 122 of file dir.cpp.

122 : p(std::make_unique<Private>())
123{
124 std::exchange(p->it,it.p->it);
125 std::exchange(p->ec,it.p->ec);
126 std::exchange(p->current,it.p->current);
127}

References DirIterator(), and p.

◆ ~DirIterator()

DirIterator::~DirIterator ( )

Definition at line 137 of file dir.cpp.

138{
139}

◆ DirIterator() [3/4]

DirIterator::DirIterator ( )
private

Definition at line 96 of file dir.cpp.

96 : p(std::make_unique<Private>())
97{
98}

References p.

◆ DirIterator() [4/4]

DirIterator::DirIterator ( const std::string & path)
private

Definition at line 100 of file dir.cpp.

100 : p(std::make_unique<Private>(path))
101{
102}

References p.

Member Function Documentation

◆ operator*()

const DirIterator::value_type & DirIterator::operator* ( ) const

Definition at line 148 of file dir.cpp.

149{
150 p->current.p->entry = *p->it;
151 return p->current;
152}

References p.

◆ operator++()

DirIterator DirIterator::operator++ ( )

Definition at line 141 of file dir.cpp.

142{
143 DirIterator result;
144 result.p->it = ++p->it;
145 return result;
146}
DirIterator(const DirIterator &it)
Definition dir.cpp:104

References DirIterator(), and p.

◆ operator->()

const DirIterator::value_type * DirIterator::operator-> ( ) const

Definition at line 154 of file dir.cpp.

155{
156 p->current.p->entry = *p->it;
157 return &p->current;
158}

References p.

◆ operator=() [1/2]

DirIterator & DirIterator::operator= ( const DirIterator & it)

Definition at line 111 of file dir.cpp.

112{
113 if (&it!=this)
114 {
115 p->it = it.p->it;
116 p->ec = it.p->ec;
117 p->current = it.p->current;
118 }
119 return *this;
120}

References DirIterator(), and p.

◆ operator=() [2/2]

DirIterator & DirIterator::operator= ( DirIterator && it)

Definition at line 129 of file dir.cpp.

130{
131 std::exchange(p->it,it.p->it);
132 std::exchange(p->ec,it.p->ec);
133 std::exchange(p->current,it.p->current);
134 return *this;
135}

References DirIterator(), and p.

Friends And Related Symbol Documentation

◆ begin

DirIterator begin ( DirIterator it)
friend

Definition at line 170 of file dir.cpp.

171{
172 return it;
173}

References DirIterator().

◆ Dir

friend class Dir
friend

Definition at line 66 of file dir.h.

References Dir.

Referenced by Dir.

◆ end

DirIterator end ( const DirIterator & )
friend

Definition at line 175 of file dir.cpp.

176{
177 return DirIterator();
178}
DirIterator()
Definition dir.cpp:96

References DirIterator().

◆ operator!=

bool operator!= ( const DirIterator & it1,
const DirIterator & it2 )
friend

Definition at line 165 of file dir.cpp.

166{
167 return it1.p->it!=it2.p->it;
168}

References DirIterator(), and p.

◆ operator==

bool operator== ( const DirIterator & it1,
const DirIterator & it2 )
friend

Definition at line 160 of file dir.cpp.

161{
162 return it1.p->it == it2.p->it;
163}

References DirIterator(), and p.

Member Data Documentation

◆ p

std::unique_ptr<Private> DirIterator::p
private

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