--- parser3/src/classes/double.C 2012/04/19 19:41:29 1.65 +++ parser3/src/classes/double.C 2016/03/31 21:46:19 1.69 @@ -1,7 +1,7 @@ /** @file Parser: @b double parser class. - Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ @@ -13,7 +13,7 @@ #include "pa_vint.h" #include "pa_vbool.h" -volatile const char * IDENT_DOUBLE_C="$Id: double.C,v 1.65 2012/04/19 19:41:29 moko Exp $" IDENT_PA_VDOUBLE_H; +volatile const char * IDENT_DOUBLE_C="$Id: double.C,v 1.69 2016/03/31 21:46:19 moko Exp $" IDENT_PA_VDOUBLE_H; // externs @@ -28,33 +28,21 @@ public: // global variable -DECLARE_CLASS_VAR(double, new MDouble, 0); +DECLARE_CLASS_VAR(double, new MDouble); // methods -static void _int(Request& r, MethodParams& params) { - // just checking (default) syntax validity, never really using it here, just for string.int compatibility - if(params.count()>0) - params.as_int(0, "default must be int", r); - +static void _int(Request& r, MethodParams&) { VDouble& vdouble=GET_SELF(r, VDouble); r.write_no_lang(*new VInt(vdouble.as_int())); } -static void _double(Request& r, MethodParams& params) { - // just checking (default) syntax validity, never really using it here, just for string.double compatibility - if(params.count()>0) - params.as_double(0, "default must be double", r); - +static void _double(Request& r, MethodParams&) { VDouble& vdouble=GET_SELF(r, VDouble); r.write_no_lang(*new VDouble(vdouble.as_double())); } -static void _bool(Request& r, MethodParams& params) { - // just checking (default) syntax validity, never really using it here, just for string.bool compatibility - if(params.count()>0) - params.as_double(0, "default must be bool", r); - +static void _bool(Request& r, MethodParams&) { VDouble& vdouble=GET_SELF(r, VDouble); r.write_no_lang(VBool::get(vdouble.as_bool())); } @@ -104,12 +92,13 @@ static void _sql(Request& r, MethodParam MDouble::MDouble(): Methoded("double") { // ^double.int[] + // ^double.int[default for ^string.int compatibility] add_native_method("int", Method::CT_DYNAMIC, _int, 0, 1); - // ^double.double[] + // ^double.double[default for ^string.double compatibility] add_native_method("double", Method::CT_DYNAMIC, _double, 0, 1); - // ^double.bool[] + // ^double.bool[default for ^string.bool compatibility] add_native_method("bool", Method::CT_DYNAMIC, _bool, 0, 1); // ^double.inc[]