FileInfo.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   (c) Jürgen Riegel (juergen.riegel@web.de) 2005                        *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This program is free software; you can redistribute it and/or modify  *
00007  *   it under the terms of the GNU Library General Public License (LGPL)   *
00008  *   as published by the Free Software Foundation; either version 2 of     *
00009  *   the License, or (at your option) any later version.                   *
00010  *   for detail see the LICENCE text file.                                 *
00011  *                                                                         *
00012  *   FreeCAD is distributed in the hope that it will be useful,            *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        * 
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU Library General Public License for more details.                  *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU Library General Public     *
00018  *   License along with FreeCAD; if not, write to the Free Software        * 
00019  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
00020  *   USA                                                                   *
00021  *                                                                         *
00022  *   Juergen Riegel 2002                                                   *
00023  ***************************************************************************/
00024 
00025 
00026 #ifndef BASE_FILEINFO_H
00027 #define BASE_FILEINFO_H
00028 
00029 #include <string>
00030 #include <vector>
00031 #include <Base/TimeInfo.h>
00032 
00033 
00034 namespace Base
00035 {
00036 
00042 class BaseExport FileInfo
00043 {
00044 public:
00046     FileInfo (const char* _FileName="");
00047     FileInfo (const std::string &_FileName);
00049     void setFile(const char* name);
00051     void setFile(const std::string &name){setFile(name.c_str());}
00052 
00053 
00056 
00057     std::string filePath () const;
00059     std::string dirPath () const;
00061     std::string fileName () const;
00063     std::string fileNamePure () const;
00065     std::wstring toStdWString() const;
00079     std::string extension (bool complete = false) const;
00081     bool hasExtension (const char* Ext) const;
00083 
00086 
00087     bool exists () const;
00089     bool isReadable () const;
00091     bool isWritable () const;
00093     bool isFile () const;
00095     bool isDir () const;
00097     unsigned int size () const;
00099     TimeInfo lastModified() const;
00101     TimeInfo lastRead() const;
00103 
00106 
00107     bool createDirectory( void ) const;
00109     std::vector<Base::FileInfo> getDirectoryContent(void) const;
00111     bool deleteDirectory(void) const;
00113     bool deleteDirectoryRecursive(void) const;
00115 
00117     bool deleteFile(void) const;
00119     bool renameFile(const char* NewName);
00121     bool copyTo(const char* NewName) const;
00122 
00125 
00126     static std::string getTempFileName(const char* FileName=0, const char* path=0);
00128     static const std::string &getTempPath(void);
00130 
00131 protected:
00132     std::string FileName;
00133 };
00134 
00135 } //namespace Base
00136 
00137 
00138 #endif // BASE_FILEINFO_H
00139 

Generated on Wed Nov 23 19:00:14 2011 for FreeCAD by  doxygen 1.6.1