Boost logo

Boost-Commit :

From: lists.drrngrvy_at_[hidden]
Date: 2008-06-03 17:47:14


Author: drrngrvy
Date: 2008-06-03 17:47:13 EDT (Tue, 03 Jun 2008)
New Revision: 46095
URL: http://svn.boost.org/trac/boost/changeset/46095

Log:
Add path_info struct, for easy manipulation of PATH_INFO.
Added:
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/path_info.hpp (contents, props changed)
Text files modified:
   sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request.hpp | 6 +++---
   1 files changed, 3 insertions(+), 3 deletions(-)

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request.hpp 2008-06-03 17:47:13 EDT (Tue, 03 Jun 2008)
@@ -399,17 +399,17 @@
     // environment.
     // eg.
     // string_type& val = req["some name"];
- env_map& operator[](string_type const& n)
+ string_type& operator[](string_type const& n)
     {
       return env_vars(this->implementation.vars_)[n.c_str()];
     }
 
- env_map& operator[](const char* n)
+ string_type& operator[](const char* n)
     {
       return env_vars(this->implementation.vars_)[n];
     }
 
- env_map& operator[](common::name const& n)
+ string_type& operator[](common::name const& n)
     {
       return env_vars(this->implementation.vars_)[n];
     }

Added: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/path_info.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/path_info.hpp 2008-06-03 17:47:13 EDT (Tue, 03 Jun 2008)
@@ -0,0 +1,42 @@
+
+#ifndef BOOST_CGI_COMMON_PATH_INFO_HPP_INCLUDED_
+#define BOOST_CGI_COMMON_PATH_INFO_HPP_INCLUDED_
+
+#include <boost/algorithm/string/trim.hpp>
+#include <boost/algorithm/string/split.hpp>
+#include <boost/algorithm/string/classification.hpp>
+///////////////////////////////////////////////////////////
+#include "boost/cgi/fwd/basic_request_fwd.hpp"
+
+namespace cgi {
+ namespace common {
+
+ struct path_info
+ {
+ typedef std::string string_type;
+ typedef std::vector<string_type> vector_type;
+ typedef vector_type::iterator iterator;
+
+ template<typename S, typename P, enum role_type R, typename A>
+ path_info(basic_request<S,P,R,A>& request)
+ : info(boost::algorithm::trim_copy_if(request["path_info"],
+ boost::algorithm::is_any_of("/")))
+ {
+ boost::algorithm::split(data, info, boost::algorithm::is_any_of("/"));
+ }
+
+ path_info(string_type const& str)
+ : info(boost::algorithm::trim_copy_if(str, boost::algorithm::is_any_of("/")))
+ {
+ boost::algorithm::split(data, info, boost::algorithm::is_any_of("/"));
+ }
+
+ string_type info;
+ vector_type data;
+ };
+
+ } // namespace common
+} // namespace cgi
+
+#endif // BOOST_CGI_COMMON_PATH_INFO_HPP_INCLUDED_
+


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk