Annotation of parser3/src/classes/nothing.C, revision 1.2

1.1       parser      1: /** @file
                      2:        Parser: @b nothing parser class.
                      3: 
                      4:        Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
                      5: 
                      6:        Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
                      7: 
1.2     ! parser      8:        $Id: nothing.C,v 1.1 2001/05/21 17:11:57 parser Exp $
1.1       parser      9: */
                     10: 
                     11: #include "classes.h"
                     12: #include "pa_request.h"
                     13: #include "pa_vint.h"
                     14: #include "pa_vdouble.h"
1.2     ! parser     15: #include "pa_vnothing.h"
1.1       parser     16: 
                     17: // defines
                     18: 
                     19: #define NOTHING_CLASS_NAME "nothing"
                     20: 
                     21: // class
                     22: 
                     23: class MNothing : public Methoded {
                     24: public:
                     25:        MNothing(Pool& pool);
                     26: public: // Methoded
                     27:        bool used_directly() { return false; }
                     28: };
                     29: 
                     30: // methods
                     31: 
                     32: static void _int(Request& r, const String&, MethodParams *) {
                     33:        Pool& pool=r.pool();
                     34:        VInt *vunknown=static_cast<VInt *>(r.self);
                     35:        Value& value=*new(pool) VInt(pool, vunknown->as_int());
                     36:        r.write_no_lang(value);
                     37: }
                     38: 
                     39: static void _double(Request& r, const String&, MethodParams *) {
                     40:        Pool& pool=r.pool();
                     41:        VInt *vunknown=static_cast<VInt *>(r.self);
                     42:        Value& value=*new(pool) VDouble(pool, vunknown->as_double());
                     43:        r.write_no_lang(value);
                     44: }
                     45: 
                     46: // constructor
                     47: 
                     48: MNothing::MNothing(Pool& apool) : Methoded(apool) {
                     49:        set_name(*NEW String(pool(), NOTHING_CLASS_NAME));
                     50: 
                     51: 
                     52:        // ^nothing.int[]
                     53:        add_native_method("int", Method::CT_DYNAMIC, _int, 0, 0);
                     54: 
                     55:        // ^nothing.double[]
                     56:        add_native_method("double", Method::CT_DYNAMIC, _double, 0, 0);
                     57: }
                     58: 
                     59: // global variable
                     60: 
                     61: Methoded *unknown_class;
                     62: 
                     63: // creator
                     64: 
                     65: Methoded *MNothing_create(Pool& pool) {
                     66:        return unknown_class=new(pool) MNothing(pool);
                     67: }

E-mail: