|
| Function_split_part () |
|
const mup::char_type * | GetDesc () const final |
|
mup::IToken * | Clone () const final |
|
void | Eval (mup::ptr_val_type &ret, const mup::ptr_val_type *args, int argc) final |
|
Definition at line 150 of file ExpressionParser.cpp.
import_export::anonymous_namespace{ExpressionParser.cpp}::Function_split_part::Function_split_part |
( |
| ) |
|
|
inline |
mup::IToken* import_export::anonymous_namespace{ExpressionParser.cpp}::Function_split_part::Clone |
( |
| ) |
const |
|
inlinefinal |
void import_export::anonymous_namespace{ExpressionParser.cpp}::Function_split_part::Eval |
( |
mup::ptr_val_type & |
ret, |
|
|
const mup::ptr_val_type * |
args, |
|
|
int |
argc |
|
) |
| |
|
inlinefinal |
Definition at line 157 of file ExpressionParser.cpp.
References run_benchmark_import::args, CHECK_EQ, import_export::anonymous_namespace{ExpressionParser.cpp}::ms_to_ss(), anonymous_namespace{Utm.h}::n, import_export::anonymous_namespace{ExpressionParser.cpp}::ss_to_ms(), THROW_INVALID_PARAMETER, and VALIDATE_ARG_TYPE.
164 auto n =
args[2]->GetInteger();
166 std::vector<std::string> tokens;
168 size_t start{0u}, end{0u};
169 while (end != std::string::npos) {
170 end = text.find(delimiter, start);
171 tokens.push_back(text.substr(start, end - start));
172 start = end + delimiter.length();
174 if (tokens.size() == 0u) {
175 throw std::runtime_error(
"failed to split");
180 index =
static_cast<int>(tokens.size()) +
n;
185 if (index < 0 || index >= static_cast<int>(tokens.size())) {
186 throw std::runtime_error(
"bad token index");
189 }
catch (std::runtime_error& e) {
std::string ms_to_ss(const mup::string_type &s)
#define VALIDATE_ARG_TYPE(arg, t2)
mup::string_type ss_to_ms(const std::string &s)
#define THROW_INVALID_PARAMETER(arg, what)
const mup::char_type* import_export::anonymous_namespace{ExpressionParser.cpp}::Function_split_part::GetDesc |
( |
| ) |
const |
|
inlinefinal |
Definition at line 153 of file ExpressionParser.cpp.
154 return _T(
"split a string by a given separator, then return the nth token");
The documentation for this class was generated from the following file: