@@ -40,6 +40,7 @@ namespace web { namespace http {
4040// / <param name="ref">The value to bind to.</param>
4141// / <returns><c>true</c> if the binding succeeds, <c>false</c> otherwise.</returns>
4242template <typename key_type, typename _t>
43+ CASABLANCA_DEPRECATED (" This API is deprecated and will be removed in a future release, std::istringstream instead." )
4344bool bind (const key_type &text, _t &ref) // const
4445{
4546 utility::istringstream_t iss (text);
@@ -61,6 +62,7 @@ bool bind(const key_type &text, _t &ref) // const
6162// / <param name="ref">The value to bind to.</param>
6263// / <returns><c>true</c> if the binding succeeds, <c>false</c> otherwise.</returns>
6364template <typename key_type>
65+ CASABLANCA_DEPRECATED (" This API is deprecated and will be removed in a future release." )
6466bool bind (const key_type &text, utility::string_t &ref) // const
6567{
6668 ref = text;
@@ -175,7 +177,7 @@ class http_headers
175177 }
176178
177179 // / <summary>
178- // / Removes all elements from the hearders
180+ // / Removes all elements from the hearers.
179181 // / </summary>
180182 void clear () { m_headers.clear (); }
181183
@@ -227,10 +229,10 @@ class http_headers
227229 // Check to see if doesn't have a value.
228230 if (iter->second .empty ())
229231 {
230- http:: bind (iter->second , value);
232+ bind (iter->second , value);
231233 return true ;
232234 }
233- return http:: bind (iter->second , value);
235+ return bind (iter->second , value);
234236 }
235237 else
236238 {
@@ -239,7 +241,7 @@ class http_headers
239241 }
240242
241243 // / <summary>
242- // / Returns an iterator refering to the first header field.
244+ // / Returns an iterator referring to the first header field.
243245 // / </summary>
244246 // / <returns>An iterator to the beginning of the HTTP headers</returns>
245247 iterator begin () { return m_headers.begin (); }
@@ -248,7 +250,7 @@ class http_headers
248250 // / <summary>
249251 // / Returns an iterator referring to the past-the-end header field.
250252 // / </summary>
251- // / <returns>An iterator to the element past the end of the HTTP headers</returns>
253+ // / <returns>An iterator to the element past the end of the HTTP headers</returns>
252254 iterator end () { return m_headers.end (); }
253255 const_iterator end () const { return m_headers.end (); }
254256
@@ -302,6 +304,27 @@ class http_headers
302304
303305private:
304306
307+ template <typename _t>
308+ bool bind (const key_type &text, _t &ref) const
309+ {
310+ utility::istringstream_t iss (text);
311+ iss.imbue (std::locale::classic ());
312+ iss >> ref;
313+ if (iss.fail () || !iss.eof ())
314+ {
315+ return false ;
316+ }
317+
318+ return true ;
319+ }
320+
321+ template <>
322+ bool bind (const key_type &text, ::utility::string_t &ref) const
323+ {
324+ ref = text;
325+ return true ;
326+ }
327+
305328 // Headers are stored in a map with case insensitive key.
306329 std::map<utility::string_t , utility::string_t , _case_insensitive_cmp> m_headers;
307330};
0 commit comments