Diff for /parser3/src/classes/bool.C between versions 1.2 and 1.7

version 1.2, 2009/04/16 01:10:21 version 1.7, 2015/10/26 01:21:53
Line 1 Line 1
 /** @file  /** @file
         Parser: @b int parser class.          Parser: @b int parser class.
   
         Copyright (c) 2001-2009 ArtLebedev Group (http://www.artlebedev.com)          Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com)
         Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)          Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
 */  */
   
 static const char * const IDENT_INT_C="$Date$";  
   
 #include "classes.h"  #include "classes.h"
 #include "pa_vmethod_frame.h"  #include "pa_vmethod_frame.h"
   
Line 15  static const char * const IDENT_INT_C="$ Line 13  static const char * const IDENT_INT_C="$
 #include "pa_vint.h"  #include "pa_vint.h"
 #include "pa_vbool.h"  #include "pa_vbool.h"
   
   volatile const char * IDENT_BOOL_C="$Id$" IDENT_PA_VBOOL_H;
   
 // externs  // externs
   
 void _string_format(Request& r, MethodParams&);  void _string_format(Request& r, MethodParams&);
Line 24  void _string_format(Request& r, MethodPa Line 24  void _string_format(Request& r, MethodPa
 class MBool: public Methoded {  class MBool: public Methoded {
 public:  public:
         MBool();          MBool();
 public: // Methoded  
         bool used_directly() { return true; }  
 };  };
   
 // global variable  // global variable
Line 34  DECLARE_CLASS_VAR(bool, new MBool, 0); Line 32  DECLARE_CLASS_VAR(bool, new MBool, 0);
   
 // methods  // methods
   
 static void _int(Request& r, MethodParams& params) {  static void _int(Request& r, MethodParams&) {
         // 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);  
   
         VBool& vbool=GET_SELF(r, VBool);          VBool& vbool=GET_SELF(r, VBool);
         r.write_no_lang(*new VInt(vbool.as_bool()));          r.write_no_lang(*new VInt(vbool.as_bool()));
 }  }
   
 static void _double(Request& r, MethodParams& params) {  static void _double(Request& r, MethodParams&) {
         // 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);  
   
         VBool& vbool=GET_SELF(r, VBool);          VBool& vbool=GET_SELF(r, VBool);
         r.write_no_lang(*new VDouble(vbool.as_bool()));          r.write_no_lang(*new VDouble(vbool.as_bool()));
 }  }
   
 static void _bool(Request& r, MethodParams& params) {  static void _bool(Request& r, MethodParams&) {
         // just checking (default) syntax validity, never really using it here, just for string.bool compatibility  
         if(params.count()>0)  
                 params.as_bool(0, "default must be bool", r);  
   
         r.write_no_lang(GET_SELF(r, VBool));          r.write_no_lang(GET_SELF(r, VBool));
 }  }
   
 //typedef void (*vbool_op_func_ptr)(VBool& vbool, double param);  
   
 //static void vbool_op(Request& r, MethodParams& params,   
 //                                       vbool_op_func_ptr func) {  
 //      VBool& vbool=GET_SELF(r, VBool);  
 //      double param=params.count()?params.as_bool(0, "param must be bool", r):1;  
 //      (*func)(vbool, param);  
 //}  
   
 // constructor  // constructor
   
 MBool::MBool(): Methoded("bool") {  MBool::MBool(): Methoded("bool") {
         // ^bool.int[]          // ^bool.int[]
           // ^bool.int[default for ^string.int compatibility]
         add_native_method("int", Method::CT_DYNAMIC, _int, 0, 1);          add_native_method("int", Method::CT_DYNAMIC, _int, 0, 1);
         // ^bool.double[]          // ^bool.double[]
           // ^bool.double[default for ^string.double compatibility]
         add_native_method("double", Method::CT_DYNAMIC, _double, 0, 1);          add_native_method("double", Method::CT_DYNAMIC, _double, 0, 1);
         // ^bool.bool[]          // ^bool.bool[]
           // ^bool.bool[default for ^string.bool compatibility]
         add_native_method("bool", Method::CT_DYNAMIC, _bool, 0, 1);          add_native_method("bool", Method::CT_DYNAMIC, _bool, 0, 1);
 }  }

Removed from v.1.2  
changed lines
  Added in v.1.7


E-mail: