#pragma once #include "public.h" #include #include 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, ui64 bufferSizeLimit = 64 << 10, bool consumeUntilEof = true, TMaybe memoryLimit = Nothing()); ~TYsonParser(); void Parse(); private: class TImpl; THolder Impl; }; //////////////////////////////////////////////////////////////////////////////// class TStatelessYsonParser { public: TStatelessYsonParser( NYT::NYson::IYsonConsumer* consumer, bool enableLinePositionInfo = false, TMaybe memoryLimit = Nothing()); ~TStatelessYsonParser(); void Parse(const TStringBuf& data, EYsonType type = ::NYson::EYsonType::Node); private: class TImpl; THolder Impl; }; //////////////////////////////////////////////////////////////////////////////// class TYsonListParser { public: TYsonListParser( NYT::NYson::IYsonConsumer* consumer, IInputStream* stream, bool enableLinePositionInfo = false, TMaybe memoryLimit = Nothing()); ~TYsonListParser(); bool Parse(); // Returns false, if there is no more list items private: class TImpl; THolder Impl; }; //////////////////////////////////////////////////////////////////////////////// void ParseYsonStringBuffer( const TStringBuf& buffer, NYT::NYson::IYsonConsumer* consumer, EYsonType type = ::NYson::EYsonType::Node, bool enableLinePositionInfo = false, TMaybe memoryLimit = Nothing()); //////////////////////////////////////////////////////////////////////////////// } // namespace NYson