regex.cpp
Go to the documentation of this file.
1 #include "regex.h"
2 
3 namespace YAML_PM
4 {
5  // constructors
7  {
8  }
9 
11  {
12  }
13 
14  RegEx::RegEx(char ch): m_op(REGEX_MATCH), m_a(ch)
15  {
16  }
17 
18  RegEx::RegEx(char a, char z): m_op(REGEX_RANGE), m_a(a), m_z(z)
19  {
20  }
21 
22  RegEx::RegEx(const std::string& str, REGEX_OP op): m_op(op)
23  {
24  for(std::size_t i=0;i<str.size();i++)
25  m_params.push_back(RegEx(str[i]));
26  }
27 
28  // combination constructors
29  RegEx operator ! (const RegEx& ex)
30  {
31  RegEx ret(REGEX_NOT);
32  ret.m_params.push_back(ex);
33  return ret;
34  }
35 
36  RegEx operator || (const RegEx& ex1, const RegEx& ex2)
37  {
38  RegEx ret(REGEX_OR);
39  ret.m_params.push_back(ex1);
40  ret.m_params.push_back(ex2);
41  return ret;
42  }
43 
44  RegEx operator && (const RegEx& ex1, const RegEx& ex2)
45  {
46  RegEx ret(REGEX_AND);
47  ret.m_params.push_back(ex1);
48  ret.m_params.push_back(ex2);
49  return ret;
50  }
51 
52  RegEx operator + (const RegEx& ex1, const RegEx& ex2)
53  {
54  RegEx ret(REGEX_SEQ);
55  ret.m_params.push_back(ex1);
56  ret.m_params.push_back(ex2);
57  return ret;
58  }
59 }
60 
friend RegEx operator&&(const RegEx &ex1, const RegEx &ex2)
Definition: regex.cpp:44
::std::string string
Definition: gtest.h:1979
friend RegEx operator||(const RegEx &ex1, const RegEx &ex2)
Definition: regex.cpp:36
REGEX_OP m_op
Definition: regex.h:59
char m_a
Definition: regex.h:60
friend RegEx operator+(const RegEx &ex1, const RegEx &ex2)
Definition: regex.cpp:52
friend RegEx operator!(const RegEx &ex)
Definition: regex.cpp:29
REGEX_OP
Definition: regex.h:16
char m_z
Definition: regex.h:60
std::vector< RegEx > m_params
Definition: regex.h:61


libpointmatcher
Author(s):
autogenerated on Sat May 27 2023 02:38:03