From e11de7254efb71fbe5b26b113a8e2e5bdd8da15f Mon Sep 17 00:00:00 2001 From: "akalin@chromium.org" Date: Mon, 1 Nov 2010 20:50:55 +0000 Subject: 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 --- base/vlog.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'base/vlog.h') 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_ -- cgit v1.1