Annotation of parser3/src/types/pa_vclass.C, revision 1.9
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.9 ! paf 8: static const char* IDENT_VCLASS_C="$Date: 2002/08/13 15:55:43 $";
1.7 paf 9:
1.1 paf 10: #include "pa_vclass.h"
11:
1.7 paf 12: /// VClass: (field)=STATIC value;(method)=method_ref with self=object_class
1.8 paf 13: Value *VClass::get_element(const String& aname, Value *aself, bool looking_down) {
1.7 paf 14: // $method or other base element
1.8 paf 15: if(Value *result=VStateless_class::get_element(aname, aself, looking_down))
1.7 paf 16: return result;
17:
18: // $field=static field
19: if(Value *result=static_cast<Value *>(ffields.get(aname)))
20: return result;
21:
22: return 0;
23: }
24:
25: /// VClass: (field)=value - static values only
26: /*override*/ bool VClass::put_element(const String& aname, Value *avalue, bool replace) {
27: try {
28: if(fbase && fbase->put_element(aname, avalue, true))
29: return true; // replaced in base
1.9 ! paf 30: } catch(Exception) {
! 31: /* ignore "can not store to table&co errors for nonexistent elements */
! 32: bool error;
! 33: try {
! 34: error=get_element(aname, this, false)!=0;
! 35: } catch(Exception) {
! 36: error=false;
! 37: }
! 38: if(error)
! 39: /*re*/throw;
! 40: }
1.7 paf 41:
42: if(replace)
43: return ffields.put_replace(aname, avalue);
44: else {
45: ffields.put(aname, avalue);
46: return false;
47: }
48: }
49:
50: /// @returns object of this class
51: /*override*/ Value *VClass::create_new_value(Pool& ) {
52: return NEW VObject(pool(), *this);
1.1 paf 53: }
E-mail: