Annotation of parser3/src/types/pa_vclass.C, revision 1.16.2.3

1.7       paf         1: /**    @file
                      2:        Parser: @b class parser class impl.
1.1       paf         3: 
1.16.2.2  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.2.3! paf         8: static const char* IDENT_VCLASS_C="$Date: 2003/01/31 12:34:42 $";
1.7       paf         9: 
1.1       paf        10: #include "pa_vclass.h"
                     11: 
1.16.2.3! paf        12: ValuePtr VClass::as(const char* atype, bool looking_up) {
        !            13:        if(ValuePtr result=Value::as(atype, looking_up))
1.12      paf        14:                return result;
1.11      paf        15:        else
1.16.2.3! paf        16:                return fbase?fbase->as(atype, looking_up):ValuePtr(0);
1.11      paf        17: }
                     18: 
1.14      paf        19: /// VClass: $CLASS, (field)=STATIC value;(method)=method_ref with self=object_class
1.16.2.3! paf        20: ValuePtr VClass::get_element(StringPtr aname, Value& aself, bool looking_up) {
1.13      paf        21:        // simple things first: $field=static field
1.16.2.3! paf        22:        if(ValuePtr result=ffields.get(aname))
1.13      paf        23:                return result;
                     24: 
1.14      paf        25:        // $CLASS, $method, or other base element
1.16.2.3! paf        26:        if(ValuePtr 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
1.16.2.3! paf        33: bool VClass::put_element(StringPtr aname, ValuePtr avalue, bool replace) {
1.7       paf        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
1.16.2.1  paf        48: ValuePtr VClass::create_new_value() { 
                     49:        return ValuePtr(new VObject(*this));
1.1       paf        50: }

E-mail: