DirectoryIterator_WIN32U.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //
  2. // DirectoryIterator_WIN32U.h
  3. //
  4. // Library: Foundation
  5. // Package: Filesystem
  6. // Module: DirectoryIterator
  7. //
  8. // Definition of the DirectoryIteratorImpl class for WIN32.
  9. //
  10. // Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
  11. // and Contributors.
  12. //
  13. // SPDX-License-Identifier: BSL-1.0
  14. //
  15. #ifndef Foundation_DirectoryIterator_WIN32U_INCLUDED
  16. #define Foundation_DirectoryIterator_WIN32U_INCLUDED
  17. #include "Poco/Foundation.h"
  18. #include "Poco/UnWindows.h"
  19. namespace Poco {
  20. class Foundation_API DirectoryIteratorImpl
  21. {
  22. public:
  23. DirectoryIteratorImpl(const std::string& path);
  24. ~DirectoryIteratorImpl();
  25. void duplicate();
  26. void release();
  27. const std::string& get() const;
  28. const std::string& next();
  29. private:
  30. HANDLE _fh;
  31. WIN32_FIND_DATAW _fd;
  32. std::string _current;
  33. int _rc;
  34. };
  35. //
  36. // inlines
  37. //
  38. const std::string& DirectoryIteratorImpl::get() const
  39. {
  40. return _current;
  41. }
  42. inline void DirectoryIteratorImpl::duplicate()
  43. {
  44. ++_rc;
  45. }
  46. inline void DirectoryIteratorImpl::release()
  47. {
  48. if (--_rc == 0)
  49. delete this;
  50. }
  51. } // namespace Poco
  52. #endif // Foundation_DirectoryIterator_WIN32U_INCLUDED