1: /******************************************************************************
2: ezht - Copyright (C) 2004 Tradcrafts
3: This file is part of the ezht.
4:
5: ezht is free software; you can redistribute it and/or modify
6: it under the terms of the GNU General Public License as published by the
7: Free Software Foundation; either version 2 of the License, or (at your
8: option) any later version.
9:
10: ezht is distributed in the hope that it will be useful, but
11: WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12: or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13: more details.
14:
15: You should have received a copy of the GNU General Public License along with
16: this program; see the file COPYING. If not, write to the Free Software
17: Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18: ******************************************************************************/
19:
20: #ifndef _VFILE_H_
21: #define _VFILE_H_
22:
23: #include <stdio.h>
24: #include <list>
25: #include <string>
26:
27: class VFile
28: {
29: bool is_clone;
30: std::string fname;
31: std::list<std::string>::iterator cur;
32: std::list<std::string> *datas;
33:
34: VFile(const VFile &src);
35:
36: public:
37:
38: VFile(const char *_fnam);
39:
40: ~VFile();
41:
42: const char *get_filename();
43:
44: void puts(const char*);
45: void printf(const char *fmt, ...);
46: void chomp(); //直前の改行文字を切り落とす
47:
48: void add_index(const char *index_name);
49: bool seek(const std::string &index_name);
50:
51: void flush();
52: void flush2(FILE *out);
53:
54: VFile *clone();
55:
56: void reset_filename(const char *new_fname);
57:
58: //
59: void rewind();
60: void each( bool (*callback)(VFile*,const char*,std::string &, std::string*) );
61: };
62:
63: VFile* vf_open(const char *fname);
64: VFile* vf_search(const char *fname);
65: void vf_flushall();
66: void vf_flushall_to(FILE *out);
67:
68: void vf_each(bool (*callback)(VFile*,const char *,std::string &,std::string*));
69:
70: #endif