RX: C++11
This commit is contained in:
22
src/RX.cpp
22
src/RX.cpp
@@ -26,14 +26,11 @@
|
|||||||
|
|
||||||
#include <cmake.h>
|
#include <cmake.h>
|
||||||
#include <RX.h>
|
#include <RX.h>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
RX::RX ()
|
RX::RX ()
|
||||||
: _compiled (false)
|
|
||||||
, _pattern ("")
|
|
||||||
, _case_sensitive (false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,8 +48,8 @@ RX::RX (
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
RX::RX (const RX& other)
|
RX::RX (const RX& other)
|
||||||
{
|
{
|
||||||
_compiled = false;
|
_compiled = false;
|
||||||
_pattern = other._pattern;
|
_pattern = other._pattern;
|
||||||
_case_sensitive = other._case_sensitive;
|
_case_sensitive = other._case_sensitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,12 +63,9 @@ RX::~RX ()
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
RX& RX::operator= (const RX& other)
|
RX& RX::operator= (const RX& other)
|
||||||
{
|
{
|
||||||
if (this != &other)
|
_compiled = false;
|
||||||
{
|
_pattern = other._pattern;
|
||||||
_compiled = false;
|
_case_sensitive = other._case_sensitive;
|
||||||
_pattern = other._pattern;
|
|
||||||
_case_sensitive = other._case_sensitive;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@@ -107,7 +101,7 @@ bool RX::match (const std::string& in)
|
|||||||
if (! _compiled)
|
if (! _compiled)
|
||||||
compile ();
|
compile ();
|
||||||
|
|
||||||
return regexec (&_regex, in.c_str (), 0, NULL, 0) == 0 ? true : false;
|
return regexec (&_regex, in.c_str (), 0, nullptr, 0) == 0 ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user