/proc/self/cwd/common/kind.cc
Line | Count | Source |
1 | | // Copyright 2023 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 | | #include "common/kind.h" |
16 | | |
17 | | #include "absl/strings/string_view.h" |
18 | | |
19 | | namespace cel { |
20 | | |
21 | 11.0k | absl::string_view KindToString(Kind kind) { |
22 | 11.0k | switch (kind) { |
23 | 208 | case Kind::kNullType: |
24 | 208 | return "null_type"; |
25 | 0 | case Kind::kDyn: |
26 | 0 | return "dyn"; |
27 | 0 | case Kind::kAny: |
28 | 0 | return "any"; |
29 | 147 | case Kind::kType: |
30 | 147 | return "type"; |
31 | 0 | case Kind::kTypeParam: |
32 | 0 | return "type_param"; |
33 | 0 | case Kind::kFunction: |
34 | 0 | return "function"; |
35 | 3.99k | case Kind::kBool: |
36 | 3.99k | return "bool"; |
37 | 4.27k | case Kind::kInt: |
38 | 4.27k | return "int"; |
39 | 654 | case Kind::kUint: |
40 | 654 | return "uint"; |
41 | 691 | case Kind::kDouble: |
42 | 691 | return "double"; |
43 | 307 | case Kind::kString: |
44 | 307 | return "string"; |
45 | 97 | case Kind::kBytes: |
46 | 97 | return "bytes"; |
47 | 7 | case Kind::kDuration: |
48 | 7 | return "duration"; |
49 | 1 | case Kind::kTimestamp: |
50 | 1 | return "timestamp"; |
51 | 219 | case Kind::kList: |
52 | 219 | return "list"; |
53 | 396 | case Kind::kMap: |
54 | 396 | return "map"; |
55 | 0 | case Kind::kStruct: |
56 | 0 | return "struct"; |
57 | 0 | case Kind::kUnknown: |
58 | 0 | return "*unknown*"; |
59 | 0 | case Kind::kOpaque: |
60 | 0 | return "*opaque*"; |
61 | 0 | case Kind::kBoolWrapper: |
62 | 0 | return "google.protobuf.BoolValue"; |
63 | 0 | case Kind::kIntWrapper: |
64 | 0 | return "google.protobuf.Int64Value"; |
65 | 0 | case Kind::kUintWrapper: |
66 | 0 | return "google.protobuf.UInt64Value"; |
67 | 0 | case Kind::kDoubleWrapper: |
68 | 0 | return "google.protobuf.DoubleValue"; |
69 | 0 | case Kind::kStringWrapper: |
70 | 0 | return "google.protobuf.StringValue"; |
71 | 0 | case Kind::kBytesWrapper: |
72 | 0 | return "google.protobuf.BytesValue"; |
73 | 0 | case Kind::kEnum: |
74 | 0 | return "enum"; |
75 | 0 | default: |
76 | 0 | return "*error*"; |
77 | 11.0k | } |
78 | 11.0k | } |
79 | | |
80 | | } // namespace cel |