Annotation of parser3/src/types/pa_vfile.h, revision 1.3
1.1 paf 1: /*
2: Parser
3: Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
4: Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
5:
1.3 ! paf 6: $Id: pa_vfile.h,v 1.2 2001/03/19 20:46:40 paf Exp $
1.1 paf 7: */
8:
9: #ifndef PA_VFILE_H
10: #define PA_VFILE_H
11:
12: #include "pa_common.h"
13: #include "pa_globals.h"
1.3 ! paf 14: #include "pa_vstateless_object.h"
1.1 paf 15: #include "_file.h"
16:
17: class Request;
18:
1.3 ! paf 19: class VFile : public VStateless_object {
1.1 paf 20: public: // Value
21:
1.2 paf 22: /// all: for error reporting after fail(), etc
1.1 paf 23: const char *type() const { return "file"; }
24:
1.2 paf 25: /// VFile: this
26: Value *get_expr_result() { return this; }
27: /// VFile: true
28: bool get_bool() { return true; }
29:
30: /// VFile: CLASS,BASE,method,field
1.1 paf 31: Value *VFile::get_element(const String& aname) {
32: // $CLASS,$BASE,$method
1.3 ! paf 33: if(Value *result=VStateless_object::get_element(aname))
1.1 paf 34: return result;
35:
36: // $element
37: return static_cast<Value *>(fields.get(aname));
38: }
39:
40: public: // usage
41:
42: VFile(Pool& apool,
43: const char *avalue_ptr, size_t avalue_size,
1.2 paf 44: const char *afile_name);
1.1 paf 45:
46: void save(const char *file_spec) {
47: file_write(pool(), file_spec, fvalue_ptr, fvalue_size);
48: }
49:
50: private:
51:
52: const char *fvalue_ptr;
53: size_t fvalue_size;
54: Hash fields;
55:
56: };
57:
58: #endif
E-mail: