MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / AddStringFunctions

Function AddStringFunctions

checker/standard_library.cc:652–675  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

650}
651
652absl::Status AddStringFunctions(TypeCheckerBuilder& builder) {
653 FunctionDecl contains;
654 contains.set_name(StandardFunctions::kStringContains);
655 CEL_RETURN_IF_ERROR(contains.AddOverload(
656 MakeMemberOverloadDecl(StandardOverloadIds::kContainsString, BoolType(),
657 StringType(), StringType())));
658 CEL_RETURN_IF_ERROR(builder.AddFunction(std::move(contains)));
659
660 FunctionDecl starts_with;
661 starts_with.set_name(StandardFunctions::kStringStartsWith);
662 CEL_RETURN_IF_ERROR(starts_with.AddOverload(
663 MakeMemberOverloadDecl(StandardOverloadIds::kStartsWithString, BoolType(),
664 StringType(), StringType())));
665 CEL_RETURN_IF_ERROR(builder.AddFunction(std::move(starts_with)));
666
667 FunctionDecl ends_with;
668 ends_with.set_name(StandardFunctions::kStringEndsWith);
669 CEL_RETURN_IF_ERROR(ends_with.AddOverload(
670 MakeMemberOverloadDecl(StandardOverloadIds::kEndsWithString, BoolType(),
671 StringType(), StringType())));
672 CEL_RETURN_IF_ERROR(builder.AddFunction(std::move(ends_with)));
673
674 return absl::OkStatus();
675}
676
677absl::Status AddRegexFunctions(TypeCheckerBuilder& builder) {
678 FunctionDecl matches;

Callers 1

AddStandardLibraryDeclsFunction · 0.85

Calls 6

MakeMemberOverloadDeclFunction · 0.85
AddOverloadMethod · 0.80
BoolTypeClass · 0.50
StringTypeClass · 0.50
set_nameMethod · 0.45
AddFunctionMethod · 0.45

Tested by

no test coverage detected