00001 #ifndef _theplu_yat_utility_fileutil_ 00002 #define _theplu_yat_utility_fileutil_ 00003 00004 // $Id: FileUtil.h 2125 2009-12-22 20:19:41Z 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 Copyright (C) 2009 Peter Johansson 00012 00013 This file is part of the yat library, http://dev.thep.lu.se/yat 00014 00015 The yat library is free software; you can redistribute it and/or 00016 modify it under the terms of the GNU General Public License as 00017 published by the Free Software Foundation; either version 3 of the 00018 License, or (at your option) any later version. 00019 00020 The yat library is distributed in the hope that it will be useful, 00021 but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00023 General Public License for more details. 00024 00025 You should have received a copy of the GNU General Public License 00026 along with yat. If not, see <http://www.gnu.org/licenses/>. 00027 */ 00028 00029 #include <string> 00030 #include <sys/stat.h> 00031 #include <unistd.h> 00032 00033 namespace theplu { 00034 namespace yat { 00035 namespace utility { 00036 00043 class FileUtil { 00044 public: 00045 00049 explicit FileUtil(const std::string& path); 00050 00056 FileUtil(const FileUtil&); 00057 00079 int permissions(const std::string& bits) const; 00080 00093 bool exists(void) const; 00094 00106 bool lexists(void) const; 00107 00111 const std::string& path(void) const; 00112 00118 FileUtil& operator=(const FileUtil&); 00119 00120 private: 00121 bool exists_common(bool) const; 00122 00123 std::string path_; 00124 }; 00125 00126 }}} // of namespace utility, yat, and theplu 00127 00128 #endif