/proc/self/cwd/parser/source_factory.h
Line | Count | Source |
1 | | // Copyright 2021 Google LLC |
2 | | // |
3 | | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | | // you may not use this file except in compliance with the License. |
5 | | // You may obtain a copy of the License at |
6 | | // |
7 | | // https://www.apache.org/licenses/LICENSE-2.0 |
8 | | // |
9 | | // Unless required by applicable law or agreed to in writing, software |
10 | | // distributed under the License is distributed on an "AS IS" BASIS, |
11 | | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | | // See the License for the specific language governing permissions and |
13 | | // limitations under the License. |
14 | | |
15 | | #ifndef THIRD_PARTY_CEL_CPP_PARSER_SOURCE_FACTORY_H_ |
16 | | #define THIRD_PARTY_CEL_CPP_PARSER_SOURCE_FACTORY_H_ |
17 | | |
18 | | #include <cstdint> |
19 | | #include <utility> |
20 | | |
21 | | #include "absl/container/flat_hash_map.h" |
22 | | |
23 | | namespace cel { |
24 | | |
25 | | class EnrichedSourceInfo { |
26 | | public: |
27 | | explicit EnrichedSourceInfo( |
28 | | absl::flat_hash_map<int64_t, std::pair<int32_t, int32_t>> offsets) |
29 | 19.2k | : offsets_(std::move(offsets)) {} |
30 | | |
31 | 28.8k | EnrichedSourceInfo() = default; |
32 | | EnrichedSourceInfo(const EnrichedSourceInfo& other) = default; |
33 | | EnrichedSourceInfo& operator=(const EnrichedSourceInfo& other) = default; |
34 | 76.9k | EnrichedSourceInfo(EnrichedSourceInfo&& other) = default; |
35 | 19.2k | EnrichedSourceInfo& operator=(EnrichedSourceInfo&& other) = default; |
36 | | |
37 | | const absl::flat_hash_map<int64_t, std::pair<int32_t, int32_t>>& offsets() |
38 | 0 | const { |
39 | 0 | return offsets_; |
40 | 0 | } |
41 | | |
42 | | private: |
43 | | // A map between node_id and pair of start position and end position |
44 | | absl::flat_hash_map<int64_t, std::pair<int32_t, int32_t>> offsets_; |
45 | | }; |
46 | | |
47 | | } // namespace cel |
48 | | |
49 | | namespace google::api::expr::parser { |
50 | | |
51 | | using EnrichedSourceInfo = ::cel::EnrichedSourceInfo; |
52 | | |
53 | | } // namespace google::api::expr::parser |
54 | | |
55 | | #endif // THIRD_PARTY_CEL_CPP_PARSER_SOURCE_FACTORY_H_ |