PixelLightAPI  .
Directory.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: Directory.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_DIRECTORY_H__
00024 #define __PLCORE_DIRECTORY_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLCore/File/FileObject.h"
00032 
00033 
00034 //[-------------------------------------------------------]
00035 //[ Namespace                                             ]
00036 //[-------------------------------------------------------]
00037 namespace PLCore {
00038 
00039 
00040 //[-------------------------------------------------------]
00041 //[ Forward declarations                                  ]
00042 //[-------------------------------------------------------]
00043 class FileSearch;
00044 
00045 
00046 //[-------------------------------------------------------]
00047 //[ Classes                                               ]
00048 //[-------------------------------------------------------]
00049 /**
00050 *  @brief
00051 *    Class for accessing a directory within the file system
00052 */
00053 class Directory : public FileObject {
00054 
00055 
00056     //[-------------------------------------------------------]
00057     //[ Friends                                               ]
00058     //[-------------------------------------------------------]
00059     friend class FileSearch;
00060 
00061 
00062     //[-------------------------------------------------------]
00063     //[ Public functions                                      ]
00064     //[-------------------------------------------------------]
00065     public:
00066         /**
00067         *  @brief
00068         *    Constructor
00069         */
00070         inline Directory();
00071 
00072         /**
00073         *  @brief
00074         *    Constructor
00075         *
00076         *  @param[in] sUrl
00077         *    URL of a directory
00078         *  @param[in] pAccess
00079         *    Additional file access information (can be a null pointer)
00080         */
00081         inline Directory(const String &sUrl, const FileAccess *pAccess = nullptr);
00082 
00083         /**
00084         *  @brief
00085         *    Constructor
00086         *
00087         *  @param[in] cUrl
00088         *    URL of a directory
00089         *  @param[in] pAccess
00090         *    Additional file access information (can be a null pointer)
00091         */
00092         inline Directory(const Url &cUrl, const FileAccess *pAccess = nullptr);
00093 
00094         /**
00095         *  @brief
00096         *    Destructor
00097         *
00098         *  @note
00099         *    - The directory is closed automatically
00100         */
00101         inline virtual ~Directory();
00102 
00103         /**
00104         *  @brief
00105         *    Create directory
00106         *
00107         *  @return
00108         *    'true', if all went fine, else 'false'
00109         */
00110         inline bool Create();
00111 
00112         /**
00113         *  @brief
00114         *    Create a directory recursively
00115         *
00116         *  @return
00117         *    'true', if all went fine, else 'false'
00118         */
00119         PLCORE_API bool CreateRecursive();
00120 
00121         /**
00122         *  @brief
00123         *    Delete directory
00124         *
00125         *  @return
00126         *    'true', if all went fine, else 'false'
00127         */
00128         inline bool Delete();
00129 
00130         /**
00131         *  @brief
00132         *    Returns a file searcher for listing the content of a directory
00133         *
00134         *  @param[in] sFilter
00135         *    Filter to be applied (e.g. "*.txt")
00136         *
00137         *  @return
00138         *    Pointer to a new file searcher, a null pointer on error (has to be deleted be the caller)
00139         */
00140         PLCORE_API FileSearch *Search(const String &sFilter) const;
00141 
00142 
00143     //[-------------------------------------------------------]
00144     //[ Private functions                                     ]
00145     //[-------------------------------------------------------]
00146     private:
00147         /**
00148         *  @brief
00149         *    Copy constructor
00150         *
00151         *  @param[in] cSource
00152         *    Source to copy from
00153         */
00154         Directory(const Directory &cSource);
00155 
00156         /**
00157         *  @brief
00158         *    Copy operator
00159         *
00160         *  @param[in] cSource
00161         *    Source to copy from
00162         *
00163         *  @return
00164         *    Reference to this instance
00165         */
00166         Directory &operator =(const Directory &cSource);
00167 
00168 
00169 };
00170 
00171 
00172 //[-------------------------------------------------------]
00173 //[ Namespace                                             ]
00174 //[-------------------------------------------------------]
00175 } // PLCore
00176 
00177 
00178 //[-------------------------------------------------------]
00179 //[ Implementation                                        ]
00180 //[-------------------------------------------------------]
00181 #include "PLCore/File/Directory.inl"
00182 
00183 
00184 #endif // __PLCORE_DIRECTORY_H__


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:08:52
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported