ProteoWizard
Namespaces | Functions
boost Namespace Reference

Namespaces

namespace  date_time
 

Functions

void assertion_failed (char const *expr, char const *function, char const *file, long line)
 
void assertion_failed_msg (char const *expr, char const *msg, char const *function, char const *file, long line)
 
template<typename toType >
toType lexical_cast (const std::string &str, bool &success)
 
template<>
float lexical_cast (const std::string &str, bool &success)
 
template<>
double lexical_cast (const std::string &str, bool &success)
 
template<>
int lexical_cast (const std::string &str, bool &success)
 
template<>
long lexical_cast (const std::string &str, bool &success)
 
template<>
unsigned int lexical_cast (const std::string &str, bool &success)
 
template<>
unsigned long lexical_cast (const std::string &str, bool &success)
 
template<>
long long lexical_cast (const std::string &str, bool &success)
 
template<>
unsigned long long lexical_cast (const std::string &str, bool &success)
 
template<>
bool lexical_cast (const std::string &str)
 
template<>
boost::logic::tribool lexical_cast (const std::string &str)
 

Function Documentation

◆ assertion_failed()

void boost::assertion_failed ( char const *  expr,
char const *  function,
char const *  file,
long  line 
)
inline

Definition at line 114 of file Exception.hpp.

115 {
116 std::ostringstream oss;
117 oss << "[" << file << ":" << line << "] Assertion failed: " << expr;
118 throw std::runtime_error(oss.str());
119 }

◆ assertion_failed_msg()

void boost::assertion_failed_msg ( char const *  expr,
char const *  msg,
char const *  function,
char const *  file,
long  line 
)
inline

Definition at line 121 of file Exception.hpp.

122 {
123 std::ostringstream oss;
124 oss << "[" << file << ":" << line << "] Assertion failed: " << expr << " (" << msg << ")";
125 throw std::runtime_error(oss.str());
126 }

◆ lexical_cast() [1/11]

template<typename toType >
toType boost::lexical_cast ( const std::string &  str,
bool &  success 
)
inline

Definition at line 70 of file optimized_lexical_cast.hpp.

71 {
72 // error: new overload needed below
73 throw std::logic_error("BUG: new overload needed");
74 }

References lexical_cast().

Referenced by lexical_cast(), and lexical_cast().

◆ lexical_cast() [2/11]

template<>
float boost::lexical_cast ( const std::string &  str,
bool &  success 
)
inline

Definition at line 77 of file optimized_lexical_cast.hpp.

78 {
79 errno = 0;
80 success = true;
81 const char* stringToConvert = str.c_str();
82 const char* endOfConversion = stringToConvert;
83 float value = (float) STRTOD( stringToConvert, const_cast<char**>(&endOfConversion) );
84 if( value == 0.0f && stringToConvert == endOfConversion ) // error: conversion could not be performed
85 success = false;
86 return value;
87 }
#define STRTOD(x, y)

References lexical_cast(), and STRTOD.

◆ lexical_cast() [3/11]

template<>
double boost::lexical_cast ( const std::string &  str,
bool &  success 
)
inline

Definition at line 92 of file optimized_lexical_cast.hpp.

93 {
94 errno = 0;
95 success = true;
96 const char* stringToConvert = str.c_str();
97 const char* endOfConversion = stringToConvert;
98 double value = STRTOD( stringToConvert, const_cast<char**>(&endOfConversion) );
99 if( value == 0.0 && stringToConvert == endOfConversion ) // error: conversion could not be performed
100 success = false;
101 return value;
102 }

References lexical_cast(), and STRTOD.

◆ lexical_cast() [4/11]

template<>
int boost::lexical_cast ( const std::string &  str,
bool &  success 
)
inline

Definition at line 107 of file optimized_lexical_cast.hpp.

108 {
109 errno = 0;
110 success = true;
111 const char* stringToConvert = str.c_str();
112 const char* endOfConversion = stringToConvert;
113 int value = (int) strtol( stringToConvert, const_cast<char**>(&endOfConversion), 0 );
114 if( ( value == 0 && stringToConvert == endOfConversion ) || // error: conversion could not be performed
115 errno != 0 ) // error: overflow or underflow
116 success = false;
117 return value;
118 }

References lexical_cast().

◆ lexical_cast() [5/11]

template<>
long boost::lexical_cast ( const std::string &  str,
bool &  success 
)
inline

Definition at line 123 of file optimized_lexical_cast.hpp.

124 {
125 errno = 0;
126 success = true;
127 const char* stringToConvert = str.c_str();
128 const char* endOfConversion = stringToConvert;
129 long value = strtol( stringToConvert, const_cast<char**>(&endOfConversion), 0 );
130 if( ( value == 0l && stringToConvert == endOfConversion ) || // error: conversion could not be performed
131 errno != 0 ) // error: overflow or underflow
132 success = false;
133 return value;
134 }

References lexical_cast().

◆ lexical_cast() [6/11]

template<>
unsigned int boost::lexical_cast ( const std::string &  str,
bool &  success 
)
inline

Definition at line 139 of file optimized_lexical_cast.hpp.

140 {
141 errno = 0;
142 success = true;
143 const char* stringToConvert = str.c_str();
144 const char* endOfConversion = stringToConvert;
145 unsigned int value = (unsigned int) strtoul( stringToConvert, const_cast<char**>(&endOfConversion), 0 );
146 if( ( value == 0u && stringToConvert == endOfConversion ) || // error: conversion could not be performed
147 errno != 0 ) // error: overflow or underflow
148 success = false;
149 return value;
150 }

References lexical_cast().

◆ lexical_cast() [7/11]

template<>
unsigned long boost::lexical_cast ( const std::string &  str,
bool &  success 
)
inline

Definition at line 155 of file optimized_lexical_cast.hpp.

156 {
157 errno = 0;
158 success = true;
159 const char* stringToConvert = str.c_str();
160 const char* endOfConversion = stringToConvert;
161 unsigned long value = strtoul( stringToConvert, const_cast<char**>(&endOfConversion), 0 );
162 if( ( value == 0ul && stringToConvert == endOfConversion ) || // error: conversion could not be performed
163 errno != 0 ) // error: overflow or underflow
164 success = false;
165 return value;
166 }

References lexical_cast().

◆ lexical_cast() [8/11]

template<>
long long boost::lexical_cast ( const std::string &  str,
bool &  success 
)
inline

Definition at line 171 of file optimized_lexical_cast.hpp.

172 {
173 errno = 0;
174 success = true;
175 const char* stringToConvert = str.c_str();
176 const char* endOfConversion = stringToConvert;
177 long long value = strtoll( stringToConvert, const_cast<char**>(&endOfConversion), 0 );
178 if ((value == 0ll && stringToConvert == endOfConversion) || // error: conversion could not be performed
179 errno != 0 ) // error: overflow or underflow
180 success = false;
181 return value;
182 }

References lexical_cast().

◆ lexical_cast() [9/11]

template<>
unsigned long long boost::lexical_cast ( const std::string &  str,
bool &  success 
)
inline

Definition at line 187 of file optimized_lexical_cast.hpp.

188 {
189 errno = 0;
190 success = true;
191 const char* stringToConvert = str.c_str();
192 const char* endOfConversion = stringToConvert;
193 unsigned long long value = strtoull( stringToConvert, const_cast<char**>(&endOfConversion), 0 );
194 if( ( value == 0ull && stringToConvert == endOfConversion ) || // error: conversion could not be performed
195 errno != 0 ) // error: overflow or underflow
196 success = false;
197 return value;
198 }

References lexical_cast().

◆ lexical_cast() [10/11]

template<>
bool boost::lexical_cast ( const std::string &  str)
inline

Definition at line 203 of file optimized_lexical_cast.hpp.

204 {
205 if (str == "0" || str == "false")
206 return false;
207 return true;
208 }

References lexical_cast().

◆ lexical_cast() [11/11]

template<>
boost::logic::tribool boost::lexical_cast ( const std::string &  str)
inline

Definition at line 211 of file optimized_lexical_cast.hpp.

212 {
213 using namespace boost::logic;
214 if (str.empty())
215 return tribool(indeterminate);
216 if (str == "0" || str == "false")
217 return false;
218 return true;
219 }

References lexical_cast().