-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathstrings.h
More file actions
73 lines (59 loc) · 2.52 KB
/
Copy pathstrings.h
File metadata and controls
73 lines (59 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef THIRD_PARTY_CEL_CPP_EXTENSIONS_STRINGS_H_
#define THIRD_PARTY_CEL_CPP_EXTENSIONS_STRINGS_H_
#include "absl/status/status.h"
#include "checker/type_checker_builder.h"
#include "compiler/compiler.h"
#include "eval/public/cel_function_registry.h"
#include "eval/public/cel_options.h"
#include "runtime/function_registry.h"
#include "runtime/runtime_options.h"
namespace cel::extensions {
constexpr int kStringsExtensionLatestVersion = 4;
struct StringsExtensionOptions {
int version = kStringsExtensionLatestVersion;
// Maximum precision allowed for floating point format specifiers in
// format() function. This is used for both fixed and scientific notations.
// Value must be in the range [0, 1000], otherwise clamped.
//
// Does not affect default precisions for %e and %f format specifiers.
int max_precision = 1000;
};
// Register extension functions for strings.
absl::Status RegisterStringsFunctions(
FunctionRegistry& registry, const RuntimeOptions& options,
const StringsExtensionOptions& extension_options = {});
absl::Status RegisterStringsFunctions(
google::api::expr::runtime::CelFunctionRegistry* registry,
const google::api::expr::runtime::InterpreterOptions& options,
const StringsExtensionOptions& extension_options = {});
CheckerLibrary StringsCheckerLibrary(
const StringsExtensionOptions& extension_options = {});
inline CheckerLibrary StringsCheckerLibrary(int version) {
StringsExtensionOptions options;
options.version = version;
return StringsCheckerLibrary(options);
}
inline CompilerLibrary StringsCompilerLibrary(
const StringsExtensionOptions& options = {}) {
return CompilerLibrary::FromCheckerLibrary(StringsCheckerLibrary(options));
}
inline CompilerLibrary StringsCompilerLibrary(int version) {
StringsExtensionOptions options;
options.version = version;
return StringsCompilerLibrary(options);
}
} // namespace cel::extensions
#endif // THIRD_PARTY_CEL_CPP_EXTENSIONS_STRINGS_H_