diff options
author | svkrasnov <svkrasnov@yandex-team.ru> | 2022-02-10 16:50:36 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:36 +0300 |
commit | f844999843f80df761f7bbd58b0d2ca479f2dd32 (patch) | |
tree | d42db3b18dc5b59d3874e4f15444076164fd5205 /library/cpp/protobuf/util/walk.h | |
parent | a1fb24cd1409be21002b3f8d291c3f6cfc113e68 (diff) | |
download | ydb-f844999843f80df761f7bbd58b0d2ca479f2dd32.tar.gz |
Restoring authorship annotation for <svkrasnov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/protobuf/util/walk.h')
-rw-r--r-- | library/cpp/protobuf/util/walk.h | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/library/cpp/protobuf/util/walk.h b/library/cpp/protobuf/util/walk.h index d15d76562d..e630986240 100644 --- a/library/cpp/protobuf/util/walk.h +++ b/library/cpp/protobuf/util/walk.h @@ -5,29 +5,29 @@ #include <google/protobuf/message.h> #include <google/protobuf/descriptor.h> -#include <functional> - +#include <functional> + namespace NProtoBuf { // Apply @onField processor to each field in @msg (even empty) - // Do not walk deeper the field if the field is an empty message - // Returned bool defines if we should walk down deeper to current node children (true), or not (false) - void WalkReflection(Message& msg, - std::function<bool(Message&, const FieldDescriptor*)> onField); - void WalkReflection(const Message& msg, - std::function<bool(const Message&, const FieldDescriptor*)> onField); - - template <typename TOnField> - inline void WalkReflection(Message& msg, TOnField& onField) { // is used when TOnField is a callable class instance - WalkReflection(msg, std::function<bool(Message&, const FieldDescriptor*)>(std::ref(onField))); - } - template <typename TOnField> - inline void WalkReflection(const Message& msg, TOnField& onField) { - WalkReflection(msg, std::function<bool(const Message&, const FieldDescriptor*)>(std::ref(onField))); - } - - // Apply @onField processor to each descriptor of a field - // Walk every field including nested messages. Avoid cyclic fields pointing to themselves + // Do not walk deeper the field if the field is an empty message // Returned bool defines if we should walk down deeper to current node children (true), or not (false) - void WalkSchema(const Descriptor* descriptor, - std::function<bool(const FieldDescriptor*)> onField); + void WalkReflection(Message& msg, + std::function<bool(Message&, const FieldDescriptor*)> onField); + void WalkReflection(const Message& msg, + std::function<bool(const Message&, const FieldDescriptor*)> onField); + + template <typename TOnField> + inline void WalkReflection(Message& msg, TOnField& onField) { // is used when TOnField is a callable class instance + WalkReflection(msg, std::function<bool(Message&, const FieldDescriptor*)>(std::ref(onField))); + } + template <typename TOnField> + inline void WalkReflection(const Message& msg, TOnField& onField) { + WalkReflection(msg, std::function<bool(const Message&, const FieldDescriptor*)>(std::ref(onField))); + } + + // Apply @onField processor to each descriptor of a field + // Walk every field including nested messages. Avoid cyclic fields pointing to themselves + // Returned bool defines if we should walk down deeper to current node children (true), or not (false) + void WalkSchema(const Descriptor* descriptor, + std::function<bool(const FieldDescriptor*)> onField); } |