00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef IXE_Text_WordSet_H
00025 # define NON_TEMPLATE
00026 # include "text/WordSet.h"
00027 #endif
00028
00029 #ifndef NON_TEMPLATE
00030
00031 using namespace std;
00032
00033 namespace IXE {
00034 namespace Text {
00035
00036 #define MAX_LINE_LEN 4096
00037
00038 template <class _Hash, class _Pred>
00039 WordSetBase<_Hash, _Pred>::WordSetBase(char const* file) {
00040 }
00041
00042 template <class _Hash, class _Pred>
00043 WordSetBase<_Hash, _Pred>::WordSetBase(string& file) {
00044 load(file.c_str());
00045 }
00046
00047 template <class _Hash, class _Pred>
00048 void WordSetBase<_Hash, _Pred>::load(char const* file)
00049 {
00050 ifstream ifs(file);
00051 load(ifs);
00052 }
00053
00054 template <class _Hash, class _Pred>
00055 void WordSetBase<_Hash, _Pred>::load(ifstream& ifs)
00056 {
00057 char line[MAX_LINE_LEN];
00058
00059 while (ifs.getline(line, MAX_LINE_LEN))
00060 insert((char const*)line);
00061 }
00062
00063 template <class _Hash, class _Pred>
00064 void WordSetBase<_Hash, _Pred>::store(char const* file)
00065 {
00066 ofstream ofs(file);
00067
00068 for (typename _Base::const_iterator wit = this->begin(); wit != this->end(); ++wit)
00069 ofs << *wit << endl;
00070 }
00071
00072 }
00073 }
00074
00075 #endif // NO_TEMPLATE