aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yson_pull/reader.h
blob: ad47fa0ea2eb931b1a5453471611a962d0cd7b16 (plain) (blame)
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
31
32
33
34
35
36
37
#pragma once 
 
#include "event.h" 
#include "input.h" 
#include "stream_type.h" 
 
#include <util/system/yassert.h> 
 
#include <memory> 
 
namespace NYsonPull { 
    namespace NDetail {
        class reader_impl;
    }
 
    //! \brief YSON reader facade class.
    //!
    //! Owns an input stream.
    class TReader {
        THolder<NInput::IStream> Stream_; 
        THolder<NDetail::reader_impl> Impl_; 
 
    public:
        TReader(THolder<NInput::IStream> stream, EStreamType mode);
        TReader(TReader&&) noexcept;
        ~TReader();
 
        //! \brief Advance stream to next event and return it.
        //!
        //! Any event data is invalidated by a call to NextEvent(); 
        const TEvent& NextEvent(); 
 
        //! \brief Get last returned event.
        const TEvent& LastEvent() const noexcept; 
    };
 
}