3 #ifndef DATATOOLS_UTILS_H 4 #define DATATOOLS_UTILS_H 134 double abs_eps_ = 0.0,
double rel_eps_ = 0.0);
156 bool is_quoted(
const std::string & text_,
char q_ =
'"');
159 void add_quotes(
const std::string & from_, std::string & to_,
char q_ =
'"');
162 void add_quotes(std::string & text_,
char q_ =
'"');
165 void remove_quotes(
const std::string & from_, std::string & to_,
char q_ =
'"');
177 std::string & install_path_key_,
178 std::string & environ_path_key_);
183 std::string
fetch_path(
const std::string & path_str_);
186 bool fetch_path(std::string & word_, std::string & errmsg_);
247 const std::string & parent_path_);
260 const std::string & parent_path_);
285 std::string
expand_path(
const std::string& path_str_);
295 const std::string& separators_,
296 std::list<std::string>& words_);
303 template<
typename Integral>
306 DT_THROW_IF(pos_ < 0 || pos_ >= (
int)
sizeof(Integral) * 8,
308 "Invalid bit position [pos = " << pos_ <<
"]");
309 number_ |= 1 << pos_;
316 template<
typename Integral>
319 DT_THROW_IF(pos_ < 0 || pos_ >= (
int)
sizeof(Integral) * 8,
321 "Invalid bit position [pos = " << pos_ <<
"]");
322 number_ &= ~(1 << pos_);
330 template<
typename Integral>
333 DT_THROW_IF(pos_ < 0 || pos_ >= (
int)
sizeof(Integral) * 8,
335 "Invalid bit position [pos = " << pos_ <<
"]");
336 number_ ^= 1 << pos_;
344 template<
typename Integral>
347 DT_THROW_IF(pos_ < 0 || pos_ >= (
int)
sizeof(Integral) * 8,
349 "Invalid bit position [pos = " << pos_ <<
"]");
351 if (number_ & (1 << pos_))
return false;
357 #endif // DATATOOLS_UTILS_H
Utility macros for exception handling.
#define DT_THROW_IF(Condition, ExceptionType, Message)
Definition: exception.h:76