Annotation of parser3/src/types/pa_vclass.C, revision 1.16
1.7 paf 1: /** @file
2: Parser: @b class parser class impl.
1.1 paf 3:
1.16 ! paf 4: Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com)
1.7 paf 5: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.1 paf 6: */
7:
1.16 ! paf 8: static const char* IDENT_VCLASS_C="$Date: 2002/10/31 15:01:54 $";
1.7 paf 9:
1.1 paf 10: #include "pa_vclass.h"
11:
1.12 paf 12: /*override*/ Value *VClass::as(const char *atype, bool looking_up) {
13: if(Value *result=Value::as(atype, looking_up))
14: return result;
1.11 paf 15: else
1.12 paf 16: return fbase?fbase->as(atype, looking_up):0;
1.11 paf 17: }
18:
1.14 paf 19: /// VClass: $CLASS, (field)=STATIC value;(method)=method_ref with self=object_class
1.15 paf 20: Value *VClass::get_element(const String& aname, Value& aself, bool looking_up) {
1.13 paf 21: // simple things first: $field=static field
22: if(Value *result=static_cast<Value *>(ffields.get(aname)))
23: return result;
24:
1.14 paf 25: // $CLASS, $method, or other base element
1.11 paf 26: if(Value *result=VStateless_class::get_element(aname, aself, looking_up))
1.7 paf 27: return result;
28:
29: return 0;
30: }
31:
32: /// VClass: (field)=value - static values only
33: /*override*/ bool VClass::put_element(const String& aname, Value *avalue, bool replace) {
34: try {
35: if(fbase && fbase->put_element(aname, avalue, true))
36: return true; // replaced in base
1.10 paf 37: } catch(Exception) { /* allow override parent variables, useful for form descendants */ }
1.7 paf 38:
39: if(replace)
40: return ffields.put_replace(aname, avalue);
41: else {
42: ffields.put(aname, avalue);
43: return false;
44: }
45: }
46:
47: /// @returns object of this class
48: /*override*/ Value *VClass::create_new_value(Pool& ) {
49: return NEW VObject(pool(), *this);
1.1 paf 50: }
E-mail: