blob: 2789723663b31f2790d129a70d3217957fa88454 (
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
|
#pragma once
#include <util/generic/map.h>
#include <util/generic/maybe.h>
#include <util/generic/string.h>
namespace NYql {
class TStructuredToken {
public:
explicit TStructuredToken(TMap<TString, TString>&& data = {});
TStructuredToken(TStructuredToken&&) = default;
TStructuredToken(const TStructuredToken&) = default;
TString GetField(const TString& name) const;
TString GetFieldOrDefault(const TString& name, const TString& defaultValue) const;
TMaybe<TString> FindField(const TString& name) const;
bool HasField(const TString& name) const;
TStructuredToken& SetField(const TString& name, const TString& value);
TStructuredToken& ClearField(const TString& name);
TString ToJson() const;
private:
TMap<TString, TString> Data;
};
// is used for backward compatibility when content contains just token
bool IsStructuredTokenJson(const TString& content);
TStructuredToken ParseStructuredToken(const TString& content);
} // namespace NYql
|