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

1.9       paf         1: /** @file
1.1       paf         2:        Parser: @b image parser type decl.
                      3: 
1.23      paf         4:        Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com)
1.24      paf         5:        Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.1       paf         6: */
                      7: 
                      8: #ifndef PA_VIMAGE_H
                      9: #define PA_VIMAGE_H
1.26      paf        10: 
1.29    ! paf        11: static const char* IDENT_VIMAGE_H="$Date: 2002/08/12 10:32:53 $";
1.1       paf        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.25      paf        36:        VStateless_class *get_class() { return image_class; }
1.1       paf        37: 
                     38:        /// VImage: true
1.17      parser     39:        bool as_bool() const { return true; }
1.19      parser     40: 
                     41:        /// VImage: true
                     42:        Value *as_expr_result(bool return_string_as_is=false) { return NEW VBool(pool(), as_bool()); }
1.1       paf        43: 
                     44:        /// VImage: method,field
1.29    ! paf        45:        Value *get_element(const String& aname, Value *aself) {
1.1       paf        46:                // $method
1.29    ! paf        47:                if(Value *result=VStateless_object::get_element(aname, aself))
1.1       paf        48:                        return result;
                     49: 
                     50:                // $src, $size
                     51:                return static_cast<Value *>(ffields.get(aname));
                     52:        }
1.15      parser     53: 
                     54:        /// VImage: field
1.29    ! paf        55:        /*override*/ bool put_element(const String& aname, Value *avalue, bool replace);
1.1       paf        56: 
                     57: public: // usage
                     58: 
1.25      paf        59:        VImage::VImage(Pool& apool) : VStateless_object(apool),
1.7       paf        60:                ffields(apool),
                     61:                image(0), font(0) {
1.1       paf        62:        }
                     63: 
1.3       paf        64:        void set(const String *src, int width, int height,
1.6       paf        65:                gdImage *aimage=0);
1.1       paf        66: 
                     67:        Hash fields() const { return ffields; }
1.3       paf        68: 
                     69: public:
                     70: 
1.7       paf        71:        gdImage *image; Font *font;
1.1       paf        72: 
                     73: private:
                     74: 
                     75:        Hash ffields;
                     76: 
                     77: };
                     78: 
                     79: #endif

E-mail: