00001 #ifndef Impala_Basis_FileReadString_h
00002 #define Impala_Basis_FileReadString_h
00003
00004 #include <vector>
00005 #include "Basis/File.h"
00006
00007 namespace Impala
00008 {
00009
00010
00011 template<class BackInsertIterator>
00012 inline void
00013 FileReadString(BackInsertIterator bi, String fileName, bool skipEC = true,
00014 bool needFile = true)
00015 {
00016 Impala::File f(fileName, "r", needFile);
00017 if (! f.Valid())
00018 return;
00019 while (! f.Eof())
00020 {
00021 String line = f.ReadLine(skipEC);
00022 if (line[0] || !skipEC)
00023 *bi++ = line;
00024 }
00025 }
00026
00027 inline void
00028 ReadStrings(std::vector<String>& stringList, const String& filename)
00029 {
00030 FileReadString(std::back_inserter(stringList), filename);
00031 }
00032
00033
00034 }
00035
00036 #endif