PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: FileSearchLinux.h * 00003 * 00004 * Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/) 00005 * 00006 * This file is part of PixelLight. 00007 * 00008 * PixelLight is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * PixelLight is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with PixelLight. If not, see <http://www.gnu.org/licenses/>. 00020 \*********************************************************/ 00021 00022 00023 #ifndef __PLCORE_FILESEARCH_LINUX_H__ 00024 #define __PLCORE_FILESEARCH_LINUX_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <sys/types.h> 00032 #include <dirent.h> 00033 #include "PLCore/File/FileSearchImpl.h" 00034 00035 00036 //[-------------------------------------------------------] 00037 //[ Namespace ] 00038 //[-------------------------------------------------------] 00039 namespace PLCore { 00040 00041 00042 //[-------------------------------------------------------] 00043 //[ Classes ] 00044 //[-------------------------------------------------------] 00045 /** 00046 * @brief 00047 * Linux implementation of 'FileSearchImpl' 00048 */ 00049 class FileSearchLinux : public FileSearchImpl { 00050 00051 00052 //[-------------------------------------------------------] 00053 //[ Friends ] 00054 //[-------------------------------------------------------] 00055 friend class FileLinux; 00056 00057 00058 //[-------------------------------------------------------] 00059 //[ Private functions ] 00060 //[-------------------------------------------------------] 00061 private: 00062 /** 00063 * @brief 00064 * Constructor 00065 * 00066 * @param[in] sPath 00067 * Search path 00068 * @param[in] pAccess 00069 * Additional file access information (can be a null pointer) 00070 */ 00071 FileSearchLinux(const String &sPath, const FileAccess *pAccess); 00072 00073 /** 00074 * @brief 00075 * Destructor 00076 */ 00077 virtual ~FileSearchLinux(); 00078 00079 00080 //[-------------------------------------------------------] 00081 //[ Private virtual FileSearchImpl functions ] 00082 //[-------------------------------------------------------] 00083 private: 00084 virtual bool HasNextFile() override; 00085 virtual String GetNextFile() override; 00086 00087 00088 //[-------------------------------------------------------] 00089 //[ Private data ] 00090 //[-------------------------------------------------------] 00091 private: 00092 DIR *m_pDir; /** Can be a null pointer */ 00093 dirent *m_pDirEntry; /** Can be a null pointer */ 00094 String m_sPath; 00095 bool m_bHasNext; 00096 String m_sFilename; 00097 00098 00099 }; 00100 00101 00102 //[-------------------------------------------------------] 00103 //[ Namespace ] 00104 //[-------------------------------------------------------] 00105 } // PLCore 00106 00107 00108 #endif // __PLCORE_FILESEARCH_LINUX_H__
|