author | Michael Krelin <hacker@klever.net> | 2008-03-03 14:58:09 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2008-03-03 14:58:09 (UTC) |
commit | 0182b9dee269f1a8f3fc0794bfdf4a143fa1b5be (patch) (side-by-side diff) | |
tree | 0e435d48a9d2b94ff309c8fea2d416e0e14d8b2a /lib/openid_message.cc | |
parent | 5fd5ecad8c2bd1e8846c11fa9b281f0f4ab8a4a7 (diff) | |
download | libopkele-0182b9dee269f1a8f3fc0794bfdf4a143fa1b5be.zip libopkele-0182b9dee269f1a8f3fc0794bfdf4a143fa1b5be.tar.gz libopkele-0182b9dee269f1a8f3fc0794bfdf4a143fa1b5be.tar.bz2 |
added append_to() to basic_openid_message
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | lib/openid_message.cc | 9 |
1 files changed, 6 insertions, 3 deletions
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 @@ -7,36 +7,39 @@ #include "config.h" namespace opkele { using std::input_iterator_tag; using std::unary_function; struct __om_copier : public unary_function<const string&,void> { public: const basic_openid_message& from; 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)); } }; basic_openid_message::basic_openid_message(const basic_openid_message& x) { 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) ); } struct __om_ns_finder : public unary_function<const string&,bool> { public: const basic_openid_message& om; const string& uri; __om_ns_finder(const basic_openid_message& m, const string& u) : om(m), uri(u) { } |