aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/json/common/defs.h
blob: d3c8761bcc0fde6e6858c94d5c4733436ddd9ca3 (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
38
#pragma once

#include <util/generic/strbuf.h>
#include <util/generic/yexception.h>

namespace NJson {
    class TJsonException: public yexception {
    };

    class TJsonCallbacks {
    public:
        explicit TJsonCallbacks(bool throwException = false)
            : ThrowException(throwException)
        {
        }

        virtual ~TJsonCallbacks();

        virtual bool OnNull();
        virtual bool OnBoolean(bool);
        virtual bool OnInteger(long long);
        virtual bool OnUInteger(unsigned long long);
        virtual bool OnDouble(double);
        virtual bool OnString(const TStringBuf&);
        virtual bool OnOpenMap();
        virtual bool OnMapKey(const TStringBuf&);
        virtual bool OnCloseMap();
        virtual bool OnOpenArray();
        virtual bool OnCloseArray();
        virtual bool OnStringNoCopy(const TStringBuf& s);
        virtual bool OnMapKeyNoCopy(const TStringBuf& s);
        virtual bool OnEnd();
        virtual void OnError(size_t off, TStringBuf reason);

    protected:
        bool ThrowException;
    };
}