• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

/home/pascal/depot/filedata/src/file_tools.h

00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Nicolas PASCAL                                  *
00003  *   nicolas.pascal@icare.univ-lille1.fr                                   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program 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         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00021 #ifndef FILES_TOOLS_H
00022 #define FILES_TOOLS_H
00023 
00024 #include <string>
00025 #include <iostream>
00026 #include <cstdio>
00027 #include <sys/types.h>
00028 #include <dirent.h>
00029 using namespace std;
00030 
00031 class bad_tmp_dir {
00032 public:
00033     bad_tmp_dir() {};
00034     ~bad_tmp_dir() {};
00035     void what() const {
00036         cout <<"bad_tmp_dir : can't find the temporary directory. Review the get_temp_dir function in file_tools.cpp"<<endl;
00037     };
00038 };
00039 
00051 bool file_can_be_opened_as(const string & path_and_filename = "", const string &mode = "r");
00052 
00058 bool exists_file(const string &path_and_filename = "");
00064 bool exists_dir(const string &dir_path);
00071 const string get_directory(const string &path_and_filename = "");
00078 const string get_tail(const string &filename = "");
00085 const string basename(const string &filename = "");
00092 const string get_tmp_dir();
00093 #endif
00094 
00095 

Generated on Thu Feb 14 2013 17:59:03 for filedata.kdevelop by  doxygen 1.7.1