1 #ifndef _DEDIRECTORYITERATOR_HPP
2 #define _DEDIRECTORYITERATOR_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program Tester Core
5 * ----------------------------------------
7 * Copyright 2014 The Android Open Source Project
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
23 * \brief Directory iterator.
24 *//*--------------------------------------------------------------------*/
27 #include "deFilePath.hpp"
29 #define DE_DIRITER_WIN32 0
30 #define DE_DIRITER_POSIX 1
32 #if (DE_OS == DE_OS_WIN32 && DE_COMPILER == DE_COMPILER_MSC)
33 # define DE_DIRITER DE_DIRITER_WIN32
34 #elif (DE_OS == DE_OS_UNIX) || (DE_OS == DE_OS_OSX) || (DE_OS == DE_OS_ANDROID) || (DE_OS == DE_OS_SYMBIAN) || (DE_OS == DE_OS_IOS) || (DE_OS == DE_OS_QNX) || (DE_OS == DE_OS_WIN32 && DE_COMPILER == DE_COMPILER_CLANG)
35 # define DE_DIRITER DE_DIRITER_POSIX
38 #if !defined(DE_DIRITER)
39 # error Implement tcu::DirectoryIterator for your platform.
42 #if (DE_DIRITER == DE_DIRITER_WIN32)
43 # include <io.h> /* _finddata32_t */
44 #elif (DE_DIRITER == DE_DIRITER_POSIX)
45 # include <sys/types.h>
52 class DirectoryIterator
55 DirectoryIterator (const FilePath& path);
56 ~DirectoryIterator (void);
58 FilePath getItem (void) const;
59 bool hasItem (void) const;
63 DirectoryIterator (const DirectoryIterator& other);
64 DirectoryIterator& operator= (const DirectoryIterator& other);
68 #if (DE_DIRITER == DE_DIRITER_WIN32)
69 void skipCurAndParent (void);
73 struct _finddata32_t m_fileInfo;
75 #elif (DE_DIRITER == DE_DIRITER_POSIX)
77 struct dirent* m_curEntry;
83 #endif // _DEDIRECTORYITERATOR_HPP