forked from cel-expr/cel-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap_impl.cc
More file actions
30 lines (26 loc) · 751 Bytes
/
Copy pathmap_impl.cc
File metadata and controls
30 lines (26 loc) · 751 Bytes
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
#include "internal/map_impl.h"
#include "common/macros.h"
#include "internal/status_util.h"
namespace google {
namespace api {
namespace expr {
namespace internal {
google::rpc::Status MapImpl::ForEach(
const std::function<google::rpc::Status(
const common::Value&, const common::Value&)>& call) const {
for (const auto& entry : value_) {
RETURN_IF_STATUS_ERROR(call(entry.first, entry.second));
}
return OkStatus();
}
common::Value MapImpl::GetImpl(const common::Value& key) const {
auto itr = value_.find(key);
if (itr == value_.end()) {
return common::Value::FromError(NoSuchKey(key.ToString()));
}
return itr->second;
}
} // namespace internal
} // namespace expr
} // namespace api
} // namespace google