mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
RX: C++11
This commit is contained in:
parent
073ff9032d
commit
4d2c97f2c3
2 changed files with 11 additions and 17 deletions
22
src/RX.cpp
22
src/RX.cpp
|
@ -26,14 +26,11 @@
|
|||
|
||||
#include <cmake.h>
|
||||
#include <RX.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
RX::RX ()
|
||||
: _compiled (false)
|
||||
, _pattern ("")
|
||||
, _case_sensitive (false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -51,8 +48,8 @@ RX::RX (
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
RX::RX (const RX& other)
|
||||
{
|
||||
_compiled = false;
|
||||
_pattern = other._pattern;
|
||||
_compiled = false;
|
||||
_pattern = other._pattern;
|
||||
_case_sensitive = other._case_sensitive;
|
||||
}
|
||||
|
||||
|
@ -66,12 +63,9 @@ RX::~RX ()
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
RX& RX::operator= (const RX& other)
|
||||
{
|
||||
if (this != &other)
|
||||
{
|
||||
_compiled = false;
|
||||
_pattern = other._pattern;
|
||||
_case_sensitive = other._case_sensitive;
|
||||
}
|
||||
_compiled = false;
|
||||
_pattern = other._pattern;
|
||||
_case_sensitive = other._case_sensitive;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@ -107,7 +101,7 @@ bool RX::match (const std::string& in)
|
|||
if (! _compiled)
|
||||
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;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
6
src/RX.h
6
src/RX.h
|
@ -48,9 +48,9 @@ private:
|
|||
void compile ();
|
||||
|
||||
private:
|
||||
bool _compiled;
|
||||
std::string _pattern;
|
||||
bool _case_sensitive;
|
||||
bool _compiled {false};
|
||||
std::string _pattern {};
|
||||
bool _case_sensitive {false};
|
||||
regex_t _regex;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue