00001 #ifndef _theplu_yat_utility_fileutil_ 00002 #define _theplu_yat_utility_fileutil_ 00003 00004 // $Id: FileUtil.h 1797 2009-02-12 18:07:10Z peter $ 00005 00006 /* 00007 Copyright (C) 2004 Jari Häkkinen 00008 Copyright (C) 2005 Jari Häkkinen, Peter Johansson 00009 Copyright (C) 2006 Jari Häkkinen 00010 Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 00011 00012 This file is part of the yat library, http://dev.thep.lu.se/yat 00013 00014 The yat library is free software; you can redistribute it and/or 00015 modify it under the terms of the GNU General Public License as 00016 published by the Free Software Foundation; either version 3 of the 00017 License, or (at your option) any later version. 00018 00019 The yat library is distributed in the hope that it will be useful, 00020 but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00022 General Public License for more details. 00023 00024 You should have received a copy of the GNU General Public License 00025 along with yat. If not, see <http://www.gnu.org/licenses/>. 00026 */ 00027 00028 #include "Exception.h" 00029 00030 #include <string> 00031 #include <sys/stat.h> 00032 #include <unistd.h> 00033 00034 namespace theplu { 00035 namespace yat { 00036 namespace utility { 00037 00044 class FileUtil { 00045 public: 00046 00050 explicit FileUtil(const std::string& path); 00051 00073 int permissions(const std::string& bits) const; 00074 00087 bool exists(void) const; 00088 00100 bool lexists(void) const; 00101 00105 const std::string& path(void) const; 00106 00107 private: 00111 FileUtil(const FileUtil&); 00112 FileUtil& operator=(const FileUtil&); 00113 00114 bool exists_common(bool) const; 00115 00116 std::string path_; 00117 }; 00118 00119 }}} // of namespace utility, yat, and theplu 00120 00121 #endif