aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yson/parser.h
diff options
context:
space:
mode:
authorDevtools Arcadia <arcadia-devtools@yandex-team.ru>2022-02-07 18:08:42 +0300
committerDevtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net>2022-02-07 18:08:42 +0300
commit1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch)
treee26c9fed0de5d9873cce7e00bc214573dc2195b7 /library/cpp/yson/parser.h
downloadydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'library/cpp/yson/parser.h')
-rw-r--r--library/cpp/yson/parser.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/library/cpp/yson/parser.h b/library/cpp/yson/parser.h
new file mode 100644
index 00000000000..dce35a8cd40
--- /dev/null
+++ b/library/cpp/yson/parser.h
@@ -0,0 +1,83 @@
+#pragma once
+
+#include "public.h"
+
+#include <util/generic/maybe.h>
+#include <util/generic/ptr.h>
+
+class IInputStream;
+
+namespace NYT::NYson {
+struct IYsonConsumer;
+} // namespace NYT::NYson
+
+namespace NYson {
+ ////////////////////////////////////////////////////////////////////////////////
+
+ class TYsonParser {
+ public:
+ TYsonParser(
+ NYT::NYson::IYsonConsumer* consumer,
+ IInputStream* stream,
+ EYsonType type = ::NYson::EYsonType::Node,
+ bool enableLinePositionInfo = false,
+ TMaybe<ui64> memoryLimit = Nothing());
+
+ ~TYsonParser();
+
+ void Parse();
+
+ private:
+ class TImpl;
+ THolder<TImpl> Impl;
+ };
+
+ ////////////////////////////////////////////////////////////////////////////////
+
+ class TStatelessYsonParser {
+ public:
+ TStatelessYsonParser(
+ NYT::NYson::IYsonConsumer* consumer,
+ bool enableLinePositionInfo = false,
+ TMaybe<ui64> memoryLimit = Nothing());
+
+ ~TStatelessYsonParser();
+
+ void Parse(const TStringBuf& data, EYsonType type = ::NYson::EYsonType::Node);
+
+ private:
+ class TImpl;
+ THolder<TImpl> Impl;
+ };
+
+ ////////////////////////////////////////////////////////////////////////////////
+
+ class TYsonListParser {
+ public:
+ TYsonListParser(
+ NYT::NYson::IYsonConsumer* consumer,
+ IInputStream* stream,
+ bool enableLinePositionInfo = false,
+ TMaybe<ui64> memoryLimit = Nothing());
+
+ ~TYsonListParser();
+
+ bool Parse(); // Returns false, if there is no more list items
+
+ private:
+ class TImpl;
+ THolder<TImpl> Impl;
+ };
+
+ ////////////////////////////////////////////////////////////////////////////////
+
+ void ParseYsonStringBuffer(
+ const TStringBuf& buffer,
+ NYT::NYson::IYsonConsumer* consumer,
+ EYsonType type = ::NYson::EYsonType::Node,
+ bool enableLinePositionInfo = false,
+ TMaybe<ui64> memoryLimit = Nothing());
+
+ ////////////////////////////////////////////////////////////////////////////////
+
+} // namespace NYson