Annotation of parser3/src/types/pa_vclass.C, revision 1.11
1.7 paf 1: /** @file
2: Parser: @b class parser class impl.
1.1 paf 3:
1.7 paf 4: Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com)
5: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.1 paf 6: */
7:
1.11 ! paf 8: static const char* IDENT_VCLASS_C="$Date: 2002/08/13 16:27:53 $";
1.7 paf 9:
1.1 paf 10: #include "pa_vclass.h"
11:
1.11 ! paf 12: /*override*/ bool VClass::is(const char *atype, bool looking_up) const {
! 13: if(Value::is(atype, looking_up))
! 14: return true;
! 15: else
! 16: return fbase?fbase->is(atype, looking_up):false;
! 17: }
! 18:
1.7 paf 19: /// VClass: (field)=STATIC value;(method)=method_ref with self=object_class
1.11 ! paf 20: Value *VClass::get_element(const String& aname, Value *aself, bool looking_up) {
1.7 paf 21: // $method or other base element
1.11 ! paf 22: if(Value *result=VStateless_class::get_element(aname, aself, looking_up))
1.7 paf 23: return result;
24:
25: // $field=static field
26: if(Value *result=static_cast<Value *>(ffields.get(aname)))
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: