Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73903 - sandbox/SOC/2011/checks/boost/checks
From: pierre.talbot.6114_at_[hidden]
Date: 2011-08-18 18:20:06


Author: trademark
Date: 2011-08-18 18:20:06 EDT (Thu, 18 Aug 2011)
New Revision: 73903
URL: http://svn.boost.org/trac/boost/changeset/73903

Log:
Add documentation.
Text files modified:
   sandbox/SOC/2011/checks/boost/checks/limits.hpp | 55 ++++++++++++++++++++++++++++++++++-----
   1 files changed, 48 insertions(+), 7 deletions(-)

Modified: sandbox/SOC/2011/checks/boost/checks/limits.hpp
==============================================================================
--- sandbox/SOC/2011/checks/boost/checks/limits.hpp (original)
+++ sandbox/SOC/2011/checks/boost/checks/limits.hpp 2011-08-18 18:20:06 EDT (Thu, 18 Aug 2011)
@@ -5,6 +5,10 @@
 // http://www.boost.org/LICENSE_1_0.txt
 // See http://www.boost.org for updates, documentation, and revision history.
 
+/*! \file limits.hpp
+ \brief Provides two types of size contract to manage the expected size of the check sequence.
+*/
+
 #ifndef BOOST_CHECK_LIMITS_HPP
 #define BOOST_CHECK_LIMITS_HPP
 
@@ -13,31 +17,68 @@
 namespace boost{
   namespace checks{
 
+/*! \class strict_size_contract
+ \brief This is a contract class used to verify that a sequence have the expected size.
+
+ \tparam expected_size The expected size of the sequence. (expected_size > 0, enforced with static assert).
+ \tparam exception_size_failure If the size is not respected a exception_size_failure exception will be throwed. Default exception class is std::invalid_argument.
+*/
 template <size_t expected_size, class exception_size_failure = std::invalid_argument>
 struct strict_size_contract
 {
- static void respect_size_contract(size_t valid_values_counted)
+ /*! \fn static void respect_size_contract(const size_t valid_value_counter)
+ \brief Enforce the size contract.
+
+ \param valid_value_counter Number of valid values in the sequence.
+ \throws exception_size_failure If the terms of the contract are not respected. (valid_value_counter != expected_size).
+ */
+ static void respect_size_contract(const size_t valid_value_counter)
   {
     BOOST_STATIC_ASSERT_MSG( expected_size > 0 , "The expected size must be greater than 0" );
- if( valid_values_counted != expected_size )
+ if( valid_value_counter != expected_size )
       throw exception_size_failure("Too few or too much valid values in the sequence.") ;
   }
- static bool reach_one_past_the_end(size_t valid_values_counted)
+
+ /*! \fn static bool reach_one_past_the_end(const size_t valid_value_counter)
+ \brief Tells if the expected interval of value [0..n) is outstripped.
+
+ \param valid_value_counter Number of valid values in the sequence already counted.
+ \returns True if valid_value_counter is one past the end of the expected size, false otherwise.
+ */
+ static bool reach_one_past_the_end(const size_t valid_value_counter)
   {
- return valid_values_counted > expected_size ;
+ BOOST_STATIC_ASSERT_MSG( expected_size > 0 , "The expected size must be greater than 0" );
+ return valid_value_counter > expected_size ;
   }
 };
 
+/*! \class no_null_size_contract
+ \brief This is a contract class used to verify that a sequence have not a size of zero.
+
+ \tparam exception_size_failure If the size is null a exception_size_failure exception will be throwed. Default exception class is std::invalid_argument.
+*/
 template <class exception_size_failure = std::invalid_argument>
 struct no_null_size_contract
 {
- static void respect_size_contract(size_t valid_values_counted)
+/*! \fn static void respect_size_contract(const size_t valid_value_counter)
+ \brief Enforce the size contract.
+
+ \param valid_value_counter Number of valid values in the sequence.
+ \throws exception_size_failure If the terms of the contract are not respected. (valid_value_counter == 0).
+ */
+ static void respect_size_contract(const size_t valid_value_counter)
   {
- if( valid_values_counted == 0 )
+ if( valid_value_counter == 0 )
       throw exception_size_failure("No valid value in this sequence.") ;
   }
 
- static bool reach_one_past_the_end(size_t valid_values_counted)
+/*! \fn static bool reach_one_past_the_end(const size_t valid_value_counter)
+ \brief Tells if the expected interval of value [0..n) is outstripped.
+
+ \param valid_value_counter Number of valid values in the sequence already counted.
+ \returns False.
+ */
+ static bool reach_one_past_the_end(const size_t valid_value_counter)
   {
     return false ;
   }


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