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

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

E-mail: