-rw-r--r-- | lib/fields.cc | 2 | ||||
-rw-r--r-- | lib/message.cc | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/fields.cc b/lib/fields.cc index d494098..91fbc41 100644 --- a/lib/fields.cc +++ b/lib/fields.cc @@ -1,37 +1,39 @@ #include <opkele/types.h> #include <opkele/exception.h> #include <opkele/util.h> +#include <algorithm> namespace opkele { + using std::for_each; using std::unary_function; struct __om_copier : public unary_function<const string&,void> { public: const basic_fields& from; basic_fields& to; __om_copier(basic_fields& t,const basic_fields& f) : from(f), to(t) { } result_type operator()(argument_type f) { to.set_field(f,from.get_field(f)); } }; basic_fields::basic_fields(const basic_fields& x) { x.copy_to(*this); } void basic_fields::copy_to(basic_fields& x) const { x.reset_fields(); for_each(fields_begin(),fields_end(), __om_copier(x,*this) ); } void basic_fields::append_to(basic_fields& x) const { for_each(fields_begin(),fields_end(), __om_copier(x,*this) ); } struct __om_query_builder : public unary_function<const string&,void> { public: const basic_fields& om; bool first; string& rv; diff --git a/lib/message.cc b/lib/message.cc index b2324b7..524946a 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -1,33 +1,35 @@ #include <cassert> +#include <algorithm> + #include <opkele/types.h> #include <opkele/exception.h> #include <opkele/util.h> #include <opkele/debug.h> #include "config.h" namespace opkele { using std::input_iterator_tag; using std::unary_function; 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) { } result_type operator()(argument_type f) { return (!strncmp(f.c_str(),"ns.",sizeof("ns.")-1)) && om.get_field(f)==uri ; } }; bool basic_openid_message::has_ns(const string& uri) const { fields_iterator ei = fields_end(); fields_iterator i = find_if(fields_begin(),fields_end(), __om_ns_finder(*this,uri)); return !(i==ei); |