Annotation of parser3/src/types/pa_vimage.h, revision 1.19
1.9 paf 1: /** @file
1.1 paf 2: Parser: @b image parser type decl.
3:
4: Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
5: Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
6:
1.19 ! parser 7: $Id: pa_vimage.h,v 1.18 2001/09/26 10:32:26 parser Exp $
1.1 paf 8: */
9:
10: #ifndef PA_VIMAGE_H
11: #define PA_VIMAGE_H
12:
1.12 paf 13: #include "classes.h"
1.1 paf 14: #include "pa_common.h"
15: #include "pa_vstateless_object.h"
16:
1.7 paf 17: class gdImage; class Font;
1.10 paf 18:
19: extern Methoded *image_class;
1.7 paf 20:
1.8 paf 21: /** holds img attributes
1.1 paf 22: and [image itself]
23: */
24: class VImage : public VStateless_object {
25: public: // Value
26:
27: const char *type() const { return "image"; }
28:
29: /// VImage: true
1.17 parser 30: bool as_bool() const { return true; }
1.19 ! parser 31:
! 32: /// VImage: true
! 33: Value *as_expr_result(bool return_string_as_is=false) { return NEW VBool(pool(), as_bool()); }
1.1 paf 34:
35: /// VImage: method,field
36: Value *VImage::get_element(const String& aname) {
37: // $method
38: if(Value *result=VStateless_object::get_element(aname))
39: return result;
40:
41: // $src, $size
42: return static_cast<Value *>(ffields.get(aname));
43: }
1.15 parser 44:
45: /// VImage: field
46: void put_element(const String& aname, Value *avalue);
1.1 paf 47:
48: protected: // VAliased
49:
50: /// disable .CLASS element. @see VAliased::get_element
51: bool hide_class() { return true; }
52:
53: public: // usage
54:
55: VImage::VImage(Pool& apool) : VStateless_object(apool, *image_class),
1.7 paf 56: ffields(apool),
57: image(0), font(0) {
1.1 paf 58: }
59:
1.3 paf 60: void set(const String *src, int width, int height,
1.6 paf 61: gdImage *aimage=0);
1.1 paf 62: void save(const String& image_spec) {
63: /*if(fvalue_ptr)
64: image_write(pool(), image_spec, fvalue_ptr, fvalue_size, false);
65: else
66: THROW(0, 0,
67: &image_spec,
68: "saving unassigned image"); //never*/
69: }
70:
71: Hash fields() const { return ffields; }
1.3 paf 72:
73: public:
74:
1.7 paf 75: gdImage *image; Font *font;
1.1 paf 76:
77: private:
78:
79: Hash ffields;
80:
81: };
82:
83: #endif
E-mail: