File.h

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 //
00003 // $Id$
00004 //
00005 // Copyright 2008, 2009, 2010, 2011, 2012  Antonio Franchi and Paolo Stegagno    
00006 //
00007 // This file is part of MIP.
00008 //
00009 // MIP is free software: you can redistribute it and/or modify
00010 // it under the terms of the GNU General Public License as published by
00011 // the Free Software Foundation, either version 3 of the License, or
00012 // (at your option) any later version.
00013 //
00014 // MIP is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with MIP. If not, see <http://www.gnu.org/licenses/>.
00021 //
00022 // Contact info: antonio.franchi@tuebingen.mpg.de stegagno@diag.uniroma1.it
00023 //
00024 // ----------------------------------------------------------------------------
00025 
00026 
00031 
00035 
00037 /* @{ */
00038 
00039 #ifndef __FILE_H_
00040 #define __FILE_H_
00041 
00042 #ifdef MIP_HOST_APPLE
00043 #include <applePatch.h>
00044 #endif
00045 
00046 #include <stdio.h>
00047 #include <vector>
00048 #include <iostream>
00049 #include <string>
00050 #include <sstream>
00051 #include <fstream>
00052 
00053 #include "LogTrace.h"
00054 
00055 using namespace std;
00056 
00057 
00058 
00059 
00063 class File : public MIPObject {
00064  private:
00065   string _fileName;
00066   ifstream _file;
00067 
00068  public:
00071   File(string name){
00072    _fileName = name;
00073    _file.open(_fileName.c_str(), ifstream::in);
00074 
00075    if (!_file.is_open())
00076    {
00077     MIP_WARNING(_fileName << " does not exist!");
00078    }
00079   }
00080 
00081   ~File() {
00082    _file.close();
00083   }
00084 
00085 
00086   // Helper Function to parse FilePath
00087   static string getFileNameFromPath(string path);
00088 
00094   bool allWords(vector<string>& allWordsInFile, bool quotes=true);
00095 
00096   string getObjectName() const {
00097    return "File";
00098   }
00099 };
00100 
00101 
00102 
00103 
00104 
00105 #endif
00106 
00107 /* @} */
00108 
00109 
00110 

Generated on Mon Feb 20 07:01:06 2017 for MIP by  doxygen 1.5.6