SGL
privateregexpr.h
1 /*
2  * File: privateregexpr.h
3  * ----------------------
4  * This file exports functions for performing regular expression operations
5  * on C++ strings. It will be unnecessary once the C++11 regex library
6  * is widely available, but as of this writing the regex library is not
7  * supported on gcc and other major C++ compilers.
8  * This functionality is considered "private" and not to be used by students.
9  *
10  * @author Marty Stepp
11  * @version 2021/04/09
12  * - moved to private SGL namespace
13  * - renamed functions to remove 'regex' prefix
14  * @version 2021/04/03
15  * - removed dependency on custom collections
16  * @version 2018/09/25
17  * - added doc comments for new documentation generation
18  * @version 2018/09/20
19  * - added Qt version checking around some regex functions for compatibility
20  * @version 2014/10/14
21  * - removed regexMatchCountWithLines for simplicity
22  * @since 2014/03/01
23  */
24 
25 
26 #ifndef _private_regexpr_h
27 #define _private_regexpr_h
28 
29 #include <string>
30 #include <vector>
31 
32 namespace sgl {
33 namespace priv {
34 namespace regexpr {
35 
41 bool match(const string& s, const string& regexp);
42 
48 int matchCount(const string& s, const string& regexp);
49 
58 int matchCountWithLines(const string& s, const string& regexp,
59  string& linesOut);
60 
69 void matchCountWithLines(const string& s, const string& regexp,
70  std::vector<int>& linesOut);
71 
78 string replace(const string& s, const string& regexp,
79  const string& replacement, int limit = -1);
80 
81 } // namespace regexpr
82 } // namespace priv
83 } // namespace sgl
84 
85 #endif // _private_regexpr_h
Definition: console.h:45