00001 /*MT* 00002 00003 MediaTomb - http://www.mediatomb.cc/ 00004 00005 filesystem.h - this file is part of MediaTomb. 00006 00007 Copyright (C) 2005 Gena Batyan <bgeradz@mediatomb.cc>, 00008 Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc> 00009 00010 Copyright (C) 2006-2010 Gena Batyan <bgeradz@mediatomb.cc>, 00011 Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>, 00012 Leonhard Wimmer <leo@mediatomb.cc> 00013 00014 MediaTomb is free software; you can redistribute it and/or modify 00015 it under the terms of the GNU General Public License version 2 00016 as published by the Free Software Foundation. 00017 00018 MediaTomb is distributed in the hope that it will be useful, 00019 but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 GNU General Public License for more details. 00022 00023 You should have received a copy of the GNU General Public License 00024 version 2 along with MediaTomb; if not, write to the Free Software 00025 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 00026 00027 $Id: filesystem.h 2081 2010-03-23 20:18:00Z lww $ 00028 */ 00029 00031 00032 #ifndef __FILESYSTEM_H__ 00033 #define __FILESYSTEM_H__ 00034 00035 #include "common.h" 00036 #include "rexp.h" 00037 00038 #define FS_MASK_FILES 1 00039 #define FS_MASK_DIRECTORIES 2 00040 #define FS_MASK_HIDDEN 4 // accept hidden files (start with . "dot") 00041 00042 #ifdef __CYGWIN__ 00043 #define FS_ROOT_DIRECTORY "/cygdrive/" 00044 #else 00045 #define FS_ROOT_DIRECTORY "/" 00046 #endif 00047 00048 class FsObject : public zmm::Object 00049 { 00050 public: 00051 inline FsObject() : zmm::Object() 00052 { 00053 isDirectory = false; 00054 hasContent = false; 00055 } 00056 public: 00057 zmm::String filename; 00058 bool isDirectory; 00059 bool hasContent; 00060 }; 00061 00062 class Filesystem : public zmm::Object 00063 { 00064 public: 00065 Filesystem(); 00066 00067 zmm::Ref<zmm::Array<FsObject> > readDirectory(zmm::String path, int mask, 00068 int chldMask = 0); 00069 bool haveFiles(zmm::String dir); 00070 bool haveDirectories(zmm::String dir); 00071 bool fileAllowed(zmm::String path); 00072 00073 protected: 00074 zmm::Ref<zmm::Array<RExp> > includeRules; 00075 bool have(zmm::String dir, int mask); 00076 }; 00077 00078 #endif // __FILESYSTEM_H__
1.6.1