regex.cpp
Go to the documentation of this file.
00001 #include "regex.h"
00002 
00003 namespace YAML_PM
00004 {
00005         // constructors
00006         RegEx::RegEx(): m_op(REGEX_EMPTY)
00007         {
00008         }
00009         
00010         RegEx::RegEx(REGEX_OP op): m_op(op)
00011         {
00012         }
00013         
00014         RegEx::RegEx(char ch): m_op(REGEX_MATCH), m_a(ch)
00015         {
00016         }
00017         
00018         RegEx::RegEx(char a, char z): m_op(REGEX_RANGE), m_a(a), m_z(z)
00019         {
00020         }
00021         
00022         RegEx::RegEx(const std::string& str, REGEX_OP op): m_op(op)
00023         {
00024                 for(std::size_t i=0;i<str.size();i++)
00025                         m_params.push_back(RegEx(str[i]));
00026         }
00027         
00028         // combination constructors
00029         RegEx operator ! (const RegEx& ex)
00030         {
00031                 RegEx ret(REGEX_NOT);
00032                 ret.m_params.push_back(ex);
00033                 return ret;
00034         }
00035         
00036         RegEx operator || (const RegEx& ex1, const RegEx& ex2)
00037         {
00038                 RegEx ret(REGEX_OR);
00039                 ret.m_params.push_back(ex1);
00040                 ret.m_params.push_back(ex2);
00041                 return ret;
00042         }
00043         
00044         RegEx operator && (const RegEx& ex1, const RegEx& ex2)
00045         {
00046                 RegEx ret(REGEX_AND);
00047                 ret.m_params.push_back(ex1);
00048                 ret.m_params.push_back(ex2);
00049                 return ret;
00050         }
00051         
00052         RegEx operator + (const RegEx& ex1, const RegEx& ex2)
00053         {
00054                 RegEx ret(REGEX_SEQ);
00055                 ret.m_params.push_back(ex1);
00056                 ret.m_params.push_back(ex2);
00057                 return ret;
00058         }       
00059 }
00060 


upstream_src
Author(s):
autogenerated on Mon Oct 6 2014 10:27:42