Annotation of parser3/src/types/pa_vresponse.C, revision 1.1
1.1 ! paf 1: /** @file
! 2: Parser: @b response class.
! 3:
! 4: Copyright(c) 2001 ArtLebedev Group(http://www.artlebedev.com)
! 5: Author: Alexander Petrosyan <paf@design.ru>(http://paf.design.ru)
! 6:
! 7: $Id: pa_vrequest.C,v 1.12 2001/12/14 12:53:48 paf Exp $
! 8: */
! 9:
! 10: #include "pa_vresponse.h"
! 11: #include "pa_charsets.h"
! 12: #include "pa_charset.h"
! 13: #include "pa_vstring.h"
! 14:
! 15: Value *VResponse::get_element(const String& name) {
! 16: // $charset
! 17: if(name==CHARSET_NAME)
! 18: return NEW VString(pool().get_client_charset().name());
! 19: else {
! 20: // $method
! 21: if(Value *result=VStateless_object::get_element(name))
! 22: return result;
! 23:
! 24: // $field
! 25: return static_cast<Value *>(ffields.get(name));
! 26: }
! 27: }
! 28:
! 29: void VResponse::put_element(const String& name, Value *value) {
! 30: // guard charset change
! 31: if(name==CHARSET_NAME) {
! 32: const String& charset_name=value->as_string();
! 33: if(Charset *charset=(Charset *)charsets->get(charset_name))
! 34: pool().set_client_charset(*charset);
! 35: else
! 36: throw Exception(0, 0,
! 37: &charset_name,
! 38: "unknown charset");
! 39: } else
! 40: ffields.put(name, value);
! 41: }
! 42:
E-mail: