Struct strtol

| Home | Libraries | People | FAQ | More

## Struct strtol

boost::cnv::strtol — std::strtol-based extended converter

## Synopsis

    // In header: <boost/convert/strtol.hpp>

    struct strtol : public boost::cnv::cnvbase< boost::cnv::strtol > {
      // types
      typedef boost::cnv::strtol               this_type;
      typedef boost::cnv::cnvbase< this_type > base_type;

      // private member functions
      template<typename string_type>
        void str_to(cnv::range< string_type >, optional< int_type > &) const;
      template<typename string_type>
        void str_to(cnv::range< string_type >, optional< sint_type > &) const;
      template<typename string_type>
        void str_to(cnv::range< string_type >, optional< lint_type > &) const;
      template<typename string_type>
        void str_to(cnv::range< string_type >, optional< llint_type > &) const;
      template<typename string_type>
        void str_to(cnv::range< string_type >, optional< uint_type > &) const;
      template<typename string_type>
        void str_to(cnv::range< string_type >, optional< usint_type > &) const;
      template<typename string_type>
        void str_to(cnv::range< string_type >, optional< ulint_type > &) const;
      template<typename string_type>
        void str_to(cnv::range< string_type >, optional< ullint_type > &) const;
      template<typename string_type>
        void str_to(cnv::range< string_type >, optional< flt_type > &) const;
      template<typename string_type>
        void str_to(cnv::range< string_type >, optional< dbl_type > &) const;
      template<typename string_type>
        void str_to(cnv::range< string_type >, optional< ldbl_type > &) const;
      template<typename char_type>
        cnv::range< char_type * > to_str(int_type, char_type *) const;
      template<typename char_type>
        cnv::range< char_type * > to_str(uint_type, char_type *) const;
      template<typename char_type>
        cnv::range< char_type * > to_str(lint_type, char_type *) const;
      template<typename char_type>
        cnv::range< char_type * > to_str(ulint_type, char_type *) const;
      template<typename char_type>
        cnv::range< char_type * > to_str(llint_type, char_type *) const;
      template<typename char_type>
        cnv::range< char_type * > to_str(ullint_type, char_type *) const;
      template<typename char_type>
        cnv::range< char_type * > to_str(dbl_type, char_type *) const;
      template<typename char_type, typename in_type>
        cnv::range< char_type * > i_to_str(in_type, char_type *) const;
      template<typename string_type, typename out_type>
        void str_to_i(cnv::range< string_type >, optional< out_type > &) const;
      template<typename string_type, typename out_type>
        void str_to_d(cnv::range< string_type >, optional< out_type > &) const;

      // private static functions
      static double adjust_fraction(double, int);
      static int get_char(int);

      // public member functions
      template<typename char_type, typename Type>
        boost::cnv::range< char_type * > i_to_str(Type, char_type *) const;
      template<typename char_type>
        boost::cnv::range< char_type * > to_str(double, char_type *) const;
      template<typename string_type, typename out_type>
        void str_to_i(cnv::range< string_type >, boost::optional< out_type > &) const;
    };

## Description

The converter offers a fairly decent overall performance and moderate formatting facilities.

### `strtol` private member functions

1.     template<typename string_type>
         void str_to(cnv::range< string_type > v, optional< int_type > & r) const;

2.     template<typename string_type>
         void str_to(cnv::range< string_type > v, optional< sint_type > & r) const;

3.     template<typename string_type>
         void str_to(cnv::range< string_type > v, optional< lint_type > & r) const;

4.     template<typename string_type>
         void str_to(cnv::range< string_type > v, optional< llint_type > & r) const;

5.     template<typename string_type>
         void str_to(cnv::range< string_type > v, optional< uint_type > & r) const;

6.     template<typename string_type>
         void str_to(cnv::range< string_type > v, optional< usint_type > & r) const;

7.     template<typename string_type>
         void str_to(cnv::range< string_type > v, optional< ulint_type > & r) const;

8.     template<typename string_type>
         void str_to(cnv::range< string_type > v, optional< ullint_type > & r) const;

9.     template<typename string_type>
         void str_to(cnv::range< string_type > v, optional< flt_type > & r) const;

10.     template<typename string_type>
          void str_to(cnv::range< string_type > v, optional< dbl_type > & r) const;

11.     template<typename string_type>
          void str_to(cnv::range< string_type > v, optional< ldbl_type > & r) const;

12.     template<typename char_type>
          cnv::range< char_type * > to_str(int_type v, char_type * buf) const;

13.     template<typename char_type>
          cnv::range< char_type * > to_str(uint_type v, char_type * buf) const;

14.     template<typename char_type>
          cnv::range< char_type * > to_str(lint_type v, char_type * buf) const;

15.     template<typename char_type>
          cnv::range< char_type * > to_str(ulint_type v, char_type * buf) const;

16.     template<typename char_type>
          cnv::range< char_type * > to_str(llint_type v, char_type * buf) const;

17.     template<typename char_type>
          cnv::range< char_type * > to_str(ullint_type v, char_type * buf) const;

18.     template<typename char_type>
          cnv::range< char_type * > to_str(dbl_type v, char_type * buf) const;

19.     template<typename char_type, typename in_type>
          cnv::range< char_type * > i_to_str(in_type, char_type *) const;

20.     template<typename string_type, typename out_type>
          void str_to_i(cnv::range< string_type >, optional< out_type > &) const;

21.     template<typename string_type, typename out_type>
          void str_to_d(cnv::range< string_type >, optional< out_type > &) const;

### `strtol` private static functions

1.     static double adjust_fraction(double, int);

2.     static int get_char(int v);

### `strtol` public member functions

1.     template<typename char_type, typename Type>
         boost::cnv::range< char_type * >
         i_to_str(Type in_value, char_type * buf) const;

2.     template<typename char_type>
         boost::cnv::range< char_type * > to_str(double value, char_type * buf) const;

3.     template<typename string_type, typename out_type>
         void str_to_i(cnv::range< string_type > range,
                       boost::optional< out_type > & result_out) const;