diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-01 20:50:55 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-01 20:50:55 +0000 |
commit | e11de7254efb71fbe5b26b113a8e2e5bdd8da15f (patch) | |
tree | be8df3ca21aeb1c777d1efbfa6266174c0eb870d /base/vlog.h | |
parent | 86b531b3f6d8b5353a159456dba3bc03ebc68060 (diff) | |
download | chromium_src-e11de7254efb71fbe5b26b113a8e2e5bdd8da15f.zip chromium_src-e11de7254efb71fbe5b26b113a8e2e5bdd8da15f.tar.gz chromium_src-e11de7254efb71fbe5b26b113a8e2e5bdd8da15f.tar.bz2 |
Wrote a custom pattern matcher for vmodule.
The custom pattern matcher matches any slash (forward or backward) to any
slash. It also does not do escaping like MatchPattern(). Finally, '?'
matches exactly one character, which matches google-glog behavior
(MatchPattern() matches '?' to 0 or 1 character).
BUG=61123
TEST=New unittests
Review URL: http://codereview.chromium.org/4205005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64661 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/vlog.h')
-rw-r--r-- | base/vlog.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/base/vlog.h b/base/vlog.h index 1bdeb24..428b3e1 100644 --- a/base/vlog.h +++ b/base/vlog.h @@ -63,6 +63,19 @@ class VlogInfo { DISALLOW_COPY_AND_ASSIGN(VlogInfo); }; +// Returns true if the string passed in matches the vlog pattern. The +// vlog pattern string can contain wildcards like * and ?. ? matches +// exactly one character while * matches 0 or more characters. Also, +// as a special case, a / or \ character matches either / or \. +// +// Examples: +// "kh?n" matches "khan" but not "khn" or "khaan" +// "kh*n" matches "khn", "khan", or even "khaaaaan" +// "/foo\bar" matches "/foo/bar", "\foo\bar", or "/foo\bar" +// (disregarding C escaping rules) +bool MatchVlogPattern(const base::StringPiece& string, + const base::StringPiece& vlog_pattern); + } // namespace logging #endif // BASE_VLOG_H_ |