12 #ifndef ZYPP_DISKUSAGE_H
13 #define ZYPP_DISKUSAGE_H
29 Entry(
const std::string& path_r,
30 const unsigned size_r = 0,
31 const unsigned files_r = 0)
37 if ( *
path.begin() !=
'/' )
path.insert(
path.begin(),
'/' );
38 if ( *
path.rbegin() !=
'/' )
path.insert(
path.end(),
'/' );
44 friend std::ostream &
operator<<( std::ostream & str,
const Entry & obj );
62 return(
path.compare( 0, rhs.
path.size(), rhs.
path ) == 0 );
67 bool isBelow(
const std::string & dirname_r )
const {
98 std::pair<EntrySet::iterator,bool> res =
_dirs.insert( newent_r );
100 *res.first += newent_r;
106 void add(
const std::string & dirname_r,
const unsigned & size_r = 0,
const unsigned & files_r = 0 ) {
107 add(
Entry( dirname_r, size_r, files_r ) );
125 Entry
extract(
const std::string & dirname_r );
178 #endif // ZYPP_DISKUSAGE_H
EntrySet::iterator iterator
const Entry & operator-=(const Entry &rhs) const
Numerical operation based on size and files values.
std::set< Entry > EntrySet
EntrySet::const_iterator const_iterator
const_reverse_iterator rend() const
Reverse const iterator pointing before the first entry.
bool isBelow(const Entry &rhs) const
Return true if this entry denotes a directory equal to or below rhs._dirname.
void clear()
Clear EntrySet.
void add(const Entry &newent_r)
Add an entry.
friend std::ostream & operator<<(std::ostream &str, const DiskUsage &obj)
Holds data about how much space will be needed per directory.
const_iterator end() const
Forward const iterator pointing behind the last entry.
const_reverse_iterator rbegin() const
Reverse const iterator pointing to the last entry (if any)
iterator begin()
Forward iterator pointing to the first entry (if any)
reverse_iterator rend()
Reverse iterator pointing before the first entry.
const_iterator begin() const
Forward const iterator pointing to the first entry (if any)
const Entry & operator+=(const Entry &rhs) const
Numerical operation based on size and files values.
bool operator<(const Entry &rhs) const
Order based on directory name.
Entry extract(const std::string &dirname_r)
Sum up any entries for dirname_r and its descendants and remove them on the fly.
EntrySet::const_reverse_iterator const_reverse_iterator
EntrySet::reverse_iterator reverse_iterator
reverse_iterator rbegin()
Reverse iterator pointing to the last entry (if any)
iterator end()
Forward iterator pointing behind the last entry.
Entry(const std::string &path_r, const unsigned size_r=0, const unsigned files_r=0)
void add(const std::string &dirname_r, const unsigned &size_r=0, const unsigned &files_r=0)
Add an entry.
bool operator==(const Entry &rhs) const
Test for equality based on directory name.
bool empty() const
Whether there is no entry available.
unsigned size() const
Number of entries.
bool isBelow(const std::string &dirname_r) const
Return true if this entry denotes a directory equal to or below dirname_r.
friend std::ostream & operator<<(std::ostream &str, const Entry &obj)