OmniSciDB  cde582ebc3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
import_export::anonymous_namespace{ExpressionParser.cpp}::Function_regex_match Class Reference
+ Inheritance diagram for import_export::anonymous_namespace{ExpressionParser.cpp}::Function_regex_match:
+ Collaboration diagram for import_export::anonymous_namespace{ExpressionParser.cpp}::Function_regex_match:

Public Member Functions

 Function_regex_match ()
 
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
 

Detailed Description

Definition at line 123 of file ExpressionParser.cpp.

Constructor & Destructor Documentation

import_export::anonymous_namespace{ExpressionParser.cpp}::Function_regex_match::Function_regex_match ( )
inline

Definition at line 125 of file ExpressionParser.cpp.

125 : mup::ICallback(mup::cmFUNC, _T("regex_match"), 2) {}

Member Function Documentation

mup::IToken* import_export::anonymous_namespace{ExpressionParser.cpp}::Function_regex_match::Clone ( ) const
inlinefinal
void import_export::anonymous_namespace{ExpressionParser.cpp}::Function_regex_match::Eval ( mup::ptr_val_type &  ret,
const mup::ptr_val_type *  args,
int  argc 
)
inlinefinal

Definition at line 130 of file ExpressionParser.cpp.

References run_benchmark_import::args, CHECK_EQ, import_export::anonymous_namespace{ExpressionParser.cpp}::ms_to_ss(), import_export::anonymous_namespace{ExpressionParser.cpp}::ss_to_ms(), THROW_INVALID_PARAMETER, and VALIDATE_ARG_TYPE.

130  {
131  CHECK_EQ(argc, 2);
132  VALIDATE_ARG_TYPE(0, 's');
133  VALIDATE_ARG_TYPE(1, 's');
134  auto const text = ms_to_ss(args[0]->GetString());
135  auto const pattern = ms_to_ss(args[1]->GetString());
136  try {
137  std::regex regex(pattern, std::regex_constants::extended);
138  std::smatch match;
139  std::regex_match(text, match, regex);
140  if (match.size() != 2u) {
141  throw std::runtime_error("must have exactly one match");
142  }
143  *ret = ss_to_ms(match[1]);
144  } catch (std::runtime_error& e) {
145  THROW_INVALID_PARAMETER(2, e.what());
146  }
147  }
#define CHECK_EQ(x, y)
Definition: Logger.h:230
#define VALIDATE_ARG_TYPE(arg, t2)
#define THROW_INVALID_PARAMETER(arg, what)

+ Here is the call graph for this function:

const mup::char_type* import_export::anonymous_namespace{ExpressionParser.cpp}::Function_regex_match::GetDesc ( ) const
inlinefinal

Definition at line 126 of file ExpressionParser.cpp.

126  {
127  return _T("return a regex-matched section of a string");
128  };

The documentation for this class was generated from the following file: