Annotation of parser3/src/classes/bool.C, revision 1.7

1.1       misha       1: /** @file
                      2:        Parser: @b int parser class.
                      3: 
1.7     ! moko        4:        Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com)
1.1       misha       5:        Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
                      6: */
                      7: 
                      8: #include "classes.h"
                      9: #include "pa_vmethod_frame.h"
                     10: 
                     11: #include "pa_request.h"
                     12: #include "pa_vdouble.h"
                     13: #include "pa_vint.h"
                     14: #include "pa_vbool.h"
                     15: 
1.7     ! moko       16: volatile const char * IDENT_BOOL_C="$Id: bool.C,v 1.6 2013/07/29 15:02:16 moko Exp $" IDENT_PA_VBOOL_H;
1.4       moko       17: 
1.1       misha      18: // externs
                     19: 
                     20: void _string_format(Request& r, MethodParams&);
                     21: 
                     22: // class
                     23: 
                     24: class MBool: public Methoded {
                     25: public:
                     26:        MBool();
                     27: };
                     28: 
                     29: // global variable
                     30: 
                     31: DECLARE_CLASS_VAR(bool, new MBool, 0);
                     32: 
                     33: // methods
                     34: 
1.6       moko       35: static void _int(Request& r, MethodParams&) {
1.1       misha      36:        VBool& vbool=GET_SELF(r, VBool);
                     37:        r.write_no_lang(*new VInt(vbool.as_bool()));
                     38: }
                     39: 
1.6       moko       40: static void _double(Request& r, MethodParams&) {
1.1       misha      41:        VBool& vbool=GET_SELF(r, VBool);
                     42:        r.write_no_lang(*new VDouble(vbool.as_bool()));
                     43: }
                     44: 
1.6       moko       45: static void _bool(Request& r, MethodParams&) {
1.2       misha      46:        r.write_no_lang(GET_SELF(r, VBool));
1.1       misha      47: }
                     48: 
                     49: // constructor
                     50: 
                     51: MBool::MBool(): Methoded("bool") {
                     52:        // ^bool.int[]
1.5       moko       53:        // ^bool.int[default for ^string.int compatibility]
1.1       misha      54:        add_native_method("int", Method::CT_DYNAMIC, _int, 0, 1);
                     55:        // ^bool.double[]
1.5       moko       56:        // ^bool.double[default for ^string.double compatibility]
1.1       misha      57:        add_native_method("double", Method::CT_DYNAMIC, _double, 0, 1);
                     58:        // ^bool.bool[]
1.5       moko       59:        // ^bool.bool[default for ^string.bool compatibility]
1.1       misha      60:        add_native_method("bool", Method::CT_DYNAMIC, _bool, 0, 1);
                     61: }

E-mail: