mirror of
				https://github.com/pocoproject/poco.git
				synced 2025-10-25 10:09:36 +02:00 
			
		
		
		
	 f24547cdcf
			
		
	
	f24547cdcf
	
	
	
		
			
			* enh(poco): Replace deprecated comments with C++ deprecated attribute. * enh(Poco): Replace some deprecated functionality in Poco sources. (#4426) * enh(Poco): Replace more deprecated functionality in Poco sources. (#4426) * fix(CMake): Variable BUILD_SHARED_LIBS must be defined properly to create valid binaries. * enh: Code improvements done while resolving deprecated functionality (#4426) * Un-deprecate LocalDateTme (#4426) * enh(Poco): Replace usage of deprecated functionality with other functions/classes (#4426) * chore(SSL): temporarily un-deprecate SSL-related functionality (#4426) * chore(SSL): temporarily un-deprecate old MongoDB protocol functionality (#4426) * enh(Poco): Minor Hash improvements (#4426) * enh(Foundation): Compile deprecated hash tests only when POCO_TEST_DEPRECATED is enabled (#4426) * enh(Net): Compile deprecated Socket::select functionality only when POCO_TEST_DEPRECATED is enabled (#4426) * enh(Bonjour): Replace deprecated Socket::select with PollSet (#4426) * enh(Poco): Introduce POCO_DEPRECATED macro to have the ability to disable deprecation warnings in applications (#4426) * test(ODBC): add few asserts to testStoredProcedureDynamicVar * fix(ODBC): rename DynamicAny -> DynamicVar in tests * fix(ODBC): make Dignostics static members inline to prevent explicit instantiation warnings on windows --------- Co-authored-by: Alex Fabijanic <alex@pocoproject.org>
		
			
				
	
	
		
			154 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			154 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| //
 | |
| // DirectoryIterator.h
 | |
| //
 | |
| // Library: Foundation
 | |
| // Package: Filesystem
 | |
| // Module:  DirectoryIterator
 | |
| //
 | |
| // Definition of the DirectoryIterator class.
 | |
| //
 | |
| // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
 | |
| // and Contributors.
 | |
| //
 | |
| // SPDX-License-Identifier:	BSL-1.0
 | |
| //
 | |
| 
 | |
| 
 | |
| #ifndef Foundation_DirectoryIterator_INCLUDED
 | |
| #define Foundation_DirectoryIterator_INCLUDED
 | |
| 
 | |
| 
 | |
| #include "Poco/Foundation.h"
 | |
| #include "Poco/File.h"
 | |
| #include "Poco/Path.h"
 | |
| 
 | |
| 
 | |
| namespace Poco {
 | |
| 
 | |
| 
 | |
| class DirectoryIteratorImpl;
 | |
| 
 | |
| 
 | |
| class Foundation_API DirectoryIterator
 | |
| 	/// The DirectoryIterator class is used to enumerate
 | |
| 	/// all files in a directory.
 | |
| 	///
 | |
| 	/// DirectoryIterator has some limitations:
 | |
| 	///   * only forward iteration (++) is supported
 | |
| 	///   * an iterator copied from another one will always
 | |
| 	///     point to the same file as the original iterator,
 | |
| 	///     even is the original iterator has been advanced
 | |
| 	///     (all copies of an iterator share their state with
 | |
| 	///     the original iterator)
 | |
| 	///   * because of this you should only use the prefix
 | |
| 	///     increment operator
 | |
| {
 | |
| public:
 | |
| 	DirectoryIterator();
 | |
| 		/// Creates the end iterator.
 | |
| 
 | |
| 	DirectoryIterator(const std::string& path);
 | |
| 		/// Creates a directory iterator for the given path.
 | |
| 
 | |
| 	DirectoryIterator(const DirectoryIterator& iterator);
 | |
| 		/// Creates a directory iterator for the given path.
 | |
| 
 | |
| 	DirectoryIterator(const File& file);
 | |
| 		/// Creates a directory iterator for the given file.
 | |
| 
 | |
| 	DirectoryIterator(const Path& path);
 | |
| 		/// Creates a directory iterator for the given path.
 | |
| 
 | |
| 	virtual ~DirectoryIterator();
 | |
| 		/// Destroys the DirectoryIterator.
 | |
| 
 | |
| 	const std::string& name() const;
 | |
| 		/// Returns the current filename.
 | |
| 
 | |
| 	const Path& path() const;
 | |
| 		/// Returns the current path.
 | |
| 
 | |
| 	DirectoryIterator& operator = (const DirectoryIterator& it);
 | |
| 	DirectoryIterator& operator = (const File& file);
 | |
| 	DirectoryIterator& operator = (const Path& path);
 | |
| 	DirectoryIterator& operator = (const std::string& path);
 | |
| 
 | |
| 	virtual DirectoryIterator& operator ++ ();   // prefix
 | |
| 
 | |
| 	POCO_DEPRECATED("")
 | |
| 	DirectoryIterator operator ++ (int); // postfix
 | |
| 		/// Please use the prefix increment operator instead.
 | |
| 
 | |
| 	const File& operator * () const;
 | |
| 	File& operator * ();
 | |
| 	const File* operator -> () const;
 | |
| 	File* operator -> ();
 | |
| 
 | |
| 	bool operator == (const DirectoryIterator& iterator) const;
 | |
| 	bool operator != (const DirectoryIterator& iterator) const;
 | |
| 
 | |
| protected:
 | |
| 	Path _path;
 | |
| 	File _file;
 | |
| 
 | |
| private:
 | |
| 	DirectoryIteratorImpl* _pImpl;
 | |
| };
 | |
| 
 | |
| 
 | |
| //
 | |
| // inlines
 | |
| //
 | |
| inline const std::string& DirectoryIterator::name() const
 | |
| {
 | |
| 	return _path.getFileName();
 | |
| }
 | |
| 
 | |
| 
 | |
| inline const Path& DirectoryIterator::path() const
 | |
| {
 | |
| 	return _path;
 | |
| }
 | |
| 
 | |
| 
 | |
| inline const File& DirectoryIterator::operator * () const
 | |
| {
 | |
| 	return _file;
 | |
| }
 | |
| 
 | |
| 
 | |
| inline File& DirectoryIterator::operator * ()
 | |
| {
 | |
| 	return _file;
 | |
| }
 | |
| 
 | |
| 
 | |
| inline const File* DirectoryIterator::operator -> () const
 | |
| {
 | |
| 	return &_file;
 | |
| }
 | |
| 
 | |
| 
 | |
| inline File* DirectoryIterator::operator -> ()
 | |
| {
 | |
| 	return &_file;
 | |
| }
 | |
| 
 | |
| 
 | |
| inline bool DirectoryIterator::operator == (const DirectoryIterator& iterator) const
 | |
| {
 | |
| 	return name() == iterator.name();
 | |
| }
 | |
| 
 | |
| 
 | |
| inline bool DirectoryIterator::operator != (const DirectoryIterator& iterator) const
 | |
| {
 | |
| 	return name() != iterator.name();
 | |
| }
 | |
| 
 | |
| 
 | |
| } // namespace Poco
 | |
| 
 | |
| 
 | |
| #endif // Foundation_DirectoryIterator_INCLUDED
 |