-rw-r--r-- | lib/params.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/params.cc b/lib/params.cc index ea86d3a..7a572c1 100644 --- a/lib/params.cc +++ b/lib/params.cc | |||
@@ -96,12 +96,25 @@ namespace opkele { | |||
96 | rv += '='; | 96 | rv += '='; |
97 | rv += util::url_encode(i->second); | 97 | rv += util::url_encode(i->second); |
98 | } | 98 | } |
99 | return rv; | 99 | return rv; |
100 | } | 100 | } |
101 | 101 | ||
102 | string params_t::query_string(const char *prefix) const { | ||
103 | string rv; | ||
104 | for(const_iterator i=begin();i!=end();++i) { | ||
105 | if(!rv.empty()) | ||
106 | rv += '&'; | ||
107 | rv += prefix; | ||
108 | rv += i->first; | ||
109 | rv += '='; | ||
110 | rv += util::url_encode(i->second); | ||
111 | } | ||
112 | return rv; | ||
113 | } | ||
114 | |||
102 | ostream& operator << (ostream& o,const params_t& p) { | 115 | ostream& operator << (ostream& o,const params_t& p) { |
103 | for(params_t::const_iterator i=p.begin();i!=p.end();++i) | 116 | for(params_t::const_iterator i=p.begin();i!=p.end();++i) |
104 | o << i->first << ':' << i->second << '\n'; | 117 | o << i->first << ':' << i->second << '\n'; |
105 | return o; | 118 | return o; |
106 | } | 119 | } |
107 | 120 | ||