// -*-c++-*- //------------------------------------------------------------------------------ // xword - (http://xword.sourceforge.net) // Copyright 2002 Patrick Crosby //------------------------------------------------------------------------------ // FileUtil.h // // $Id: FileUtil.h,v 1.2 2002/01/23 19:43:03 pcrosby Exp $ //------------------------------------------------------------------------------ // This program 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. // // This program 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 // this program; if not, write to the Free Software Foundation, Inc., 59 Temple // Place, Suite 330, Boston, MA 02111-1307 USA //------------------------------------------------------------------------------ #ifndef __FileUtil__ #define __FileUtil__ #include #include #include #include #include #include "Filename.h" #include "Namespace.h" NAMESPACE_OPEN //------------------------------------------------------------------------------ class FileUtil { // Constants // Types public: typedef std::vector DirectoryList; typedef DirectoryList::iterator DirectoryListItr; typedef DirectoryList::const_iterator DirectoryListConstItr; // Variables // Methods public: static bool GetDirectoryList(const Filename& strPath, DirectoryList& listResult); static void CreateDirectory(const Filename& strPath); static void AssertDirectoryExists(const Filename& strPath); static Filename GetAvailableFile(const Filename& strBase); static Filename GetAvailableFile(const Filename& strBase, const std::string& strExt); static bool FileExists(const Filename& strPath); static void CreateFile(const Filename& strPath); static void AssertFileExists(const Filename& strPath); static off_t GetSize(const Filename& strPath); static bool Skip(FILE* pFile, long nlOffset, int nWhence); static void Delete(const Filename& strPath); static void Rename(const Filename& strOldPath, const Filename& strNewPath); static void Link(const Filename& strSource, const Filename& strLinkPath); static std::string CleanFilename(const std::string& s); }; //------------------------------------------------------------------------------ NAMESPACE_CLOSE #endif //------------------------------------------------------------------------------