File: convertors.yo

package info (click to toggle)
c%2B%2B-annotations 13.02.02-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,576 kB
  • sloc: cpp: 25,297; makefile: 1,523; ansic: 165; sh: 126; perl: 90; fortran: 27
file content (100 lines) | stat: -rw-r--r-- 5,409 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
Several string conversion functions are available operating on or producing
tt(std::string) objects. These functions are listed below in alphabetic
order. They are not member functions, but class-less (free) functions declared
in the tt(std) namespace. The tthi(string) header file must be included
before they can be used.

    itemization(
    ithtq(stof)(float stof(std::string const &str, size_t *pos = 0))
       (Initial whitespace characters in tt(str) are ignored. Then the
        following sequences of characters are converted to a tt(float) value,
        which is returned:
       itemization(
        it() A decimal floating point constant:
            itemization(
           it() An optional + or - character
           it() A series of decimal digits, possibly containing one decimal
                point character
           it() An optional e or E character, followed by an optional - or +
            character, followed by a series  of decimal digits
            )
        it() A hexadecimal floating point constant:
           itemization(
           it() An optional + or - character
            it() 0x or 0X
            it() A series of hexadecimal digits, possibly containing one
                decimal point character
           it() An optional p or P character, followed by an optional - or +
            character, followed by a series  of decimal digits
            )
        it() An infinity expression:
           itemization(
           it() An optional + or - character
            it() The words tt(inf) or tt(infinity) (case insensitive words)
            )
        it() A `not a number' expression:
           itemization(
           it() An optional + or - character
            it() The words tt(nan) or tt(nan(alphanumeric character sequence))
                (tt(nan) is a case insensitive word), resulting in a tt(NaN)
                floating point value
            )
        )
        If tt(pos != 0) the index of the first character in tt(str) which was
        not converted is returned in tt(*pos).  A tt(std::invalid_argument)
        exception is thrown if the characters in tt(str) could not be
        converted to a tt(float), a tt(std::out_of_range) exception is thrown
        if the converted value would have exceeded the range of tt(float)
        values.)
    ithtq(stod)(double stod(std::string const &str, size_t *pos = 0)) 
       (A conversion as described with tt(stof) is performed, but now to a
        value of type tt(double).)
    ithtq(stold)(double stold(std::string const &str, size_t *pos = 0)) 
       (A conversion as described with tt(stof) is performed, but now to a
        value of type tt(long double).)
    ithtq(stoi)(int stoi(std::string const &str, size_t *pos = 0,
                                                    int base = 10)) 
       (Initial whitespace characters in tt(str) are ignored. Then all
        characters representing numeric constants of the number system whose
        tt(base) is specified are converted to an tt(int) value, which is
        returned. An optional + or - character may prefix the numeric
        characters. Values starting with 0 are automatically interpreted as
        octal values, values starting with 0x or 0X as hexadecimal
        characters. The value tt(base) must be between 2 and 36. If tt(pos !=
        0) the index of the first character in tt(str) which was not converted
        is returned in tt(*pos). A tt(std::invalid_argument) exception is
        thrown if the characters in tt(str) could not be converted to an
        tt(int), a tt(std::out_of_range) exception is thrown if the converted
        value would have exceeded the range of tt(int) values.

        Here is an example of its use:
        verb(int value = stoi(" -123"s);  // assigns value -123
value = stoi(" 123"s, 0, 5); // assigns value 38)

)
    ithtq(stol)(long stol(std::string const &str, size_t *pos = 0, 
                                                    int base = 10)) 
       (A conversion as described with tt(stoi) is performed, but now to a
        value of type tt(long).)
    ithtq(stoll)(long long stoll(std::string const &str, size_t *pos = 0, 
                                                    int base = 10)) 
       (A conversion as described with tt(stoi) is performed, but now to a
        value of type tt(long long).)
    ithtq(stoul)(unsigned long stoul(std::string const &str, size_t *pos = 0, 
                                                    int base = 10)) 
       (A conversion as described with tt(stoi) is performed, but now to a
        value of type tt(unsigned long).)
    ithtq(stoull)(unsigned long long stoull(std::string const &str, 
                                            size_t *pos = 0, int base = 10)) 
       (A conversion as described with tt(stoul) is performed, but now to a
        value of type tt(unsigned long long).)
    ithtq(to_string)(std::string to_string(Type value))
       (Type can be of the types tt(int, long, long long, unsigned, unsigned
        long, unsigned long long, float, double,) or tt(long double). The
        value of the argument is converted to a textual representation, which
        is returned as a tt(std::string) value.
       )
    ithtq(to_wstring)(std::wstring to_wstring(Type value))
       (The conversion as described at tt(to_string) is performed, returning
        a ti(std::wstring).)
    )