Lines Matching refs:std

49 eat_lead_white(std::string &s)
51 std::string::size_type off = s.find_first_not_of(' ');
52 if (off != std::string::npos) {
53 std::string::iterator begin = s.begin();
59 eat_end_white(std::string &s)
61 std::string::size_type off = s.find_last_not_of(' ');
62 if (off != std::string::npos)
67 eat_white(std::string &s)
73 inline std::string
74 to_lower(const std::string &s)
76 std::string lower;
82 lower.push_back(std::tolower(c));
90 split_first(const std::string &s, std::string &lhs, std::string &rhs, char c);
95 split_last(const std::string &s, std::string &lhs, std::string &rhs, char c);
102 tokenize(std::vector<std::string> &vector, const std::string &s,
112 typename std::enable_if<std::is_integral<T>::value &&
113 std::is_signed<T>::value, T>::type
114 __to_number(const std::string &value)
117 long long r = std::stoll(value, nullptr, 0);
118 if (r < std::numeric_limits<T>::min() || r > std::numeric_limits<T>::max())
119 throw std::out_of_range("Out of range");
124 typename std::enable_if<std::is_integral<T>::value &&
125 !std::is_signed<T>::value, T>::type
126 __to_number(const std::string &value)
129 unsigned long long r = std::stoull(value, nullptr, 0);
130 if (r > std::numeric_limits<T>::max())
131 throw std::out_of_range("Out of range");
136 typename std::enable_if<std::is_enum<T>::value, T>::type
137 __to_number(const std::string &value)
139 auto r = __to_number<typename std::underlying_type<T>::type>(value);
144 typename std::enable_if<std::is_floating_point<T>::value, T>::type
145 __to_number(const std::string &value)
148 long double r = std::stold(value);
149 if (r < std::numeric_limits<T>::min() || r > std::numeric_limits<T>::max())
150 throw std::out_of_range("Out of range");
165 to_number(const std::string &value, T &retval)
170 } catch (const std::out_of_range&) {
172 } catch (const std::invalid_argument&) {
183 to_bool(const std::string &value, bool &retval)
185 std::string s = to_lower(value);
199 inline std::string
200 quote(const std::string &s)
202 std::string ret;
203 bool quote = s.find(' ') != std::string::npos;
231 startswith(const std::string &s, const char *prefix)
241 startswith(const std::string &s, const std::string &prefix)