Source-highlight Library
fileutil.h
1 //
2 // Author: Lorenzo Bettini <http://www.lorenzobettini.it>, (C) 2004-2008
3 //
4 // Copyright: See COPYING file that comes with this distribution
5 //
6 
7 #ifndef _FILEUTIL_H
8 #define _FILEUTIL_H
9 
10 #include <iostream>
11 #include <string>
12 #include <cstdio>
13 #include "ioexception.h"
14 
15 using std::istream;
16 using std::string;
17 using std::FILE;
18 
19 namespace srchilite {
20 
21 extern std::string start_path;
22 
30 string readFile(const string &fileName) throw (IOException);
31 
32 //char *read_file(const string &fileName);
33 
42 string createOutputFileName(const string &inputFileName,
43  const string &outputDir, const string &ext);
44 
49 unsigned int get_line_count(istream &input);
50 
55 string get_file_extension(const string &filename);
56 
57 FILE * open_file_stream(const string &input_file_name);
58 istream * open_file_istream(const string &filename);
59 istream * open_file_istream_or_error(const string &filename);
60 istream * open_data_file_istream(const string &path, const string &filename,
61  const string &start = start_path);
62 FILE * open_data_file_stream(const string &path, const string &filename,
63  const string &start = start_path);
64 bool read_line(istream *in, string &line);
65 string get_file_path(const string &s);
66 bool contains_path(const string &);
67 string strip_file_path(const string &);
68 string get_input_file_name(const string &file_name);
69 
70 }
71 
72 #endif //_FILEUTIL_H
C++ class: doctemplate.h.
Definition: bufferedoutput.cpp:13
string readFile(const string &fileName)
Reads the contents of the file into a string and returns it.
Definition: fileutil.cc:51
unsigned int get_line_count(istream &input)
Definition: fileutil.cc:143
string createOutputFileName(const string &inputFileName, const string &outputDir, const string &ext)
Creates the output file name as outputDir + input file name + ext.
Definition: fileutil.cc:107
string get_file_extension(const string &s)
Definition: fileutil.cc:158