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

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.9.2.1 ! paf         8:        $Id: pa_vimage.h,v 1.9 2001/04/26 15:01:51 paf Exp $
1.1       paf         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: 
1.7       paf        19: class gdImage; class Font;
1.9.2.1 ! paf        20: 
        !            21: extern Methoded *image_class;
1.7       paf        22: 
1.8       paf        23: /** holds img attributes 
1.1       paf        24:        and [image itself]
                     25: */
                     26: class VImage : public VStateless_object {
                     27: public: // Value
                     28:        
                     29:        /// all: for error reporting after fail(), etc
                     30:        const char *type() const { return "image"; }
                     31: 
                     32:        /// VImage: this
                     33:        Value *as_expr_result(bool return_string_as_is=false) { return this; }
                     34: 
                     35:        /// VImage: true
                     36:        bool as_bool() { return true; }
                     37: 
                     38:        /// VImage: method,field
                     39:        Value *VImage::get_element(const String& aname) {
                     40:                // $method
                     41:                if(Value *result=VStateless_object::get_element(aname))
                     42:                        return result;
                     43: 
                     44:                // $src, $size
                     45:                return static_cast<Value *>(ffields.get(aname));
                     46:        }
                     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: