Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r83176 - in sandbox/SOC/2011/checks: boost/checks libs/checks/doc
From: pierre.talbot.6114_at_[hidden]
Date: 2013-02-27 02:50:53


Author: trademark
Date: 2013-02-27 02:50:52 EST (Wed, 27 Feb 2013)
New Revision: 83176
URL: http://svn.boost.org/trac/boost/changeset/83176

Log:
Correction of the documentation (size section).
Add a file for the traversal policies.
Add documentation for the traversal policies.

Added:
   sandbox/SOC/2011/checks/boost/checks/traversal.hpp (contents, props changed)
Text files modified:
   sandbox/SOC/2011/checks/boost/checks/checksum.hpp | 71 ----------------------------------------
   sandbox/SOC/2011/checks/boost/checks/size_check.hpp | 2
   sandbox/SOC/2011/checks/libs/checks/doc/checks.qbk | 14 +++++--
   sandbox/SOC/2011/checks/libs/checks/doc/reference.qbk | 50 +++++++++++++++++++++++++--
   4 files changed, 56 insertions(+), 81 deletions(-)

Modified: sandbox/SOC/2011/checks/boost/checks/checksum.hpp
==============================================================================
--- sandbox/SOC/2011/checks/boost/checks/checksum.hpp (original)
+++ sandbox/SOC/2011/checks/boost/checks/checksum.hpp 2013-02-27 02:50:52 EST (Wed, 27 Feb 2013)
@@ -16,82 +16,11 @@
     #pragma once
 #endif
 
-#include <boost/range/rbegin.hpp>
-#include <boost/range/rend.hpp>
-#include <boost/range/iterator_range.hpp>
 #include <boost/checks/checkdigit.hpp>
 
 namespace boost {
   namespace checks{
 
-
-struct reverse_traversal
-{
- template <typename Range>
- struct iterator
- {
- typedef typename boost::range_reverse_iterator<Range>::type type;
- };
-
- template <typename Range>
- static typename iterator<Range>::type begin(Range &x)
- {
- return boost::rbegin(x);
- }
-
- template <typename Range>
- static typename iterator<Range>::type end(Range &x)
- {
- return boost::rend(x);
- }
-};
-
-struct forward_traversal
-{
- template <typename Range>
- struct iterator
- {
- typedef typename boost::range_iterator<Range>::type type;
- };
-
- template <typename Range>
- static typename iterator<Range>::type begin(Range &x)
- {
- return boost::begin(x);
- }
-
- template <typename Range>
- static typename iterator<Range>::type end(Range &x)
- {
- return boost::end(x);
- }
-};
-
-struct no_size_policy
-{
- static bool check(size_t pos)
- {
- return true;
- }
- static bool overflow(size_t pos)
- {
- return false;
- }
-};
-
-template <size_t size_expected>
-struct enforce_size_policy
-{
- static bool check(size_t pos)
- {
- return pos < size_expected;
- }
- static bool overflow(size_t pos)
- {
- return pos != size_expected;
- }
-};
-
 template
 <
   typename TernaryFunction,

Modified: sandbox/SOC/2011/checks/boost/checks/size_check.hpp
==============================================================================
--- sandbox/SOC/2011/checks/boost/checks/size_check.hpp (original)
+++ sandbox/SOC/2011/checks/boost/checks/size_check.hpp 2013-02-27 02:50:52 EST (Wed, 27 Feb 2013)
@@ -1,5 +1,5 @@
 // Boost checks/size_check.hpp header file
-// (C) Copyright Pierre Talbot 2012
+// (C) Copyright Pierre Talbot 2013
 // Distributed under the Boost Software License, Version 1.0. (See
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt

Added: sandbox/SOC/2011/checks/boost/checks/traversal.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2011/checks/boost/checks/traversal.hpp 2013-02-27 02:50:52 EST (Wed, 27 Feb 2013)
@@ -0,0 +1,67 @@
+// Boost checks/size_check.hpp header file
+// (C) Copyright Pierre Talbot 2013
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#ifndef BOOST_CHECK_TRAVERSAL_HPP
+#define BOOST_CHECK_TRAVERSAL_HPP
+
+#ifdef _MSC_VER
+ #pragma once
+#endif
+
+#include <boost/range/rbegin.hpp>
+#include <boost/range/rend.hpp>
+#include <boost/range/iterator_range.hpp>
+
+namespace boost {
+ namespace checks{
+
+struct reverse_traversal
+{
+ template <typename Range>
+ struct iterator
+ {
+ typedef typename boost::range_reverse_iterator<Range>::type type;
+ };
+
+ template <typename Range>
+ static typename iterator<Range>::type begin(Range &x)
+ {
+ return boost::rbegin(x);
+ }
+
+ template <typename Range>
+ static typename iterator<Range>::type end(Range &x)
+ {
+ return boost::rend(x);
+ }
+};
+
+struct forward_traversal
+{
+ template <typename Range>
+ struct iterator
+ {
+ typedef typename boost::range_iterator<Range>::type type;
+ };
+
+ template <typename Range>
+ static typename iterator<Range>::type begin(Range &x)
+ {
+ return boost::begin(x);
+ }
+
+ template <typename Range>
+ static typename iterator<Range>::type end(Range &x)
+ {
+ return boost::end(x);
+ }
+};
+
+} // namespace checks
+} // namespace boost
+
+#endif // BOOST_CHECK_TRAVERSAL_HPP

Modified: sandbox/SOC/2011/checks/libs/checks/doc/checks.qbk
==============================================================================
--- sandbox/SOC/2011/checks/libs/checks/doc/checks.qbk (original)
+++ sandbox/SOC/2011/checks/libs/checks/doc/checks.qbk 2013-02-27 02:50:52 EST (Wed, 27 Feb 2013)
@@ -68,13 +68,17 @@
 [def __CHECKDIGITX_ENCODER__ [link checks.checks.reference.checkdigit.checkdigitx_encoder checkdigitx_encoder]]
 [def __CHECKDIGIT_REF__ [link checks.checks.reference.checkdigit.checkdigitref checkdigit]]
 
-[def __SIZE_CHECKING__ [link checks.checks.reference.size_checking size_checking]]
-[def __NO_SIZE_CHECKING__ [link checks.checks.reference.no_size_checking no_size_checking]]
-[def __SIZE_FAILURE_ERROR_CODE_POLICY__ [link checks.checks.reference.size_failure_error_code_policy size_failure_error_code_policy]]
-[def __SIZE_FAILURE_EXCEPTION_POLICY__ [link checks.checks.reference.size_failure_exception_policy size_failure_exception_policy]]
-[def __SIZE_FAILURE_EXCEPTION__ [link checks.checks.reference.size_failure_exception size_failure_exception]]
+[def __SIZE_CHECKING__ [link checks.checks.reference.size_ref.size_checking size_checking]]
+[def __NO_SIZE_CHECKING__ [link checks.checks.reference.size_ref.no_size_checking no_size_checking]]
+[def __SIZE_FAILURE_ERROR_CODE_POLICY__ [link checks.checks.reference.size_ref.size_failure_error_code_policy size_failure_error_code_policy]]
+[def __SIZE_FAILURE_EXCEPTION_POLICY__ [link checks.checks.reference.size_ref.size_failure_exception_policy size_failure_exception_policy]]
+[def __SIZE_FAILURE_EXCEPTION__ [link checks.checks.reference.size_ref.size_failure_exception size_failure_exception]]
+
+[def __CHECKSUM_REF__ [link checks.checks.reference.checksum_ref checksum]]
 
 [def __TRAVERSAL_TYPE__ [link checks.checks.reference.traversal_type Traversal type]]
+[def __FORWARD_TRAVERSAL__ [link checks.checks.reference.traversal_type.forward_traversal forward_traversal]]
+[def __REVERSE_TRAVERSAL__ [link checks.checks.reference.traversal_type.reverse_traversal reverse_traversal]]
 
 [def __overview [link checks.checks.preface Preface]]
 

Modified: sandbox/SOC/2011/checks/libs/checks/doc/reference.qbk
==============================================================================
--- sandbox/SOC/2011/checks/libs/checks/doc/reference.qbk (original)
+++ sandbox/SOC/2011/checks/libs/checks/doc/reference.qbk 2013-02-27 02:50:52 EST (Wed, 27 Feb 2013)
@@ -380,6 +380,7 @@
 
 [endsect][/section:checkdigit Check digit]
 
+[section:size_ref Size]
 [section:no_size_checking no_size_checking]
 [h3 Synopsis]
 ``
@@ -410,7 +411,7 @@
 ``
 [h3 Description]
 
-This tag can be used in the `checksum` structure if you want to restrict the size of the sequence.
+This structure can be used in the `checksum` structure if you want to restrict the size of the sequence.
 If the size is not respected then the failure policy is called.
 
 [h3 Header]
@@ -446,7 +447,7 @@
 ``
 
 [h3 See also]
-__SIZE_CHECKING__, __SIZE_FAILURE_CODE_ERROR_POLICY__, __CHECKSUM_REF__.
+__SIZE_CHECKING__, __SIZE_FAILURE_ERROR_CODE_POLICY__, __CHECKSUM_REF__.
 
 [endsect][/section:size_failure_error_code_policy size_failure_error_code_policy]
 
@@ -501,11 +502,52 @@
 [h3 See also]
 __SIZE_FAILURE_EXCEPTION_POLICY__.
 [endsect][/section:size_failure_exception size_failure_exception]
+[endsect][/section:size_ref Size]
 
 [section:traversal_type Traversal type]
-[endsect][/section:traversal_type Traversal type]
 
-[section:traversal_type Traversal type]
+[section:forward_traversal forward_traversal]
+[h3 Synopsis]
+``
+struct forward_traversal
+{
+ /* unspecified */
+};
+``
+[h3 Description]
+
+This policy tell the check algorithm to go though the sequence from start to end (typically from left to right).
+
+[h3 Header]
+``
+#include <boost/checks/traversal.hpp>
+``
+
+[h3 See also]
+__REVERSE_TRAVERSAL__, __CHECKSUM_REF__.
+[endsect][/section:forward_traversal forward_traversal]
+
+[section:reverse_traversal reverse_traversal]
+[h3 Synopsis]
+``
+struct reverse_traversal
+{
+ /* unspecified */
+};
+``
+[h3 Description]
+
+This policy tell the check algorithm to go though the sequence from end to start (typically from right to left).
+
+[h3 Header]
+``
+#include <boost/checks/traversal.hpp>
+``
+
+[h3 See also]
+__FORWARD_TRAVERSAL__, __CHECKSUM_REF__.
+[endsect][/section:reverse_traversal reverse_traversal]
+
 [endsect][/section:traversal_type Traversal type]
 
 [section:type_adaptor Type adaptor]


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