Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Examples

pfileinfo.h

Go to the documentation of this file.
00001 /*
00002  *   P::Classes - Portable C++ Application Framework
00003  *   Copyright (C) 2000-2003  Christian Prochnow <cproch@seculogix.de>
00004  *
00005  *   This library is free software; you can redistribute it and/or
00006  *   modify it under the terms of the GNU Lesser General Public
00007  *   License as published by the Free Software Foundation; either
00008  *   version 2 of the License, or (at your option) any later version.
00009  *
00010  *   This library is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *   Lesser General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU Lesser General Public
00016  *   License along with this library; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  */
00019 
00020 #ifndef _pfileinfo_h_
00021 #define _pfileinfo_h_
00022 
00023 #include <pclasses/config.h>
00024 #include <pclasses/pexport.h>
00025 #include <pclasses/ptypes.h>
00026 #include <pclasses/ptime.h>
00027 #include <string>
00028 
00029 namespace P {
00030 
00032 
00036 class PCORE_EXPORT FileInfo {
00037   public:
00038     #ifndef HAVE_LARGEFILE64
00039     typedef off_t fsize_t;
00040     #else
00041     typedef off64_t fsize_t;
00042     #endif
00043 
00045     enum ftype_t {
00046       Unknown,      
00047       File,         
00048       Directory,    
00049       CharDevice,   
00050       BlockDevice,  
00051       Link,         
00052       Pipe          
00053     };
00054 
00055     FileInfo(const char* path) throw(IOError);
00056     FileInfo(const FileInfo& fi);
00057     ~FileInfo();
00058 
00060     inline const std::string& dirName() const throw()
00061     { return m_dirName; }
00062 
00064     std::string absDirName() const throw(SystemError);
00065 
00067     inline const std::string& name() const throw()
00068     { return m_name; }
00069 
00071     std::string path() const throw();
00072 
00074     std::string absPath() const throw(SystemError);
00075 
00077     inline fsize_t size() const throw()
00078     { return m_size; }
00079 
00081     inline ftype_t type() const throw()
00082     { return m_type; }
00083 
00085     inline const DateTime& ctime() const throw()
00086     { return m_ctime; }
00087 
00089     inline const DateTime& mtime() const throw()
00090     { return m_mtime; }
00091 
00093     inline const DateTime& atime() const throw()
00094     { return m_atime; }
00095 
00096     FileInfo& operator=(const FileInfo& fi) throw();
00097 
00098   private:
00099     fsize_t     m_size;
00100     ftype_t     m_type;
00101     std::string m_dirName;
00102     std::string m_name;
00103     DateTime    m_ctime, m_mtime, m_atime;
00104 };
00105 
00106 }
00107 
00108 #endif

Generated on Fri Mar 12 21:08:31 2004 for P::Classes by doxygen 1.3.3