Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59403 - in sandbox/SOC/2007/cgi/trunk/boost/cgi: . utility
From: lists.drrngrvy_at_[hidden]
Date: 2010-01-31 19:51:34


Author: drrngrvy
Date: 2010-01-31 19:51:33 EST (Sun, 31 Jan 2010)
New Revision: 59403
URL: http://svn.boost.org/trac/boost/changeset/59403

Log:
Updates to utilities (data_map_proxy class obsoletes get_value and has_key).
Removed:
   sandbox/SOC/2007/cgi/trunk/boost/cgi/utility/get.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/utility/get_value.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/utility/has_key.hpp
Text files modified:
   sandbox/SOC/2007/cgi/trunk/boost/cgi/utility.hpp | 3 +--
   1 files changed, 1 insertions(+), 2 deletions(-)

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/utility.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/utility.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/utility.hpp 2010-01-31 19:51:33 EST (Sun, 31 Jan 2010)
@@ -10,8 +10,7 @@
 #define CGI_UTILITY_HPP_INCLUDED__
 
 // #include all utility headers.
-#include "boost/cgi/utility/has_key.hpp"
-#include "boost/cgi/utility/get.hpp"
 #include "boost/cgi/utility/redirect.hpp"
+#include "boost/cgi/utility/stencil.hpp"
 
 #endif // CGI_UTILITY_HPP_INCLUDED__

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/utility/get.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/utility/get.hpp 2010-01-31 19:51:33 EST (Sun, 31 Jan 2010)
+++ (empty file)
@@ -1,31 +0,0 @@
-
-#ifndef BOOST_CGI_GET_HPP_INCLUDED_
-#define BOOST_CGI_GET_HPP_INCLUDED_
-
-#include "boost/cgi/detail/push_options.hpp"
-
-#include <map>
-///////////////////////////////////////////////////////////
-#include "boost/cgi/common/name.hpp"
-#include "boost/cgi/utility/has_key.hpp"
-
-BOOST_CGI_NAMESPACE_BEGIN
- namespace common {
-
- /// Get a value from the map, or return the passed value as a default.
- /**
- * Examples:
- */
- template<typename MapT>
- std::string
- get_value(MapT& data, typename MapT::key_type const& key
- , typename MapT::mapped_type const& default_value)
- {
- return has_key(data, key) ? data[key] : default_value;
- }
-
- } // namespace common
-BOOST_CGI_NAMESPACE_END
-
-#endif // BOOST_CGI_GET_HPP_INCLUDED_
-

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/utility/get_value.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/utility/get_value.hpp 2010-01-31 19:51:33 EST (Sun, 31 Jan 2010)
+++ (empty file)
@@ -1,51 +0,0 @@
-
-#ifndef BOOST_CGI_REDIRECT_HPP_INCLUDED_
-#define BOOST_CGI_REDIRECT_HPP_INCLUDED_
-
-#include "boost/cgi/detail/push_options.hpp"
-
-#include <string>
-///////////////////////////////////////////////////////////
-#include <boost/system/error_code.hpp>
-///////////////////////////////////////////////////////////
-#include "boost/cgi/import/write.hpp"
-#include "boost/cgi/common/header.hpp"
-#include "boost/cgi/detail/throw_error.hpp"
-
-BOOST_CGI_NAMESPACE_BEGIN
- namespace common {
-
- /// Redirect a request to another place.
- /**
- * Note that without also outputting a content-type header, this will be a
- * 'soft' redirect and the location won't be updated. If you want to do a
- * 'hard' redirect, pass a 'Content-type: text/plain' header along with
- * two CRLFs to complete the headers.
- */
- template <typename RequestT>
- basic_header<typename RequestT::char_type>
- redirect(RequestT& req, typename RequestT::string_type const& dest
- , bool secure, boost::system::error_code& ec)
- {
- std::string url(secure ? "https" : "http");
- url += "://" + req.server_name() + "/" + dest;
- basic_header<typename RequestT::char_type> hdr("Location", url);
- return hdr;
- }
-
- template <typename RequestT>
- basic_header<typename RequestT::char_type>
- redirect(RequestT& req, typename RequestT::string_type const& dest, bool secure = false)
- {
- boost::system::error_code ec;
- basic_header<typename RequestT::char_type>
- hdr(redirect(req, dest, secure, ec));
- detail::throw_error(ec);
- return hdr;
- }
-
- } // namespace common
-BOOST_CGI_NAMESPACE_END
-
-#endif // BOOST_CGI_REDIRECT_HPP_INCLUDED_
-

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/utility/has_key.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/utility/has_key.hpp 2010-01-31 19:51:33 EST (Sun, 31 Jan 2010)
+++ (empty file)
@@ -1,61 +0,0 @@
-
-#ifndef BOOST_CGI_HAS_KEY_HPP_INCLUDED_
-#define BOOST_CGI_HAS_KEY_HPP_INCLUDED_
-
-#include "boost/cgi/detail/push_options.hpp"
-
-#include <map>
-///////////////////////////////////////////////////////////
-#include "boost/cgi/common/name.hpp"
-
-BOOST_CGI_NAMESPACE_BEGIN
- namespace common {
-
- /// Check if the given map has an entry `name`.
- /**
- * Examples:
- *
- * Take a map who's keys are case insensitive:
- *
- * std::map<common::name,std::string> icase_map;
- * icase_map["key1"] = "value1";
- * icase_map["key2"] = "value2";
- * has_key(icase_map, "key1"); // true
- * has_key(icase_map, "KEY1"); // true
- * has_key(icase_map, "key2"); // true
- * has_key(icase_map, "key3"); // false
- *
- * CGI data is also held in maps with case-insensitive keys.
- * If you sent a request that looked something like, which made its way to
- * your CGI app (probably after being received by your HTTP server):
- *
- * GET some_cgi_script?foo=bar HTTP/1.1
- *
- * If you wrote `some_cgi_script` and initialised a request, `req`, then:
- *
- * has_key(req[env], "script_name") // true
- * has_key(req[env], "SCRIPT_NAME") // true
- * has_key(req[get], "blah") // false
- * has_key(req[form], "foo") // true
- *
- * Note that the last line above would also be matched by a POST request,
- * with the same data `foo=bar`.
- */
- template<typename MapT>
- bool has_key(MapT& data, typename MapT::key_type const& key)
- {
- if (!data.empty())
- for(typename MapT::const_iterator iter = data.begin(), end = data.end();
- iter != end; ++iter)
- {
- if (iter->first == key)
- return true;
- }
- return false;
- }
-
- } // namespace common
-BOOST_CGI_NAMESPACE_END
-
-#endif // BOOST_CGI_HAS_KEY_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