regex.cpp
Go to the documentation of this file.
1 #include "regex.h"
2 
3 namespace YAML_PM
4 {
5  // constructors
7  {
8  }
9 
10  RegEx::RegEx(REGEX_OP op): m_op(op)
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 
YAML_PM::REGEX_SEQ
@ REGEX_SEQ
Definition: regex.h:16
YAML_PM::operator+
RegEx operator+(const RegEx &ex1, const RegEx &ex2)
Definition: regex.cpp:52
YAML_PM::operator||
RegEx operator||(const RegEx &ex1, const RegEx &ex2)
Definition: regex.cpp:36
YAML_PM::REGEX_RANGE
@ REGEX_RANGE
Definition: regex.h:16
YAML_PM
Definition: aliasmanager.h:11
YAML_PM::REGEX_EMPTY
@ REGEX_EMPTY
Definition: regex.h:16
YAML_PM::RegEx::RegEx
RegEx()
Definition: regex.cpp:6
YAML_PM::REGEX_NOT
@ REGEX_NOT
Definition: regex.h:16
testing::internal::string
::std::string string
Definition: gtest.h:1979
YAML_PM::REGEX_AND
@ REGEX_AND
Definition: regex.h:16
YAML_PM::operator&&
RegEx operator&&(const RegEx &ex1, const RegEx &ex2)
Definition: regex.cpp:44
YAML_PM::REGEX_MATCH
@ REGEX_MATCH
Definition: regex.h:16
regex.h
YAML_PM::operator!
RegEx operator!(const RegEx &ex)
Definition: regex.cpp:29
YAML_PM::RegEx::m_params
std::vector< RegEx > m_params
Definition: regex.h:61
YAML_PM::RegEx
Definition: regex.h:21
YAML_PM::REGEX_OP
REGEX_OP
Definition: regex.h:16
YAML_PM::REGEX_OR
@ REGEX_OR
Definition: regex.h:16


mp2p_icp
Author(s):
autogenerated on Fri Dec 20 2024 03:45:59