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