00001 // Copyright (C) 2001, Compaq Computer Corporation 00002 // 00003 // This file is part of Vesta. 00004 // 00005 // Vesta is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU Lesser General Public 00007 // License as published by the Free Software Foundation; either 00008 // version 2.1 of the License, or (at your option) any later version. 00009 // 00010 // Vesta is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public 00016 // License along with Vesta; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 00019 // Last modified on Mon Nov 10 17:35:09 EST 2003 by ken@xorian.net 00020 // modified on Fri Aug 8 19:52:15 PDT 1997 by heydon 00021 00022 /* StatDirEntry.H - Defines an object type intended to be subclassed to 00023 represent an entry in a directory. The class has a "kind" field indicating 00024 the type of the entry. */ 00025 00026 #ifndef _STAT_DIR_ENTRY_H 00027 #define _STAT_DIR_ENTRY_H 00028 00029 #include <sys/types.h> 00030 #include <sys/stat.h> 00031 #include <Basics.H> 00032 #include <FS.H> 00033 #include "StatError.H" 00034 #include "StatCount.H" 00035 #include "StatCollection.H" 00036 00037 class DirEntry { 00038 public: 00039 enum Kind { Directory, File }; 00040 Kind kind; 00041 00042 // constructor 00043 DirEntry(Kind kind) throw () : kind(kind) { /*SKIP*/ } 00044 00045 // search 00046 virtual int Search(int verbose, /*INOUT*/ Stat::Collection &stats) 00047 throw (StatError::UnevenLevels, 00048 StatError::BadMPKFile, StatError::EndOfFile, 00049 FS::Failure, FS::DoesNotExist); 00050 00051 static DirEntry *Open(const Text &path, struct stat *statBuff = NULL) 00052 throw (StatError::EndOfFile, FS::Failure, FS::DoesNotExist); 00053 /* Open "path" and return the resulting "DirEntry", which will either 00054 be a "DirObj" or a "MPKFileObj". If "statBuff" is non-NULL, it points 00055 to the "struct stat" structure for "path". */ 00056 00057 static void FSStat(const Text &path, /*OUT*/ struct stat *buffer) 00058 throw (FS::Failure, FS::DoesNotExist); 00059 }; 00060 00061 #endif // _STAT_DIR_ENTRY_H