diff options
Diffstat (limited to 'Source/kwsys/RegularExpression.hxx.in')
-rw-r--r-- | Source/kwsys/RegularExpression.hxx.in | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/Source/kwsys/RegularExpression.hxx.in b/Source/kwsys/RegularExpression.hxx.in index 62e9cad..502fbe2 100644 --- a/Source/kwsys/RegularExpression.hxx.in +++ b/Source/kwsys/RegularExpression.hxx.in @@ -198,13 +198,18 @@ public: * Instantiate RegularExpression with compiled char*. */ inline RegularExpression (char const*); - + /** * Instantiate RegularExpression as a copy of another regular expression. */ RegularExpression (RegularExpression const&); /** + * Instantiate RegularExpression with compiled string. + */ + inline RegularExpression (kwsys_stl::string const&); + + /** * Destructor. */ inline ~RegularExpression(); @@ -216,6 +221,12 @@ public: bool compile (char const*); /** + * Compile a regular expression into internal code + * for later pattern matching. + */ + inline bool compile (kwsys_stl::string const&); + + /** * Matches the regular expression to the given string. * Returns true if found, and sets start and end indexes accordingly. */ @@ -225,7 +236,7 @@ public: * Matches the regular expression to the given std string. * Returns true if found, and sets start and end indexes accordingly. */ - bool find (kwsys_stl::string const&); + inline bool find (kwsys_stl::string const&); /** * Index to start of first find. @@ -313,6 +324,16 @@ inline RegularExpression::RegularExpression (const char* s) } /** + * Creates a regular expression from string s, and + * compiles s. + */ +inline RegularExpression::RegularExpression (const kwsys_stl::string& s) +{ + this->program = 0; + this->compile(s); +} + +/** * Destroys and frees space allocated for the regular expression. */ inline RegularExpression::~RegularExpression () @@ -323,6 +344,24 @@ inline RegularExpression::~RegularExpression () } /** + * Compile a regular expression into internal code + * for later pattern matching. + */ +inline bool RegularExpression::compile (kwsys_stl::string const& s) +{ + return this->compile(s.c_str()); +} + +/** + * Matches the regular expression to the given std string. + * Returns true if found, and sets start and end indexes accordingly. + */ +inline bool RegularExpression::find (kwsys_stl::string const& s) +{ + return this->find(s.c_str()); +} + +/** * Set the start position for the regular expression. */ inline kwsys_stl::string::size_type RegularExpression::start () const |