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

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)
1.22    ! paf         5:        Author: Alexander Petrosyan <paf@design.ru> (http://paf.design.ru)
1.1       paf         6: 
1.22    ! paf         7:        $Id: pa_vimage.h,v 1.21 2001/10/17 12:27:04 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.20      parser     17: // defines
                     18: 
                     19: #define VIMAGE_TYPE "image"
                     20: 
                     21: // forwards
                     22: 
1.7       paf        23: class gdImage; class Font;
1.10      paf        24: 
1.20      parser     25: // externs
                     26: 
1.10      paf        27: extern Methoded *image_class;
1.7       paf        28: 
1.8       paf        29: /** holds img attributes 
1.1       paf        30:        and [image itself]
                     31: */
                     32: class VImage : public VStateless_object {
                     33: public: // Value
                     34:        
1.20      parser     35:        const char *type() const { return VIMAGE_TYPE; }
1.1       paf        36: 
                     37:        /// VImage: true
1.17      parser     38:        bool as_bool() const { return true; }
1.19      parser     39: 
                     40:        /// VImage: true
                     41:        Value *as_expr_result(bool return_string_as_is=false) { return NEW VBool(pool(), as_bool()); }
1.1       paf        42: 
                     43:        /// VImage: method,field
                     44:        Value *VImage::get_element(const String& aname) {
                     45:                // $method
                     46:                if(Value *result=VStateless_object::get_element(aname))
                     47:                        return result;
                     48: 
                     49:                // $src, $size
                     50:                return static_cast<Value *>(ffields.get(aname));
                     51:        }
1.15      parser     52: 
                     53:        /// VImage: field
                     54:        void put_element(const String& aname, Value *avalue);
1.1       paf        55: 
                     56: protected: // VAliased
                     57: 
                     58:        /// disable .CLASS element. @see VAliased::get_element
                     59:        bool hide_class() { return true; }
                     60: 
                     61: public: // usage
                     62: 
                     63:        VImage::VImage(Pool& apool) : VStateless_object(apool, *image_class),
1.7       paf        64:                ffields(apool),
                     65:                image(0), font(0) {
1.1       paf        66:        }
                     67: 
1.3       paf        68:        void set(const String *src, int width, int height,
1.6       paf        69:                gdImage *aimage=0);
1.1       paf        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: