Flutter Engine
 
Loading...
Searching...
No Matches
filter.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_TOOLS_LICENSES_CPP_SRC_FILTER_H_
6#define FLUTTER_TOOLS_LICENSES_CPP_SRC_FILTER_H_
7
8#include <iosfwd>
9#include <memory>
10#include <string_view>
11#include "flutter/third_party/re2/re2/re2.h"
12#include "third_party/abseil-cpp/absl/status/statusor.h"
13
14/// A filter is a concatenation of multiple regex.
15///
16/// This is used for things like the include.txt and exclude.txt.
17class Filter {
18 public:
19 static absl::StatusOr<Filter> Open(std::string_view path);
20
21 static absl::StatusOr<Filter> Open(std::istream& input);
22
23 bool Matches(std::string_view input) const;
24
25 Filter(const Filter&) = delete;
26 Filter& operator=(const Filter&) = delete;
27 Filter(Filter&&) = default;
28 Filter& operator=(Filter&&) = default;
29
30 private:
31 explicit Filter(std::string_view regex);
32 std::unique_ptr<RE2> re_;
33};
34
35#endif // FLUTTER_TOOLS_LICENSES_CPP_SRC_FILTER_H_
static absl::StatusOr< Filter > Open(std::string_view path)
Definition filter.cc:9
bool Matches(std::string_view input) const
Definition filter.cc:46
Filter & operator=(const Filter &)=delete
Filter(Filter &&)=default
Filter(const Filter &)=delete
Filter & operator=(Filter &&)=default
static int input(yyscan_t yyscanner)