/src/aspell/modules/speller/default/data_util.hpp
Line | Count | Source (jump to first uncovered line) |
1 | | #ifndef __aspeller_data_util_hh__ |
2 | | #define __aspeller_data_util_hh__ |
3 | | |
4 | | #include <ctime> |
5 | | |
6 | | //POSIX headers |
7 | | #include <sys/stat.h> |
8 | | |
9 | | #include "parm_string.hpp" |
10 | | |
11 | | using namespace acommon; |
12 | | |
13 | | namespace aspeller { |
14 | | |
15 | | template <class Itr> |
16 | | struct CharStrParms { |
17 | | typedef const char * Value; |
18 | | typedef Itr Iterator; |
19 | | Iterator end_; |
20 | | CharStrParms(Iterator e) : end_(e) {} |
21 | | bool endf(Iterator i) const {return i == end_;} |
22 | | Value deref(Iterator i) const {return *i;} |
23 | | Value end_state() const {return 0;} |
24 | | }; |
25 | | |
26 | | template <class Itr> |
27 | | struct StrParms { |
28 | | typedef const char * Value; |
29 | | typedef Itr Iterator; |
30 | | Iterator end_; |
31 | | StrParms(Iterator e) : end_(e) {} |
32 | | bool endf(Iterator i) const {return i == end_;} |
33 | | Value deref(Iterator i) const {return i->c_str();} |
34 | | Value end_state() const {return 0;} |
35 | | }; |
36 | | |
37 | 0 | inline time_t modification_date(ParmString file) { |
38 | 0 | struct stat file_stat; |
39 | 0 | if (stat(file, &file_stat) == 0) |
40 | 0 | return file_stat.st_mtime; |
41 | 0 | else |
42 | 0 | return 0; |
43 | 0 | } |
44 | | } |
45 | | |
46 | | #endif |