aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/protobuf/util/path.cpp
diff options
context:
space:
mode:
authorVasily Gerasimov <UgnineSirdis@gmail.com>2022-02-10 16:49:10 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:10 +0300
commit1eb755fbca92172a6aec2f57371b2b3a19dfab43 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/protobuf/util/path.cpp
parent6cdc8f140213c595e4ad38bc3d97fcef1146b8c3 (diff)
downloadydb-1eb755fbca92172a6aec2f57371b2b3a19dfab43.tar.gz
Restoring authorship annotation for Vasily Gerasimov <UgnineSirdis@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/protobuf/util/path.cpp')
-rw-r--r--library/cpp/protobuf/util/path.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/library/cpp/protobuf/util/path.cpp b/library/cpp/protobuf/util/path.cpp
index 8a9c2ba7d7..efa2a42c8a 100644
--- a/library/cpp/protobuf/util/path.cpp
+++ b/library/cpp/protobuf/util/path.cpp
@@ -1,20 +1,20 @@
-#include "path.h"
-
-#include <util/generic/yexception.h>
-
-namespace NProtoBuf {
+#include "path.h"
+
+#include <util/generic/yexception.h>
+
+namespace NProtoBuf {
TFieldPath::TFieldPath() {
}
-
+
TFieldPath::TFieldPath(const Descriptor* msgType, const TStringBuf& path) {
Init(msgType, path);
}
-
+
TFieldPath::TFieldPath(const TVector<const FieldDescriptor*>& path)
: Path(path)
{
}
-
+
bool TFieldPath::InitUnsafe(const Descriptor* msgType, TStringBuf path) {
Path.clear();
while (path) {
@@ -23,10 +23,10 @@ namespace NProtoBuf {
next = path.NextTok('/');
if (!next)
return true;
-
+
if (!msgType) // need field but no message type
return false;
-
+
TString nextStr(next);
const FieldDescriptor* field = msgType->FindFieldByName(nextStr);
if (!field) {
@@ -41,21 +41,21 @@ namespace NProtoBuf {
return false; // ambiguity
field = ext;
}
- }
- }
-
+ }
+ }
+
if (!field)
return false;
-
+
Path.push_back(field);
msgType = field->type() == FieldDescriptor::TYPE_MESSAGE ? field->message_type() : nullptr;
}
return true;
- }
-
+ }
+
void TFieldPath::Init(const Descriptor* msgType, const TStringBuf& path) {
if (!InitUnsafe(msgType, path))
ythrow yexception() << "Failed to resolve path \"" << path << "\" relative to " << msgType->full_name();
}
-}
+}