1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
// This file is part of The New Aspell
// Copyright (C) 2001 by Kevin Atkinson under the GNU LGPL license
// version 2.0 or 2.1. You should have received a copy of the LGPL
// license along with this library if you did not you can find
// it at http://www.gnu.org/.
#ifndef ASPELL_FILE_UTIL__HPP
#define ASPELL_FILE_UTIL__HPP
#include <time.h>
#include "string.hpp"
#include "posib_err.hpp"
namespace acommon {
class FStream;
class Config;
class StringList;
bool need_dir(ParmString file);
String add_possible_dir(ParmString dir, ParmString file);
String figure_out_dir(ParmString dir, ParmString file);
// FIXME: Possible remove
//void open_file(FStream & in, const string & file,
// ParmString mode = "r");
time_t get_modification_time(FStream & f);
PosibErr<void> open_file_readlock(FStream& in, ParmString file);
PosibErr<bool> open_file_writelock(FStream & in, ParmString file);
// returns true if the file already exists
void truncate_file(FStream & f, ParmString name);
bool remove_file(ParmString name);
bool file_exists(ParmString name);
bool rename_file(ParmString orig, ParmString new_name);
// will return NULL if path is NULL.
const char * get_file_name(const char * path);
// expands filename to the full path
// returns the length of the directory part or 0 if nothing found
unsigned find_file(const Config *, const char * option, String & filename);
unsigned find_file(const StringList &, String & filename);
class StringEnumeration;
class PathBrowser
{
String suffix;
String path;
StringEnumeration * els;
void * dir_handle;
const char * dir;
PathBrowser(const PathBrowser &);
void operator= (const PathBrowser &);
public:
PathBrowser(const StringList &, const char * suf = "");
~PathBrowser();
const char * next();
};
}
#endif
|