LCOV - code coverage report
Current view: top level - usr/include/boost/format - exceptions.hpp (source / functions) Hit Total Coverage
Test: ROSE Lines: 0 22 0.0 %
Date: 2022-12-08 13:48:47 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // ----------------------------------------------------------------------------
       2             : // boost/format/exceptions.hpp 
       3             : // ----------------------------------------------------------------------------
       4             : 
       5             : //  Copyright Samuel Krempp 2003.
       6             : //
       7             : // Distributed under the Boost Software License, Version 1.0.
       8             : //    (See accompanying file LICENSE_1_0.txt or copy at
       9             : //          http://www.boost.org/LICENSE_1_0.txt)
      10             : //
      11             : //
      12             : //  See http://www.boost.org/libs/format/ for library home page
      13             : 
      14             : // ----------------------------------------------------------------------------
      15             : 
      16             : #ifndef BOOST_FORMAT_EXCEPTIONS_HPP
      17             : #define BOOST_FORMAT_EXCEPTIONS_HPP
      18             : 
      19             : 
      20             : #include <stdexcept>
      21             : 
      22             : 
      23             : namespace boost {
      24             : 
      25             :     namespace io {
      26             : 
      27             : // **** exceptions -----------------------------------------------
      28             : 
      29           0 :         class format_error : public std::exception
      30             :         {
      31             :         public:
      32           0 :             format_error()  {}
      33           0 :             virtual const char *what() const throw() {
      34           0 :                 return "boost::format_error: "
      35           0 :                     "format generic failure";
      36             :             }
      37             :         };
      38             : 
      39           0 :         class bad_format_string : public format_error
      40             :         {
      41             :             std::size_t pos_, next_;
      42             :         public:
      43           0 :             bad_format_string(std::size_t pos, std::size_t size) 
      44           0 :                 : pos_(pos), next_(size) {}
      45             :             std::size_t get_pos() const { return pos_; }
      46             :             std::size_t get_next() const { return next_; }
      47           0 :             virtual const char *what() const throw() {
      48           0 :                 return "boost::bad_format_string: format-string is ill-formed";
      49             :             }
      50             :         };
      51             : 
      52           0 :         class too_few_args : public format_error
      53             :         {
      54             :             std::size_t cur_, expected_;
      55             :         public:
      56           0 :             too_few_args(std::size_t cur, std::size_t expected) 
      57           0 :                 : cur_(cur), expected_(expected) {}
      58             :             std::size_t get_cur() const { return cur_; }
      59             :             std::size_t get_expected() const { return expected_; }
      60           0 :             virtual const char *what() const throw() {
      61           0 :                 return "boost::too_few_args: "
      62           0 :                     "format-string referred to more arguments than were passed";
      63             :             }
      64             :         };
      65             : 
      66           0 :         class too_many_args : public format_error
      67             :         {
      68             :             std::size_t cur_, expected_;
      69             :         public:
      70           0 :             too_many_args(std::size_t cur, std::size_t expected) 
      71           0 :                 : cur_(cur), expected_(expected) {}
      72             :             std::size_t get_cur() const { return cur_; }
      73             :             std::size_t get_expected() const { return expected_; }
      74           0 :             virtual const char *what() const throw() {
      75           0 :                 return "boost::too_many_args: "
      76           0 :                     "format-string referred to fewer arguments than were passed";
      77             :             }
      78             :         };
      79             : 
      80             : 
      81             :         class  out_of_range : public format_error
      82             :         {
      83             :             int index_, beg_, end_;    // range is [ beg, end [
      84             :         public:
      85             :             out_of_range(int index, int beg, int end) 
      86             :                 : index_(index), beg_(beg), end_(end) {}
      87             :             int get_index() const { return index_; }
      88             :             int get_beg() const { return beg_; }
      89             :             int get_end() const { return end_; }
      90             :             virtual const char *what() const throw() {
      91             :                 return "boost::out_of_range: "
      92             :                     "tried to refer to an argument (or item) number which"
      93             :                     " is out of range, according to the format string";
      94             :             }
      95             :         };
      96             : 
      97             : 
      98             :     } // namespace io
      99             : 
     100             : } // namespace boost
     101             : 
     102             : 
     103             : #endif // BOOST_FORMAT_EXCEPTIONS_HPP

Generated by: LCOV version 1.14