Annotation of parser3/src/classes/unknown.C, revision 1.2
1.1 paf 1: /** @file
2: Parser: @b unknown 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 ! paf 8: $Id: unknown.C,v 1.1 2001/04/12 15:02:37 paf Exp $
1.1 paf 9: */
10:
11: #include "pa_request.h"
12: #include "_unknown.h"
13: #include "pa_vint.h"
14: #include "pa_vdouble.h"
15: #include "pa_vunknown.h"
16:
17: // global var
18:
19: VStateless_class *unknown_class;
20:
21: // methods
22:
1.2 ! paf 23: static void _int(Request& r, const String&, MethodParams *) {
1.1 paf 24: Pool& pool=r.pool();
25: VInt *vunknown=static_cast<VInt *>(r.self);
26: Value& value=*new(pool) VInt(pool, (int)vunknown->as_double());
27: r.write_no_lang(value);
28: }
29:
1.2 ! paf 30: static void _double(Request& r, const String&, MethodParams *) {
1.1 paf 31: Pool& pool=r.pool();
32: VInt *vunknown=static_cast<VInt *>(r.self);
33: Value& value=*new(pool) VDouble(pool, vunknown->as_double());
34: r.write_no_lang(value);
35: }
36:
37:
38: // initialize
39:
40: void initialize_unknown_class(Pool& pool, VStateless_class& vclass) {
41: // ^unknown.int[]
42: vclass.add_native_method("int", Method::CT_DYNAMIC, _int, 0, 0);
43:
44: // ^unknown.double[]
45: vclass.add_native_method("double", Method::CT_DYNAMIC, _double, 0, 0);
46: }
E-mail: