Changeset 77014


Ignore:
Timestamp:
Feb 14, 2012, 8:16:44 AM (6 years ago)
Author:
trademark
Message:

Prechecksum struct (filtering bad character and convert it to readable digit for the checksum).

Location:
sandbox/SOC/2011/checks/boost/checks
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • sandbox/SOC/2011/checks/boost/checks/amex.hpp

    r76999 r77014  
    1818
    1919#include <cstddef> // std::size_t
    20 
     20#include <boost/checks/prechecksum.hpp>
     21#include <boost/checks/conversion.hpp>
     22#include <boost/checks/filter.hpp>
    2123#include <boost/checks/checkdigit.hpp>
    2224#include <boost/checks/luhn.hpp>
     
    5052bool check_amex (const check_range& check_seq)
    5153{
    52   return boost::checks::check_sequence<luhn_algorithm, digit_filter, AMEX_SIZE>(boost::rbegin(check_seq), boost::rend(check_seq));
     54  return boost::checks::check_sequence<luhn_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>::type, AMEX_SIZE>(boost::rbegin(check_seq), boost::rend(check_seq));
    5355}
    5456
     
    7072std::size_t compute_amex(const check_range& check_seq)
    7173{
    72   return boost::checks::compute_checkdigit<luhn_algorithm, digit_filter, AMEX_SIZE, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
     74  return boost::checks::compute_checkdigit<luhn_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>::type, AMEX_SIZE, basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
    7375}
    7476
  • sandbox/SOC/2011/checks/boost/checks/basic_check_algorithm.hpp

    r76999 r77014  
    2121#include <cstddef> // std::size_t
    2222#include <boost/checks/filter.hpp>
     23#include <boost/checks/conversion.hpp>
     24#include <boost/checks/prechecksum.hpp>
     25#include <boost/range.hpp>
    2326
    2427namespace boost{
    2528  namespace checks{
     29 
     30
     31template <typename Iterator>
     32struct digit_prechecksum
     33{
     34  typedef prechecksum<digit_filter<typename Iterator::value_type>,
     35                      chartodigit<typename Iterator::value_type>,
     36                      Iterator> type;
     37};
     38
     39template <typename Iterator>
     40struct digitx_prechecksum
     41{
     42  typedef prechecksum<digitx_filter<typename Iterator::value_type>,
     43                      chartodigitx<typename Iterator::value_type>,
     44                      Iterator> type;
     45};
    2646
    2747/*! \class basic_check_algorithm
     
    3353struct basic_check_algorithm
    3454{
    35   /*!
    36     \brief translate a value of the sequence into an integer valid value.
    37 
    38     \tparam value is the type of a value in the sequence.
    39     \param current_value is the current value analysed in the sequence that must be translated.
    40     \param valid_value_counter is the number of valid value(s) already counted (the current value is not included).\n This is also the position (beyond the valid values) of the current value analysed (0 <= valid_value_counter < n).
    41 
    42     \throws boost::checks::translation_exception is thrown if the translation of current_value failed.\n This will automatically throw if the value is not a digit (0 <= i < 10).
    43 
    44     \returns the translation of the current value in the range [0..9].
    45 */
    46   template <typename value_type>
    47   static std::size_t convert(const value_type &value)
    48   {
    49     return value - '0';
    50   }
    51 
    5255  /*!
    5356    \brief Validate the checksum.
  • sandbox/SOC/2011/checks/boost/checks/basic_checks.hpp

    r76999 r77014  
    2222#include <boost/iterator/filter_iterator.hpp>
    2323
     24
    2425namespace boost {
    2526  namespace checks{
     27
     28struct no_prechecksum_tag {};
    2629
    2730static const std::size_t bad_sequence = -1;
     
    5154  for(; seq_begin != seq_end && *counter < size_expected; ++seq_begin)
    5255  {
    53     std::size_t value = algorithm::convert(*seq_begin);
    54     checksum = algorithm::process(checksum, value, *counter);
     56    checksum = algorithm::process(checksum, *seq_begin, *counter);
    5557    ++counter;
    5658  }
     
    6567std::size_t compute_checksum(seq_iterator seq_begin, seq_iterator seq_end, counter_type &counter)
    6668{
    67   std::size_t checksum = 0;
     69  std::size_t checksum = 0; 
    6870  for(; seq_begin != seq_end; ++seq_begin)
    6971  {
    70     std::size_t value = algorithm::convert(*seq_begin);
    71     checksum = algorithm::process(checksum, value, *counter);
     72    checksum = algorithm::process(checksum, *seq_begin, *counter);
    7273    ++counter;
    7374  }
     
    8990*/
    9091template <typename algorithm,
    91           typename UnaryPredicate,
     92          typename prechecksum_type,
    9293          typename seq_iterator>
    9394bool check_sequence(seq_iterator seq_begin, seq_iterator seq_end)
    9495{
    9596  boost::checks::detail::simple_counter::type counter = boost::checks::detail::simple_counter()();
    96   typedef boost::filter_iterator<UnaryPredicate, seq_iterator> skip_iterator;
    97   UnaryPredicate predicate;
    98   std::size_t checksum = compute_checksum<algorithm>(skip_iterator(predicate, seq_begin, seq_end),
    99                                                      skip_iterator(predicate, seq_end, seq_end),
     97 
     98  prechecksum_type prechecksum;
     99  std::size_t checksum = compute_checksum<algorithm>(prechecksum(seq_begin, seq_end),
     100                                                     prechecksum(seq_end, seq_end),
    100101                                                     counter);
    101102  return algorithm::validate_checksum(checksum);
     
    117118*/
    118119template <typename algorithm,
    119           typename UnaryPredicate,
     120          typename prechecksum_type,
    120121          std::size_t size_expected,
    121122          typename seq_iterator>
    122123bool check_sequence(seq_iterator seq_begin, seq_iterator seq_end)
    123124{
    124   typedef boost::filter_iterator<UnaryPredicate, seq_iterator> skip_iterator;
    125   UnaryPredicate predicate;
    126125  boost::checks::detail::simple_counter::type counter = boost::checks::detail::simple_counter()();
    127   std::size_t checksum = compute_checksum<algorithm, size_expected>(skip_iterator(predicate, seq_begin, seq_end),
    128                                                                     skip_iterator(predicate, seq_end, seq_end),
     126 
     127  prechecksum_type prechecksum;
     128  std::size_t checksum = compute_checksum<algorithm, size_expected>(prechecksum(seq_begin, seq_end),
     129                                                                    prechecksum(seq_end, seq_end),
    129130                                                                    counter);
    130131  if(checksum != bad_sequence)
     
    147148*/
    148149template <typename algorithm,
    149           typename UnaryPredicate,
     150          typename prechecksum_type,
    150151          typename checkdigit,
    151152          typename seq_iterator>
    152153std::size_t compute_checkdigit(seq_iterator seq_begin, seq_iterator seq_end)
    153154{
    154   typedef boost::filter_iterator<UnaryPredicate, seq_iterator> skip_iterator;
    155   UnaryPredicate predicate;
    156   typedef typename boost::checks::detail::skip_counter<checkdigit::pos, checkdigit::size> counter_type;
    157   typename counter_type::type counter = counter_type()();
    158   std::size_t checksum = compute_checksum<algorithm>(skip_iterator(predicate, seq_begin, seq_end),
    159                                                      skip_iterator(predicate, seq_end, seq_end),
     155  typedef typename boost::checks::detail::skip_counter<checkdigit::pos, checkdigit::size> counter_type;
     156  typename counter_type::type counter = counter_type()();
     157  prechecksum_type prechecksum;
     158  std::size_t checksum = compute_checksum<algorithm>(prechecksum(seq_begin, seq_end),
     159                                                     prechecksum(seq_end, seq_end),
    160160                                                     counter);
    161161  return algorithm::compute_checkdigit(checksum);
     
    177177*/
    178178template <typename algorithm,
    179           typename UnaryPredicate,
     179          typename prechecksum_type,
    180180          std::size_t size_expected,
    181181          typename checkdigit,
     
    183183std::size_t compute_checkdigit(seq_iterator seq_begin, seq_iterator seq_end)
    184184{
    185   typedef boost::filter_iterator<UnaryPredicate, seq_iterator> skip_iterator;
    186   UnaryPredicate predicate;
    187 
    188   typedef typename boost::checks::detail::skip_counter<checkdigit::pos, checkdigit::size> counter_type;
    189   typename counter_type::type counter = counter_type()();
    190   std::size_t checksum = compute_checksum<algorithm, size_expected>(skip_iterator(predicate, seq_begin, seq_end),
    191                                                                     skip_iterator(predicate, seq_end, seq_end),
     185  typedef typename boost::checks::detail::skip_counter<checkdigit::pos, checkdigit::size> counter_type;
     186  typename counter_type::type counter = counter_type()();
     187  prechecksum_type prechecksum;
     188  std::size_t checksum = compute_checksum<algorithm, size_expected>(prechecksum(seq_begin, seq_end),
     189                                                                    prechecksum(seq_end, seq_end),
    192190                                                                    counter);
    193191  if(checksum != size_expected)
     
    213211*/
    214212template <typename algorithm,
    215           typename UnaryPredicate,
     213          typename prechecksum_type,
    216214          typename checkdigit,
    217215          typename seq_iterator>
    218216std::pair<std::size_t, std::size_t> compute_multicheckdigit (seq_iterator seq_begin, seq_iterator seq_end)
    219217{
    220   typedef boost::filter_iterator<UnaryPredicate, seq_iterator> skip_iterator;
    221   UnaryPredicate predicate;
    222 
    223   typedef typename boost::checks::detail::skip_counter<checkdigit::pos, checkdigit::size> counter_type;
    224   typename counter_type::type counter = counter_type()();
    225   std::size_t checksum = compute_checksum<algorithm>(skip_iterator(predicate, seq_begin, seq_end),
    226                                                      skip_iterator(predicate, seq_end, seq_end),
     218  typedef typename boost::checks::detail::skip_counter<checkdigit::pos, checkdigit::size> counter_type;
     219  typename counter_type::type counter = counter_type()();
     220  prechecksum_type prechecksum;
     221  std::size_t checksum = compute_checksum<algorithm>(prechecksum(seq_begin, seq_end),
     222                                                     prechecksum(seq_end, seq_end),
    227223                                                     counter);
    228224  return algorithm::compute_multicheckdigit(checksum);
     
    246242*/
    247243template <typename algorithm,
    248           typename UnaryPredicate,
     244          typename prechecksum_type,
    249245          std::size_t size_expected,
    250246          typename checkdigit,
     
    252248std::pair<std::size_t, std::size_t> compute_multicheckdigit(seq_iterator seq_begin, seq_iterator seq_end)
    253249{
    254   typedef boost::filter_iterator<UnaryPredicate, seq_iterator> skip_iterator;
    255   UnaryPredicate predicate;
    256 
    257   typedef typename boost::checks::detail::skip_counter<checkdigit::pos, checkdigit::size> counter_type;
    258   typename counter_type::type counter = counter_type()();
    259   std::size_t checksum = compute_checksum<algorithm, size_expected>(skip_iterator(predicate, seq_begin, seq_end),
    260                                                                     skip_iterator(predicate, seq_end, seq_end),
     250  typedef typename boost::checks::detail::skip_counter<checkdigit::pos, checkdigit::size> counter_type;
     251  typename counter_type::type counter = counter_type()();
     252  prechecksum_type prechecksum;
     253  std::size_t checksum = compute_checksum<algorithm, size_expected>(prechecksum(seq_begin, seq_end),
     254                                                                    prechecksum(seq_end, seq_end),
    261255                                                                    counter);
    262256  if(checksum != bad_sequence)
  • sandbox/SOC/2011/checks/boost/checks/ean.hpp

    r76999 r77014  
    6262bool check_ean13(const check_range& check_seq)
    6363{
    64   return boost::checks::check_sequence<ean_algorithm, digit_filter, EAN13_SIZE> (boost::rbegin(check_seq), boost::rend(check_seq));
     64  return boost::checks::check_sequence<ean_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>::type, EAN13_SIZE> (boost::rbegin(check_seq), boost::rend(check_seq));
    6565}
    6666
     
    8181std::size_t compute_ean13(const check_range& check_seq)
    8282{
    83   return boost::checks::compute_checkdigit<ean_algorithm, digit_filter, EAN13_SIZE, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
     83  return boost::checks::compute_checkdigit<ean_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>::type, EAN13_SIZE, basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
    8484}
    8585
     
    9999bool check_ean8 (const check_range& check_seq)
    100100{
    101   return boost::checks::check_sequence<ean_algorithm, digit_filter, EAN8_SIZE>(boost::rbegin(check_seq), boost::rend(check_seq));
     101  return boost::checks::check_sequence<ean_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>::type, EAN8_SIZE>(boost::rbegin(check_seq), boost::rend(check_seq));
    102102}
    103103
     
    118118std::size_t compute_ean8(const check_range& check_seq)
    119119{
    120   return boost::checks::compute_checkdigit<ean_algorithm, digit_filter, EAN8_SIZE, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
     120  return boost::checks::compute_checkdigit<ean_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>::type, EAN8_SIZE, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
    121121}
    122122
  • sandbox/SOC/2011/checks/boost/checks/filter.hpp

    r76999 r77014  
    1919#include <cstddef> // std::size_t
    2020#include <cctype>
     21#include <functional>
    2122
    2223namespace boost{
    2324  namespace checks{
    2425
    25 struct digit_filter
     26template <typename value_type>
     27struct digit_filter : public std::unary_function<value_type, bool>
    2628{
    27   template <typename value_type>
    2829  bool operator()(const value_type &value)
    2930  {
     
    3233};
    3334
    34 struct digitx_filter
     35template <typename value_type>
     36struct digitx_filter : public std::unary_function<value_type, bool>
    3537{
    36   template <typename value_type>
    37   bool operator()(const value_type &value)
     38  bool operator()(const value_type &value)
    3839  {
    3940    return std::isdigit(static_cast<int>(value)) || std::tolower(static_cast<int>(value)) == 'x';
  • sandbox/SOC/2011/checks/boost/checks/isbn.hpp

    r76999 r77014  
    5757bool check_isbn13 (const check_range& check_seq)
    5858{
    59   return boost::checks::check_sequence<isbn13_algorithm, digit_filter, EAN13_SIZE>(boost::rbegin(check_seq), boost::rend(check_seq));
     59  return boost::checks::check_sequence<isbn13_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>::type, EAN13_SIZE>(boost::rbegin(check_seq), boost::rend(check_seq));
    6060}
    6161
     
    7676std::size_t compute_isbn13 (const check_range& check_seq)
    7777{
    78   return boost::checks::compute_checkdigit<isbn13_algorithm, digit_filter, EAN13_SIZE, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
     78  return boost::checks::compute_checkdigit<isbn13_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>::type, EAN13_SIZE, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
    7979}
    8080
  • sandbox/SOC/2011/checks/boost/checks/luhn.hpp

    r76999 r77014  
    9191bool check_luhn (const check_range& check_seq)
    9292{
    93   return boost::checks::check_sequence<luhn_algorithm, digit_filter, size_expected>(boost::rbegin(check_seq), boost::rend(check_seq));
     93  return boost::checks::check_sequence<luhn_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>::type, size_expected>(boost::rbegin(check_seq), boost::rend(check_seq));
    9494}
    9595
     
    109109bool check_luhn (const check_range& check_seq)
    110110{
    111   return boost::checks::check_sequence<luhn_algorithm, digit_filter> (boost::rbegin(check_seq), boost::rend(check_seq));
     111  return boost::checks::check_sequence<luhn_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>::type> (boost::rbegin(check_seq), boost::rend(check_seq));
    112112}
    113113
     
    129129std::size_t compute_luhn(const check_range& check_seq)
    130130{
    131   return boost::checks::compute_checkdigit<luhn_algorithm, digit_filter, size_expected, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
     131  return boost::checks::compute_checkdigit<luhn_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>::type, size_expected, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
    132132}
    133133
     
    148148std::size_t compute_luhn (const check_range& check_seq)
    149149{
    150   return boost::checks::compute_checkdigit<luhn_algorithm, digit_filter, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
     150  return boost::checks::compute_checkdigit<luhn_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>::type, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
    151151}
    152152
  • sandbox/SOC/2011/checks/boost/checks/mastercard.hpp

    r76999 r77014  
    4848bool check_mastercard(const check_range& check_seq)
    4949{
    50   return boost::checks::check_sequence<luhn_algorithm, digit_filter, MASTERCARD_SIZE>(boost::rbegin(check_seq), boost::rend(check_seq));
     50  return boost::checks::check_sequence<luhn_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>, MASTERCARD_SIZE>(boost::rbegin(check_seq), boost::rend(check_seq));
    5151}
    5252
     
    6868std::size_t compute_mastercard(const check_range& check_seq)
    6969{
    70   return boost::checks::compute_checkdigit<luhn_algorithm, digit_filter, MASTERCARD_SIZE, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
     70  return boost::checks::compute_checkdigit<luhn_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>, MASTERCARD_SIZE, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
    7171}
    7272
  • sandbox/SOC/2011/checks/boost/checks/modulus11.hpp

    r76999 r77014  
    4040struct modulus11_algorithm : boost::checks::weighted_sum_algorithm<mod11_weight>
    4141{
    42   /*!
    43     \brief translate the current value into an integer valid value.
    44 
    45     \tparam value is the type of a value in the sequence.
    46     \param current_value is the current value analysed in the sequence that must be translated.
    47     \param valid_value_counter is the number of valid value already counted(the current value is not included).\n This is also the position(above the valid values)of the current value analysed(0 <= valid_value_counter < n).
    48 
    49     \throws boost::checks::translation_exception is thrown if the translation of current_value failed.\n The translation will fail if the current value is not a digit(0 <= i < 10), unless it is the rightmost digit, when the value 10 or the 'x' or 'X' character is allowed.
    50 
    51     \returns the translation of the current value in the range [0..10].
    52 */
    53   template <typename value_type>
    54   static std::size_t convert(const value_type &value)
    55   {
    56     if(value == 'x' || value == 'X')
    57       return 10;
    58     return value - '0';
    59   }
    60 
    61 /* pre: value must be valid */
    62   template <typename value_type>
    63   static bool require(const value_type &value, std::size_t value_pos)
    64   {
    65     return value_pos == 0 || (value != 'X' && value != 'x');
    66   }
    67 
    6842  /*!
    6943    \brief Validate a checksum with a simple modulus 11.
     
    12094bool check_modulus11(const check_range& check_seq)
    12195{
    122   return boost::checks::check_sequence<mod11_algorithm, digitx_filter, size_expected>(boost::rbegin(check_seq), boost::rend(check_seq));
     96  return boost::checks::check_sequence<mod11_algorithm, typename digitx_prechecksum<typename boost::range_reverse_iterator<check_range>::type>::type, size_expected>(boost::rbegin(check_seq), boost::rend(check_seq));
    12397}
    12498
     
    138112bool check_modulus11(const check_range& check_seq)
    139113{
    140   return boost::checks::check_sequence<mod11_algorithm, digitx_filter>(boost::rbegin(check_seq), boost::rend(check_seq));
     114  return boost::checks::check_sequence<mod11_algorithm, typename digitx_prechecksum<typename boost::range_reverse_iterator<check_range>::type>::type>(boost::rbegin(check_seq), boost::rend(check_seq));
    141115}
    142116
     
    158132std::size_t compute_modulus11(const check_range& check_seq)
    159133{
    160   return boost::checks::compute_checkdigit<mod11_algorithm, digitx_filter, size_expected, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
     134  return boost::checks::compute_checkdigit<mod11_algorithm, typename digitx_prechecksum<typename boost::range_reverse_iterator<check_range>::type>::type, size_expected, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
    161135}
    162136
     
    177151std::size_t compute_modulus11(const check_range& check_seq)
    178152{
    179   return boost::checks::compute_checkdigit<mod11_algorithm, digitx_filter, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
     153  return boost::checks::compute_checkdigit<mod11_algorithm, typename digitx_prechecksum<typename boost::range_reverse_iterator<check_range>::type>::type, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
    180154}
    181155
  • sandbox/SOC/2011/checks/boost/checks/modulus97.hpp

    r76999 r77014  
    139139bool check_mod97_10 (const check_range& check_seq)
    140140{
    141   return boost::checks::check_sequence<mod97_10_algorithm, digit_filter, size_expected> (boost::rbegin(check_seq), boost::rend(check_seq));
     141  return boost::checks::check_sequence<mod97_10_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>, size_expected> (boost::rbegin(check_seq), boost::rend(check_seq));
    142142}
    143143
     
    157157bool check_mod97_10(const check_range& check_seq)
    158158{
    159   return boost::checks::check_sequence<mod97_10_algorithm, digit_filter>(boost::rbegin(check_seq), boost::rend(check_seq));
     159  return boost::checks::check_sequence<mod97_10_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type> >(boost::rbegin(check_seq), boost::rend(check_seq));
    160160}
    161161
     
    179179std::pair<std::size_t, std::size_t> compute_mod97_10(const check_range& check_seq)
    180180{
    181   return boost::checks::compute_multicheckdigit<mod97_10_algorithm, digit_filter, mod97_10_checkdigit, size_expected>(boost::rbegin(check_seq), boost::rend(check_seq));
     181  return boost::checks::compute_multicheckdigit<mod97_10_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>, mod97_10_checkdigit, size_expected>(boost::rbegin(check_seq), boost::rend(check_seq));
    182182}
    183183
     
    200200std::pair<std::size_t, std::size_t> compute_mod97_10(const check_range& check_seq)
    201201{
    202   return boost::checks::compute_multicheckdigit<mod97_10_algorithm, digit_filter, mod97_10_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
     202  return boost::checks::compute_multicheckdigit<mod97_10_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>, mod97_10_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
    203203}
    204204
  • sandbox/SOC/2011/checks/boost/checks/upc.hpp

    r76999 r77014  
    5858bool check_upca (const check_range& check_seq)
    5959{
    60   return boost::checks::check_sequence<upc_algorithm, digit_filter, UPCA_SIZE>(boost::rbegin(check_seq), boost::rend(check_seq));
     60  return boost::checks::check_sequence<upc_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>, UPCA_SIZE>(boost::rbegin(check_seq), boost::rend(check_seq));
    6161}
    6262
     
    7777std::size_t compute_upca(const check_range& check_seq)
    7878{
    79   return boost::checks::compute_checkdigit<upc_algorithm, digit_filter, UPCA_SIZE, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
     79  return boost::checks::compute_checkdigit<upc_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>, UPCA_SIZE, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
    8080}
    8181
  • sandbox/SOC/2011/checks/boost/checks/verhoeff.hpp

    r76999 r77014  
    127127bool check_verhoeff(const check_range& check_seq)
    128128{
    129   return boost::checks::check_sequence<verhoeff_algorithm, digit_filter, size_expected>(boost::rbegin(check_seq), boost::rend(check_seq));
     129  return boost::checks::check_sequence<verhoeff_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>, size_expected>(boost::rbegin(check_seq), boost::rend(check_seq));
    130130}
    131131
     
    145145bool check_verhoeff(const check_range& check_seq)
    146146{
    147   return boost::checks::check_sequence<verhoeff_algorithm, digit_filter>(boost::rbegin(check_seq), boost::rend(check_seq));
     147  return boost::checks::check_sequence<verhoeff_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type> >(boost::rbegin(check_seq), boost::rend(check_seq));
    148148}
    149149
     
    165165std::size_t compute_verhoeff(const check_range& check_seq)
    166166{
    167   return boost::checks::compute_checkdigit<verhoeff_algorithm, digit_filter, size_expected, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
     167  return boost::checks::compute_checkdigit<verhoeff_algorithm,
     168                                           typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>,
     169                                           size_expected,
     170                                           basic_checkdigit>
     171         (boost::rbegin(check_seq), boost::rend(check_seq));
    168172}
    169173
     
    184188std::size_t compute_verhoeff(const check_range& check_seq)
    185189{
    186   return boost::checks::compute_checkdigit<verhoeff_algorithm, digit_filter, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
     190  return boost::checks::compute_checkdigit<verhoeff_algorithm,
     191                                           typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>,
     192                                           basic_checkdigit>
     193         (boost::rbegin(check_seq), boost::rend(check_seq));
    187194}
    188195
  • sandbox/SOC/2011/checks/boost/checks/visa.hpp

    r76999 r77014  
    4848bool check_visa(const check_range& check_seq)
    4949{
    50   return boost::checks::check_sequence<luhn_algorithm, digit_filter, VISA_SIZE>(boost::rbegin(check_seq), boost::rend(check_seq));
     50  return boost::checks::check_sequence<luhn_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>, VISA_SIZE>(boost::rbegin(check_seq), boost::rend(check_seq));
    5151}
    5252
     
    6868std::size_t compute_visa(const check_range& check_seq)
    6969{
    70   return boost::checks::compute_checkdigit<luhn_algorithm, digit_filter, VISA_SIZE, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
     70  return boost::checks::compute_checkdigit<luhn_algorithm, typename digit_prechecksum<typename boost::range_reverse_iterator<check_range>::type>, VISA_SIZE, boost::checks::basic_checkdigit>(boost::rbegin(check_seq), boost::rend(check_seq));
    7171}
    7272
Note: See TracChangeset for help on using the changeset viewer.