diff options
author | KWSys Robot <kwrobot@kitware.com> | 2014-05-07 20:31:11 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-05-13 18:55:30 (GMT) |
commit | 7762c57405d3b0daefc484a5e07bc24e04701615 (patch) | |
tree | d72b0bd5ff9ed61dff559414e0751a8bf9a80979 /RegularExpression.hxx.in | |
parent | 397bccbaa94e6d17d15d17af2158fa6325d5c1e9 (diff) | |
download | CMake-7762c57405d3b0daefc484a5e07bc24e04701615.zip CMake-7762c57405d3b0daefc484a5e07bc24e04701615.tar.gz CMake-7762c57405d3b0daefc484a5e07bc24e04701615.tar.bz2 |
KWSys 2014-05-07 (6074f33f)
Extract upstream KWSys using the following shell commands.
$ git archive --prefix=upstream-kwsys/ 6074f33f | tar x
$ git shortlog --no-merges --abbrev=8 --format='%h %s' f3a36760..6074f33f
Ben Boeckel (22):
ef3bfa01 c_str: Don't use .c_str() when streaming strings
9c165368 Glob: Use string comparisons if you have them ready
53ba0bc6 containers: Use .empty() instead of .size() where possible
6cbb57ac strings: Use string methods instead of size calculations
e53596b7 RegularExpression: Add string overloads
aec9de6a CommandLineArguments: Push the string back, not its C string
1d531416 Glob: Accept a string in Glob::AddFile
81f5e0a8 Glob: Accept a string in Glob::AddExpression
d40c2706 SystemTools: Remove redundant if guards
c1296f4a SystemTools: Defer computing length until after a .empty() check
7ffb7106 SystemTools: Use the iterator constructor for strings
29e3b1d8 SystemTools: Use .rfind('/') rather than .find_last_of("/")
5eb3a65c SystemTools: Don't construct a string just for its length
b07b5fc1 SystemTools: Take a string in GetShortPath
153f6df7 SystemTools: Use strings in ComparePath
2c2f6604 SystemTools: Accept strings in IsSubDirectory
84db9ee5 SystemTools: Take strings in AddTranslationPath
4b409aa4 SystemTools: Take strings in SplitPath
d2dbff07 SystemTools: Take strings in CollapseFullPath
e9204f8f SystemTools: Take strings in AddKeepPath
3254681a SystemTools: Reserve memory in JoinPath
6074f33f SystemTools: Use static strings in SystemToolsAppendComponents
Change-Id: I53c7a1005206dba43ee785bf807c478bf146ca0e
Diffstat (limited to 'RegularExpression.hxx.in')
-rw-r--r-- | RegularExpression.hxx.in | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/RegularExpression.hxx.in b/RegularExpression.hxx.in index 62e9cad..502fbe2 100644 --- a/RegularExpression.hxx.in +++ b/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 |