DirectoryIterator.h
Go to the documentation of this file.
00001 //
00002 // DirectoryIterator.h
00003 //
00004 // $Id: //poco/1.3/Foundation/include/Poco/DirectoryIterator.h#2 $
00005 //
00006 // Library: Foundation
00007 // Package: Filesystem
00008 // Module:  DirectoryIterator
00009 //
00010 // Definition of the DirectoryIterator class.
00011 //
00012 // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
00013 // and Contributors.
00014 //
00015 // Permission is hereby granted, free of charge, to any person or organization
00016 // obtaining a copy of the software and accompanying documentation covered by
00017 // this license (the "Software") to use, reproduce, display, distribute,
00018 // execute, and transmit the Software, and to prepare derivative works of the
00019 // Software, and to permit third-parties to whom the Software is furnished to
00020 // do so, all subject to the following:
00021 // 
00022 // The copyright notices in the Software and this entire statement, including
00023 // the above license grant, this restriction and the following disclaimer,
00024 // must be included in all copies of the Software, in whole or in part, and
00025 // all derivative works of the Software, unless such copies or derivative
00026 // works are solely in the form of machine-executable object code generated by
00027 // a source language processor.
00028 // 
00029 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00030 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00031 // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
00032 // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
00033 // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
00034 // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00035 // DEALINGS IN THE SOFTWARE.
00036 //
00037 
00038 
00039 #ifndef Foundation_DirectoryIterator_INCLUDED
00040 #define Foundation_DirectoryIterator_INCLUDED
00041 
00042 
00043 #include "Poco/Foundation.h"
00044 #include "Poco/File.h"
00045 #include "Poco/Path.h"
00046 
00047 
00048 namespace Poco {
00049 
00050 
00051 class DirectoryIteratorImpl;
00052 
00053 
00054 class Foundation_API DirectoryIterator
00067 {
00068 public:
00069         DirectoryIterator();
00071                 
00072         DirectoryIterator(const std::string& path);
00074 
00075         DirectoryIterator(const DirectoryIterator& iterator);
00077                 
00078         DirectoryIterator(const File& file);
00080 
00081         DirectoryIterator(const Path& path);
00083 
00084         ~DirectoryIterator();
00086 
00087         const std::string& name() const;
00089                 
00090         const Path& path() const;
00092 
00093         DirectoryIterator& operator = (const DirectoryIterator& it);
00094         DirectoryIterator& operator = (const File& file);
00095         DirectoryIterator& operator = (const Path& path);
00096         DirectoryIterator& operator = (const std::string& path);
00097         
00098         DirectoryIterator& operator ++ ();   // prefix
00099         
00100         //@ deprecated
00101         DirectoryIterator operator ++ (int); // postfix
00103         
00104         const File& operator * () const;
00105         File& operator * ();
00106         const File* operator -> () const;
00107         File* operator -> ();
00108         
00109         bool operator == (const DirectoryIterator& iterator) const;
00110         bool operator != (const DirectoryIterator& iterator) const;
00111 
00112 private:
00113         Path _path;
00114         File _file;
00115         DirectoryIteratorImpl* _pImpl;
00116 };
00117 
00118 
00119 //
00120 // inlines
00121 //
00122 inline const std::string& DirectoryIterator::name() const
00123 {
00124         return _path.getFileName();
00125 }
00126 
00127         
00128 inline const Path& DirectoryIterator::path() const
00129 {
00130         return _path;
00131 }
00132 
00133 
00134 inline const File& DirectoryIterator::operator * () const
00135 {
00136         return _file;
00137 }
00138 
00139 
00140 inline File& DirectoryIterator::operator * ()
00141 {
00142         return _file;
00143 }
00144 
00145 
00146 inline const File* DirectoryIterator::operator -> () const
00147 {
00148         return &_file;
00149 }
00150 
00151 
00152 inline File* DirectoryIterator::operator -> ()
00153 {
00154         return &_file;
00155 }
00156 
00157 
00158 inline bool DirectoryIterator::operator == (const DirectoryIterator& iterator) const
00159 {
00160         return name() == iterator.name();
00161 }
00162 
00163 
00164 inline bool DirectoryIterator::operator != (const DirectoryIterator& iterator) const
00165 {
00166         return name() != iterator.name();
00167 }
00168 
00169 
00170 } // namespace Poco
00171 
00172 
00173 #endif // Foundation_DirectoryIterator_INCLUDED


pluginlib
Author(s): Tully Foote and Eitan Marder-Eppstein
autogenerated on Sat Dec 28 2013 17:20:19