~alinuxninja/nginx-edge/trunk

« back to all changes in this revision

Viewing changes to debian/modules/ngx_pagespeed/psol/include/pagespeed/kernel/util/re2.h

  • Committer: Vivian
  • Date: 2015-12-04 18:20:11 UTC
  • Revision ID: git-v1:a36f2bc32e884f7473b3a47040e5411306144d7d
* Do not extract psol.tar.gz

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright 2012 Google Inc.
3
 
 *
4
 
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 
 * you may not use this file except in compliance with the License.
6
 
 * You may obtain a copy of the License at
7
 
 *
8
 
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 
 *
10
 
 * Unless required by applicable law or agreed to in writing, software
11
 
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 
 * See the License for the specific language governing permissions and
14
 
 * limitations under the License.
15
 
 */
16
 
 
17
 
// Author: gagansingh@google.com (Gagan Singh)
18
 
 
19
 
#ifndef PAGESPEED_KERNEL_UTIL_RE2_H_
20
 
#define PAGESPEED_KERNEL_UTIL_RE2_H_
21
 
 
22
 
#include "pagespeed/kernel/base/string_util.h"
23
 
 
24
 
#include "third_party/re2/src/re2/re2.h"
25
 
 
26
 
using re2::RE2;
27
 
 
28
 
namespace re2 {
29
 
const RE2::CannedOptions posix_syntax = RE2::POSIX_SYNTAX;
30
 
}  // namespace re2
31
 
 
32
 
typedef re2::StringPiece Re2StringPiece;
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
 
inline re2::StringPiece StringPieceToRe2(StringPiece sp) {
43
 
  return re2::StringPiece(sp.data(), sp.size());
44
 
}
45
 
 
46
 
inline StringPiece Re2ToStringPiece(re2::StringPiece sp) {
47
 
  return StringPiece(sp.data(), sp.size());
48
 
}
49
 
 
50
 
 
51
 
#endif  // PAGESPEED_KERNEL_UTIL_RE2_H_