Annotation of parser3/src/types/pa_vresponse.h, revision 1.8.4.1
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.8.4.1 ! paf 8: $Id: pa_vresponse.h,v 1.8 2001/04/10 10:32:15 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"
1.8.4.1 ! paf 17:
! 18: extern Methoded *response_class;
1.1 paf 19:
20: class Response;
21:
1.5 paf 22: /// value of type 'response'
1.3 paf 23: class VResponse : public VStateless_object {
1.1 paf 24: public: // Value
25:
1.5 paf 26: /// all: for error reporting after fail(), etc
1.1 paf 27: const char *type() const { return "response"; }
1.2 paf 28:
1.5 paf 29: /// Response: ffields
1.2 paf 30: Hash *get_hash() { return &ffields; }
1.1 paf 31:
1.8 paf 32: /// Response: method,fields
1.1 paf 33: Value *get_element(const String& name) {
1.8 paf 34: // $method
1.3 paf 35: if(Value *result=VStateless_object::get_element(name))
1.1 paf 36: return result;
37:
38: // $field
39: return static_cast<Value *>(ffields.get(name));
40: }
41:
1.5 paf 42: /// Response: (attribute)=value
1.1 paf 43: void put_element(const String& name, Value *value) {
44: ffields.put(name, value);
45: }
1.4 paf 46:
47: protected: // VAliased
48:
1.6 paf 49: /// disable .CLASS element. @see VAliased::get_element
1.7 paf 50: bool hide_class() { return true; }
1.1 paf 51:
52: public: // usage
53:
1.3 paf 54: VResponse(Pool& apool) : VStateless_object(apool, *response_class),
1.1 paf 55: ffields(apool) {
56: }
57:
58: Hash& fields() { return ffields; }
59:
60: private:
61:
62: Hash ffields;
63:
64: };
65:
66: #endif
E-mail: