Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

PkgDu Class Reference

Class to store package diskspace usage info. More...

#include <PkgDu.h>

List of all members.

Public Types

typedef EntrySet::iterator iterator
typedef EntrySet::reverse_iterator reverse_iterator
typedef EntrySet::const_iterator const_iterator
typedef EntrySet::const_reverse_iterator const_reverse_iterator

Public Member Functions

 PkgDu ()
void add (const Entry &newent_r)
void add (const std::string &dirname_r, const FSize &size_r=0, const unsigned &files_r=0)
unsigned size () const
void clear ()
void addFrom (const std::list< std::string > &dudata_r)
void setFrom (const std::list< std::string > &dudata_r)
Entry extract (const std::string &dirname_r)
iterator begin ()
iterator end ()
reverse_iterator rbegin ()
reverse_iterator rend ()
const_iterator begin () const
const_iterator end () const
const_reverse_iterator rbegin () const
const_reverse_iterator rend () const

Private Types

typedef std::set< EntryEntrySet

Private Attributes

EntrySet _dirs

Friends

std::ostream & operator<< (std::ostream &str, const PkgDu &obj)


Detailed Description

Class to store package diskspace usage info.

PkgDu maintains a set of PkgDu::Entry to keep inforamtion about diskspace usage in several directories.

A PkgDu::Entry is identified by a directory name (expected to be an absolute path, a trailing '/' is appended if not present). Values for size and number of files within this directory are mutable.

As the diskspace usage depends on the filesystems blocksize, you'll probabely get the closest result counting filesizes rounded up to full Kb and the number of files. Diskspace usage calculation will then add additional half blocksize for each file.

PkgDu dudata;

for ( all dirs ) { PkgDu::Entry dirdata( dir.name ); for ( all files in dir ) { dirdata._size += FSize( file.size ).fullBlock( **defaults to 1K** ); ++dirdata._files; } dudata.add( dirdata ); }


Member Typedef Documentation

typedef EntrySet::const_iterator PkgDu::const_iterator
 

typedef EntrySet::const_reverse_iterator PkgDu::const_reverse_iterator
 

typedef std::set<Entry> PkgDu::EntrySet [private]
 

typedef EntrySet::iterator PkgDu::iterator
 

typedef EntrySet::reverse_iterator PkgDu::reverse_iterator
 


Constructor & Destructor Documentation

PkgDu::PkgDu  )  [inline]
 

Constructor


Member Function Documentation

void PkgDu::add const std::string &  dirname_r,
const FSize size_r = 0,
const unsigned &  files_r = 0
[inline]
 

Add an entry. If already present, sum up the new entries size and files value.

void PkgDu::add const Entry newent_r  )  [inline]
 

Add an entry. If already present, sum up the new entries size and files value.

void PkgDu::addFrom const std::list< std::string > &  dudata_r  ) 
 

Add entries parsed from a packages.DU file

const_iterator PkgDu::begin  )  const [inline]
 

Forward const iterator pointing to the first entry (if any)

iterator PkgDu::begin  )  [inline]
 

Forward iterator pointing to the first entry (if any)

void PkgDu::clear  )  [inline]
 

Clear EntrySet

const_iterator PkgDu::end  )  const [inline]
 

Forward const iterator pointing behind the last entry.

iterator PkgDu::end  )  [inline]
 

Forward iterator pointing behind the last entry.

PkgDu::Entry PkgDu::extract const std::string &  dirname_r  ) 
 

Sum up any entries for dirname_r and its descendants and remove them on the fly. Return the result.

const_reverse_iterator PkgDu::rbegin  )  const [inline]
 

Reverse const iterator pointing to the last entry (if any)

reverse_iterator PkgDu::rbegin  )  [inline]
 

Reverse iterator pointing to the last entry (if any)

const_reverse_iterator PkgDu::rend  )  const [inline]
 

Reverse const iterator pointing before the first entry.

reverse_iterator PkgDu::rend  )  [inline]
 

Reverse iterator pointing before the first entry.

void PkgDu::setFrom const std::list< std::string > &  dudata_r  )  [inline]
 

Set entries parsed from a packages.DU file

unsigned PkgDu::size  )  const [inline]
 

Number of entries


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  str,
const PkgDu obj
[friend]
 


Member Data Documentation

EntrySet PkgDu::_dirs [private]
 


The documentation for this class was generated from the following files:
Generated on Fri Nov 9 14:30:32 2007 for yast2-packagemanager by doxygen 1.3.6