--- parser3/src/classes/Attic/unknown.C 2001/04/27 15:19:24 1.2.4.1 +++ parser3/src/classes/Attic/unknown.C 2001/05/11 17:45:10 1.7 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: unknown.C,v 1.2.4.1 2001/04/27 15:19:24 paf Exp $ + $Id: unknown.C,v 1.7 2001/05/11 17:45:10 parser Exp $ */ #include "classes.h" @@ -23,6 +23,7 @@ class MUnknown : public Methoded { public: MUnknown(Pool& pool); +public: // Methoded bool used_directly() { return false; } }; @@ -31,7 +32,7 @@ public: static void _int(Request& r, const String&, MethodParams *) { Pool& pool=r.pool(); VInt *vunknown=static_cast(r.self); - Value& value=*new(pool) VInt(pool, (int)vunknown->as_double()); + Value& value=*new(pool) VInt(pool, vunknown->as_int()); r.write_no_lang(value); } @@ -44,21 +45,23 @@ static void _double(Request& r, const St // constructor -MUnknown::MUnknown(Pool& pool, VStateless_class& vclass) { - set_name(new(pool) String(pool, UNKNOWN_CLASS_NAME)); +MUnknown::MUnknown(Pool& apool) : Methoded(apool) { + set_name(*NEW String(pool(), UNKNOWN_CLASS_NAME)); + // ^unknown.int[] - vclass.add_native_method("int", Method::CT_DYNAMIC, _int, 0, 0); + add_native_method("int", Method::CT_DYNAMIC, _int, 0, 0); // ^unknown.double[] - vclass.add_native_method("double", Method::CT_DYNAMIC, _double, 0, 0); + add_native_method("double", Method::CT_DYNAMIC, _double, 0, 0); } + // global variable Methoded *unknown_class; // creator -Methoded *MTable_create(Pool& pool) { +Methoded *MUnknown_create(Pool& pool) { return unknown_class=new(pool) MUnknown(pool); }