Coverage Report

Created: 2026-11-21 07:20

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/proc/self/cwd/pagespeed/kernel/util/re2.h
Line
Count
Source
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one
3
 * or more contributor license agreements.  See the NOTICE file
4
 * distributed with this work for additional information
5
 * regarding copyright ownership.  The ASF licenses this file
6
 * to you under the Apache License, Version 2.0 (the
7
 * "License"); you may not use this file except in compliance
8
 * with the License.  You may obtain a copy of the License at
9
 * 
10
 *   http://www.apache.org/licenses/LICENSE-2.0
11
 * 
12
 * Unless required by applicable law or agreed to in writing,
13
 * software distributed under the License is distributed on an
14
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
 * KIND, either express or implied.  See the License for the
16
 * specific language governing permissions and limitations
17
 * under the License.
18
 */
19
20
#ifndef PAGESPEED_KERNEL_UTIL_RE2_H_
21
#define PAGESPEED_KERNEL_UTIL_RE2_H_
22
23
#include "pagespeed/kernel/base/string_util.h"
24
#include "re2/re2.h"
25
26
using re2::RE2;
27
28
namespace re2 {
29
const RE2::CannedOptions posix_syntax = RE2::POSIX;
30
}  // namespace re2
31
32
using Re2StringPiece = re2::StringPiece;
33
// Converts a Google StringPiece into an RE2 StringPiece.  These are of course
34
// the same basic thing but are declared in distinct namespaces and as far as
35
// C++ type-checking is concerned they are incompatible.
36
//
37
// TODO(jmarantz): In the re2 code itself there are no references to
38
// re2::StringPiece, always just plain StringPiece, so if we can
39
// arrange to get the right definition #included we should be all set.
40
// We could somehow rewrite '#include "re2/stringpiece.h"' to
41
// #include Chromium's stringpiece then everything would just work.
42
2.96M
inline re2::StringPiece StringPieceToRe2(StringPiece sp) {
43
2.96M
  return re2::StringPiece(sp.data(), sp.size());
44
2.96M
}
45
46
0
inline StringPiece Re2ToStringPiece(re2::StringPiece sp) {
47
0
  return StringPiece(sp.data(), sp.size());
48
0
}
49
50
#endif  // PAGESPEED_KERNEL_UTIL_RE2_H_