Annotation of parser3/src/types/pa_vresponse.h, revision 1.3

1.3     ! paf         1: /** @file
        !             2:        Parser: response class.
        !             3: 
1.1       paf         4:        Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
1.3     ! paf         5: 
1.1       paf         6:        Author: Alexander Petrosyan <paf@design.ru> (http://design.ru/paf)
                      7: 
1.3     ! paf         8:        $Id: pa_vresponse.h,v 1.2 2001/03/18 17:39:30 paf Exp $
1.1       paf         9: */
                     10: 
                     11: #ifndef PA_VRESPONSE_H
                     12: #define PA_VRESPONSE_H
                     13: 
1.3     ! paf        14: #include "pa_vstateless_object.h"
1.1       paf        15: #include "pa_string.h"
                     16: #include "_response.h"
                     17: 
                     18: class Response;
                     19: 
1.3     ! paf        20: /// response class
        !            21: class VResponse : public VStateless_object {
1.1       paf        22: public: // Value
                     23:        
                     24:        // all: for error reporting after fail(), etc
                     25:        const char *type() const { return "response"; }
1.2       paf        26: 
                     27:        // response: ffields
                     28:        Hash *get_hash() { return &ffields; }
1.1       paf        29: 
                     30:        // response: CLASS,BASE,method,fields
                     31:        Value *get_element(const String& name) {
                     32:                // $CLASS,$BASE,$method
1.3     ! paf        33:                if(Value *result=VStateless_object::get_element(name))
1.1       paf        34:                        return result;
                     35:                
                     36:                // $field
                     37:                return static_cast<Value *>(ffields.get(name));
                     38:        }
                     39: 
                     40:        // response: (attribute)=value
                     41:        void put_element(const String& name, Value *value) { 
                     42:                ffields.put(name, value);
                     43:        }
                     44: 
                     45: public: // usage
                     46: 
1.3     ! paf        47:        VResponse(Pool& apool) : VStateless_object(apool, *response_class),
1.1       paf        48:                ffields(apool) {
                     49:        }
                     50:        
                     51:        Hash& fields() { return ffields; }
                     52: 
                     53: private:
                     54: 
                     55:        Hash ffields;
                     56: 
                     57: };
                     58: 
                     59: #endif

E-mail: