dir_iterator.hh

Go to the documentation of this file.
00001 /* vim: set sw=4 sts=4 et foldmethod=syntax : */
00002 
00003 /*
00004  * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
00005  *
00006  * This file is part of the Paludis package manager. Paludis is free software;
00007  * you can redistribute it and/or modify it under the terms of the GNU General
00008  * Public License version 2, as published by the Free Software Foundation.
00009  *
00010  * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
00011  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00012  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00013  * details.
00014  *
00015  * You should have received a copy of the GNU General Public License along with
00016  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00017  * Place, Suite 330, Boston, MA  02111-1307  USA
00018  */
00019 
00020 #ifndef PALUDIS_GUARD_PALUDIS_DIR_ITERATOR_HH
00021 #define PALUDIS_GUARD_PALUDIS_DIR_ITERATOR_HH 1
00022 
00023 #include <paludis/util/dir_iterator-fwd.hh>
00024 #include <paludis/util/fs_entry.hh>
00025 #include <paludis/util/options.hh>
00026 #include <paludis/util/private_implementation_pattern.hh>
00027 #include <iterator>
00028 
00029 /** \file
00030  * Declarations for DirIterator.
00031  *
00032  * \ingroup g_fs
00033  *
00034  * \section Examples
00035  *
00036  * - None at this time.
00037  */
00038 
00039 namespace paludis
00040 {
00041     /**
00042      * Raised when a directory open fails.
00043      *
00044      * \ingroup g_fs
00045      * \ingroup g_exceptions
00046      * \nosubgrouping
00047      */
00048     class PALUDIS_VISIBLE DirOpenError :
00049         public FSError
00050     {
00051         public:
00052             ///\name Basic operations
00053             ///\{
00054 
00055             DirOpenError(const FSEntry & location, const int errno_value) throw ();
00056 
00057             ///\}
00058     };
00059 
00060     /**
00061      * An iterator that iterates over the contents of a directory.
00062      *
00063      * \ingroup g_fs
00064      * \nosubgrouping
00065      */
00066     class PALUDIS_VISIBLE DirIterator :
00067         private PrivateImplementationPattern<DirIterator>
00068     {
00069         public:
00070             ///\name Standard library typedefs
00071             ///\{
00072 
00073             typedef FSEntry value_type;
00074             typedef const FSEntry & reference;
00075             typedef const FSEntry * pointer;
00076             typedef std::ptrdiff_t difference_type;
00077             typedef std::forward_iterator_tag iterator_category;
00078 
00079             ///\}
00080 
00081             ///\name Basic operations
00082             ///\{
00083 
00084             /**
00085              * Constructor, to an FSEntry which must be a directory, with an
00086              * option to not ignore dotfiles and an option to do inodesort.
00087              */
00088             explicit DirIterator(const FSEntry &, const DirIteratorOptions & = DirIteratorOptions());
00089 
00090             DirIterator(const DirIterator &);
00091 
00092             /**
00093              * Constructor, creates an end() iterator.
00094              */
00095             DirIterator();
00096 
00097             ~DirIterator();
00098 
00099             DirIterator & operator= (const DirIterator &);
00100 
00101             ///\}
00102 
00103             ///\name Dereference operators
00104             ///\{
00105 
00106             const FSEntry & operator* () const
00107                 PALUDIS_ATTRIBUTE((warn_unused_result));
00108 
00109             const FSEntry * operator-> () const
00110                 PALUDIS_ATTRIBUTE((warn_unused_result));
00111 
00112             ///\}
00113 
00114             ///\name Increment, decrement operators
00115             ///\{
00116 
00117             DirIterator & operator++ ();
00118             DirIterator operator++ (int);
00119 
00120             ///\}
00121 
00122             ///\name Comparison operators
00123             ///\{
00124 
00125             bool operator== (const DirIterator &) const
00126                 PALUDIS_ATTRIBUTE((warn_unused_result));
00127             bool operator!= (const DirIterator &) const
00128                 PALUDIS_ATTRIBUTE((warn_unused_result));
00129 
00130             ///\}
00131     };
00132 
00133 #ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
00134     extern template class PrivateImplementationPattern<DirIterator>;
00135 #endif
00136 }
00137 
00138 #endif

Generated on Mon Sep 21 10:36:08 2009 for paludis by  doxygen 1.5.4