Annotation of parser3/src/types/pa_vimage.h, revision 1.10

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: 
                      6:        Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
                      7: 
1.10    ! paf         8:        $Id: pa_vimage.h,v 1.9.2.2 2001/04/28 07:27:46 paf Exp $
1.1       paf         9: */
                     10: 
                     11: #ifndef PA_VIMAGE_H
                     12: #define PA_VIMAGE_H
                     13: 
1.10    ! paf        14: #include "classes.h"
1.1       paf        15: #include "pa_common.h"
                     16: #include "pa_vstateless_object.h"
                     17: 
1.7       paf        18: class gdImage; class Font;
1.10    ! paf        19: 
        !            20: extern Methoded *image_class;
1.7       paf        21: 
1.8       paf        22: /** holds img attributes 
1.1       paf        23:        and [image itself]
                     24: */
                     25: class VImage : public VStateless_object {
                     26: public: // Value
                     27:        
                     28:        /// all: for error reporting after fail(), etc
                     29:        const char *type() const { return "image"; }
                     30: 
                     31:        /// VImage: this
                     32:        Value *as_expr_result(bool return_string_as_is=false) { return this; }
                     33: 
                     34:        /// VImage: true
                     35:        bool as_bool() { return true; }
                     36: 
                     37:        /// VImage: method,field
                     38:        Value *VImage::get_element(const String& aname) {
                     39:                // $method
                     40:                if(Value *result=VStateless_object::get_element(aname))
                     41:                        return result;
                     42: 
                     43:                // $src, $size
                     44:                return static_cast<Value *>(ffields.get(aname));
                     45:        }
                     46: 
                     47: protected: // VAliased
                     48: 
                     49:        /// disable .CLASS element. @see VAliased::get_element
                     50:        bool hide_class() { return true; }
                     51: 
                     52: public: // usage
                     53: 
                     54:        VImage::VImage(Pool& apool) : VStateless_object(apool, *image_class),
1.7       paf        55:                ffields(apool),
                     56:                image(0), font(0) {
1.1       paf        57:        }
                     58: 
1.3       paf        59:        void set(const String *src, int width, int height,
1.6       paf        60:                gdImage *aimage=0);
1.1       paf        61:        void save(const String& image_spec) {
                     62:                /*if(fvalue_ptr)
                     63:                        image_write(pool(), image_spec, fvalue_ptr, fvalue_size, false);
                     64:                else
                     65:                        THROW(0, 0,
                     66:                                &image_spec,
                     67:                                "saving unassigned image"); //never*/
                     68:        }
                     69: 
                     70:        Hash fields() const { return ffields; }
1.3       paf        71: 
                     72: public:
                     73: 
1.7       paf        74:        gdImage *image; Font *font;
1.1       paf        75: 
                     76: private:
                     77: 
                     78:        Hash ffields;
                     79: 
                     80: };
                     81: 
                     82: #endif

E-mail: