diff options
author | Brad King <brad.king@kitware.com> | 2014-05-13 18:55:35 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-05-13 18:55:35 (GMT) |
commit | 7fa16df4d7ce963dda98a6c5d54f528db7a29037 (patch) | |
tree | 3ed99c648b9c58251a0773356ed646905b23de1b /Source/kwsys/RegularExpression.hxx.in | |
parent | 96e9eb1766261605ebc97009d6ace20214eaa9a4 (diff) | |
parent | 7762c57405d3b0daefc484a5e07bc24e04701615 (diff) | |
download | CMake-7fa16df4d7ce963dda98a6c5d54f528db7a29037.zip CMake-7fa16df4d7ce963dda98a6c5d54f528db7a29037.tar.gz CMake-7fa16df4d7ce963dda98a6c5d54f528db7a29037.tar.bz2 |
Merge branch 'upstream-kwsys' into update-kwsys
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 |