39 void copy_file(
const std::string& src,
const std::string& dest);
53 void readDirectory(
const std::string& path, std::list<std::string>& dirlist,
const std::string& pattern=
"",
const bool& isRecursive=
false);
55 std::list<std::string>
readDirectory(
const std::string& path,
const std::string& pattern=
"",
const bool& isRecursive=
false);
77 std::string
cleanPath(std::string in_path,
const bool& resolve=
false,
const bool& silent=
false);
117 std::string
getPath(
const std::string& filename,
const bool& resolve=
false);
133 char getEoln(std::istream& fin);
135 void skipLines(std::istream& fin,
const size_t& nbLines,
const char& eoln=
'\n');
138 const size_t& linecount=1,
139 const std::string& delimiter=
"=",
const bool& keep_case=
false);
160 void setIndex(
const Date& i_date,
const std::streampos& i_pos,
const size_t& linenr=
static_cast<size_t>(-1));
161 void setIndex(
const std::string& i_date,
const std::streampos& i_pos,
const size_t& linenr=
static_cast<size_t>(-1));
162 void setIndex(
const double& i_date,
const std::streampos& i_pos,
const size_t& linenr=
static_cast<size_t>(-1));
171 std::streampos
getIndex(
const std::string& i_date)
const;
172 std::streampos
getIndex(
const double& i_date)
const;
181 std::streampos
getIndex(
const Date& i_date,
size_t& o_linenr)
const;
182 std::streampos
getIndex(
const std::string& i_date,
size_t& o_linenr)
const;
183 std::streampos
getIndex(
const double& i_date,
size_t& o_linenr)
const;
189 file_index(
const Date& i_date,
const std::streampos& i_pos,
const size_t& i_linenr=
static_cast<size_t>(-1)) : date(i_date), linenr(i_linenr), pos(i_pos) {}
190 bool operator<(
const file_index& a)
const {
191 return date < a.date;
193 bool operator>(
const file_index& a)
const {
194 return date > a.date;
200 size_t binarySearch(
const Date& soughtdate)
const;
202 std::vector< struct file_index > vecIndex;
A class to handle timestamps. This class handles conversion between different time display formats (I...
Definition: Date.h:87
Definition: FileUtils.h:150
const std::string toString() const
Definition: FileUtils.cc:560
FileIndexer()
Definition: FileUtils.h:152
std::streampos getIndex(const Date &i_date) const
Get the file position suitable for a given date.
Definition: FileUtils.cc:501
void setIndex(const Date &i_date, const std::streampos &i_pos, const size_t &linenr=static_cast< size_t >(-1))
Add a new position to the index.
Definition: FileUtils.cc:470
void createDirectories(const std::string &path)
creates the directory tree for the given path, including missing intermediate directories (gives only...
Definition: FileUtils.cc:225
std::string getCWD()
returns the current working directory.
Definition: FileUtils.cc:316
std::string getPath(const std::string &filename, const bool &resolve)
returns the path preceeding a given filename.
Definition: FileUtils.cc:145
void copy_file(const std::string &src, const std::string &dest)
Copies a files from one location to another.
Definition: FileUtils.cc:68
std::string removeExtension(const std::string &filename)
remove the extension part of a given filename.
Definition: FileUtils.cc:135
std::string cleanPath(std::string in_path, const bool &resolve, const bool &silent)
Replace "\" by "/" in a string so that a path string is cross plateform, optionally resolve links,...
Definition: FileUtils.cc:89
std::string getFilename(const std::string &path)
extract the file name from a path+filename string.
Definition: FileUtils.cc:156
bool fileExists(const std::string &filename)
Definition: FileUtils.cc:325
std::string getExtension(const std::string &filename)
returns the extension part of a given filename.
Definition: FileUtils.cc:122
bool isWindowsPath(const std::string &path)
Definition: FileUtils.cc:220
char getEoln(std::istream &fin)
Definition: FileUtils.cc:394
std::string getDateTime()
returns the current date and time as a string.
Definition: FileUtils.cc:165
bool validFileAndPath(const std::string &filename)
Definition: FileUtils.cc:174
void readDirectory(const std::string &path, std::list< std::string > &dirlist, const std::string &pattern, const bool &isRecursive)
Build a list of file in a given directory.
Definition: FileUtils.cc:199
void skipLines(std::istream &fin, const size_t &nbLines, const char &eoln)
Definition: FileUtils.cc:427
bool isAbsolutePath(const std::string &in_path)
checks if a path is an absolute path
Definition: FileUtils.cc:190
bool directoryExists(const std::string &path)
Definition: FileUtils.cc:211
std::map< std::string, std::string > readKeyValueHeader(std::istream &fin, const size_t &linecount, const std::string &delimiter, const bool &keep_case)
Definition: FileUtils.cc:437