From: Christian P. <cp...@us...> - 2004-12-27 07:06:00
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10778/include/pclasses/System Added Files: FileInfo.h Log Message: Added P::System::FileInfo class. --- NEW FILE: FileInfo.h --- /*************************************************************************** * Copyright (C) 2004 by Christian Prochnow * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library 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 Library 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 P_System_FileInfo_h #define P_System_FileInfo_h #include <pclasses/BasicTypes.h> #include <pclasses/DateTime.h> #include <pclasses/Unicode/String.h> #include <pclasses/System/SystemError.h> #include <string> namespace P { namespace System { class FileInfo { public: typedef size_t fsize_t; //! Filesystem object type enum FileType { Unknown, /*!< Unknown file type */ File, /*!< Regular file */ Directory, /*!< Directory */ CharDevice, /*!< Character device */ BlockDevice, /*!< Block device */ Link, /*!< Filesystem link */ Pipe /*!< Anonymous-/Namedpipe */ }; FileInfo(const Unicode::String& path) throw(SystemError); FileInfo(const FileInfo& fi); ~FileInfo() throw(); const Unicode::String& path() const throw(); void refresh() throw(SystemError); //! Returns the size of the filesystem object fsize_t size() const throw(); //! Returns the type of the filesystem object FileType type() const throw(); //! Returns the creation time const DateTime& ctime() const throw(); //! Returns the last-modified time const DateTime& mtime() const throw(); //! Returns the last-accessed time const DateTime& atime() const throw(); FileInfo& operator=(const FileInfo& fi) throw(); private: Unicode::String _path; fsize_t _size; FileType _type; DateTime _ctime, _mtime, _atime; }; } // !namespace System } // !namespace P #endif |