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

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

E-mail: