/* ZazouMiniWebServer Copyright (C) 2003-2008 Xavier Garreau This file is part of ZazouMiniWebServer. ZazouMiniWebServer is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. ZazouMiniWebServer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with ZazouMiniWebServer; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ // ZMWSFileUtils.h: interface for the ZMWSFileUtils class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_ZMWSFILEUTILS_H__D2821D28_8C32_436E_AC6F_034CFAC24C45__INCLUDED_) #define AFX_ZMWSFILEUTILS_H__D2821D28_8C32_436E_AC6F_034CFAC24C45__INCLUDED_ #ifndef WIN32 #include #include #include #include #endif #include "ZOSAL.h" class ZMWSFileUtils { #ifndef WIN32 struct stat fileData; struct dirent* dirEntry; DIR* dirData; bool wasStatedAndIsOK; std::string searchPattern; std::string searchPath; #else HANDLE_FIND handle; WIN32_FIND_DATA fileData; #endif public: ZMWSFileUtils(); virtual ~ZMWSFileUtils(); BOOL getFile(const std::string& searchPath); BOOL fileExists(); BOOL isDir(); BOOL isFile(); BOOL getNextFile(); // For Dir Listing ... std::string getFileName(); std::string getFileSize(); DWORD getFileSizeN(); // Numeric std::string getFileSizeH(); // i.e. for humans ;-) like in ls -h std::string getWriteDate(); // NB: Local Time std::string getWriteDateSort(); // NB: YYYYMMDDhhmm Local Time std::string getWriteDateRFC1123(); // NB: pour communication HTTP, UTC Time // BOOL isReadOnly(); static std::string getExtension(const std::string& fileName); static BOOL fileExists(const std::string& fileName); static BOOL normalizePath(std::string& aPath); }; #endif // !defined(AFX_ZMWSFILEUTILS_H__D2821D28_8C32_436E_AC6F_034CFAC24C45__INCLUDED_)