From 0182b9dee269f1a8f3fc0794bfdf4a143fa1b5be Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Mon, 03 Mar 2008 14:58:09 +0000 Subject: added append_to() to basic_openid_message Signed-off-by: Michael Krelin --- diff --git a/include/opkele/types.h b/include/opkele/types.h index af7fb1a..ffb9afb 100644 --- a/include/opkele/types.h +++ b/include/opkele/types.h @@ -129,6 +129,7 @@ namespace opkele { virtual ~basic_openid_message() { } basic_openid_message(const basic_openid_message& x); void copy_to(basic_openid_message& x) const; + void append_to(basic_openid_message& x) const; virtual bool has_field(const string& n) const = 0; virtual const string& get_field(const string& n) const = 0; diff --git a/lib/openid_message.cc b/lib/openid_message.cc index 4b9179b..e244f43 100644 --- a/lib/openid_message.cc +++ b/lib/openid_message.cc @@ -16,9 +16,7 @@ namespace opkele { basic_openid_message& to; __om_copier(basic_openid_message& t,const basic_openid_message& f) - : from(f), to(t) { - to.reset_fields(); - } + : from(f), to(t) { } result_type operator()(argument_type f) { to.set_field(f,from.get_field(f)); } @@ -28,6 +26,11 @@ namespace opkele { x.copy_to(*this); } void basic_openid_message::copy_to(basic_openid_message& x) const { + x.reset_fields(); + for_each(fields_begin(),fields_end(), + __om_copier(x,*this) ); + } + void basic_openid_message::append_to(basic_openid_message& x) const { for_each(fields_begin(),fields_end(), __om_copier(x,*this) ); } -- cgit v0.9.0.2