|
|
| version 1.68, 2002/03/27 15:30:34 | version 1.71, 2002/04/18 10:50:59 |
|---|---|
| Line 25 | Line 25 |
| #include "pa_vfile.h" | #include "pa_vfile.h" |
| #include "pa_vimage.h" | #include "pa_vimage.h" |
| // defines | |
| #define IMAGE_CLASS_NAME "image" | |
| // class | // class |
| class MImage : public Methoded { | class MImage : public Methoded { |
| Line 314 static void _html(Request& r, const Stri | Line 310 static void _html(Request& r, const Stri |
| Hash *attribs=0; | Hash *attribs=0; |
| if(params->size()) { | if(params->size()) { |
| Value &vattribs=r.process(params->get(0), | // for backward compatibility: someday was ^html{} |
| 0/*no name*/, | Value &vattribs=r.process_to_value(params->get(0), |
| /*0/*no name* /,*/ | |
| false/*don't intercept string*/); | false/*don't intercept string*/); |
| if(vattribs.is_defined()) // allow 'void' | if(vattribs.is_defined()) // allow 'void' |
| if(attribs=vattribs.get_hash(&method_name)) { | if(attribs=vattribs.get_hash(&method_name)) { |
| Line 692 static void _length(Request& r, const St | Line 689 static void _length(Request& r, const St |
| VImage& vimage=*static_cast<VImage *>(r.self); | VImage& vimage=*static_cast<VImage *>(r.self); |
| if(vimage.image) | if(vimage.image) |
| if(vimage.font) { | if(vimage.font) { |
| VInt& result=*new(pool) VInt(pool, vimage.font->string_width(s)); | r.write_no_lang(*new(pool) VInt(pool, vimage.font->string_width(s))); |
| result.set_name(method_name); | |
| r.write_assign_lang(result); | |
| } else | } else |
| throw Exception("parser.runtime", | throw Exception("parser.runtime", |
| &method_name, | &method_name, |
| Line 813 static void _copy(Request& r, const Stri | Line 808 static void _copy(Request& r, const Stri |
| // constructor | // constructor |
| MImage::MImage(Pool& apool) : Methoded(apool) { | MImage::MImage(Pool& apool) : Methoded(apool, "image") { |
| set_name(*NEW String(pool(), IMAGE_CLASS_NAME)); | |
| // ^image:measure[DATA] | // ^image:measure[DATA] |
| add_native_method("measure", Method::CT_DYNAMIC, _measure, 1, 1); | add_native_method("measure", Method::CT_DYNAMIC, _measure, 1, 1); |