Annotation of parser3/src/types/pa_vfile.h, revision 1.2
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.2 ! paf 6: $Id: pa_vfile.h,v 1.1 2001/03/19 20:08:13 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"
14: #include "pa_vstateless_class.h"
15: #include "_file.h"
16:
17: class Request;
18:
19: class VFile : public VStateless_class {
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
33: if(Value *result=VStateless_class::get_element(aname))
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: