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

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.7     ! paf         8: static const char* IDENT_VCLASS_C="$Date: 2002/08/13 13:02:40 $";
        !             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
        !            13: Value *VClass::get_element(const String& aname, Value *aself) {
        !            14:        // $method or other base element
        !            15:        if(Value *result=VStateless_class::get_element(aname, aself))
        !            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
        !            30:        } catch(Exception) { /* ignore "can not store to stateless_class errors */ }
        !            31: 
        !            32:        if(replace)
        !            33:                return ffields.put_replace(aname, avalue);
        !            34:        else {
        !            35:                ffields.put(aname, avalue);
        !            36:                return false;
        !            37:        }
        !            38: }
        !            39: 
        !            40: /// @returns object of this class
        !            41: /*override*/ Value *VClass::create_new_value(Pool& ) { 
        !            42:        return NEW VObject(pool(), *this);
1.1       paf        43: }

E-mail: