.. oe:namespace:: OEPlatform



.. meta::
   :keywords: OEDirectoryScan, DirectoryScan


.. _OEPlatform_OEDirectoryScan:

.. oe:class:: OEDirectoryScan

   .. oe:api::


      class OEDirectoryScan

   This class represents `OEDirectoryScan`.

   The :ref:`OEDirectoryScan <OEPlatform_OEDirectoryScan>` class provides a portable
   way of retrieving the
   names of all the files and subdirectories in a given directory.

   .. oe:method:: Constructors

      .. oe:api::

         OEDirectoryScan(const char* dname)

      The constructor for :ref:`OEDirectoryScan <OEPlatform_OEDirectoryScan>` specifies the
      name of the directory to scan. A NULL pointer, ``(char*)0``, is taken 
      to mean the
      current directory and is equivalent to ``"."``.

   .. oe:method:: operator bool

      .. oe:language:: c++ java csharp

         .. oe:api::

            operator bool() const

      .. oe:language:: python

         .. oe:api:: python

            IsValid() -> bool

      Checks whether the :ref:`OEDirectoryScan <OEPlatform_OEDirectoryScan>` has been
      successfully opened and is still valid. A
      return value of ``true`` does not guarantee that the next call to the
      Next method will not return ``(const char*)0``.

   .. oe:method:: Close

      .. oe:api::

         void Close()

      Closes the :ref:`OEDirectoryScan <OEPlatform_OEDirectoryScan>` and frees any system
      resources. This method is invoked automatically by the classes'
      destructor. Following a call to Close, operator bool will always
      return ``false``.

   .. oe:method:: Next

      .. oe:api::

         const char *Next()

      Returns the next file name sequentially in the directory scan. This
      function automatically advances the directory pointer. The returned
      value is a pointer to the local filename, *i.e.* without its
      directory prefix. Upon reaching the end of the directory, this
      function returns ``(const char*)0``, and the 
      :ref:`OEDirectoryScan <OEPlatform_OEDirectoryScan>` is closed.
