Source-highlight Library
|
00001 // 00002 // Author: Lorenzo Bettini <http://www.lorenzobettini.it>, (C) 2004-2008 00003 // 00004 // Copyright: See COPYING file that comes with this distribution 00005 // 00006 00007 #ifndef _FILEUTIL_H 00008 #define _FILEUTIL_H 00009 00010 #include <iostream> 00011 #include <string> 00012 #include <cstdio> 00013 #include "ioexception.h" 00014 00015 using std::istream; 00016 using std::string; 00017 using std::FILE; 00018 00019 namespace srchilite { 00020 00021 extern std::string start_path; 00022 00030 string readFile(const string &fileName) throw (IOException); 00031 00032 //char *read_file(const string &fileName); 00033 00042 string createOutputFileName(const string &inputFileName, 00043 const string &outputDir, const string &ext); 00044 00049 unsigned int get_line_count(istream &input); 00050 00055 string get_file_extension(const string &filename); 00056 00057 FILE * open_file_stream(const string &input_file_name); 00058 istream * open_file_istream(const string &filename); 00059 istream * open_file_istream_or_error(const string &filename); 00060 istream * open_data_file_istream(const string &path, const string &filename, 00061 const string &start = start_path); 00062 FILE * open_data_file_stream(const string &path, const string &filename, 00063 const string &start = start_path); 00064 bool read_line(istream *in, string &line); 00065 string get_file_path(const string &s); 00066 bool contains_path(const string &); 00067 string strip_file_path(const string &); 00068 string get_input_file_name(const string &file_name); 00069 00070 } 00071 00072 #endif //_FILEUTIL_H