diff options
author | Devtools Arcadia <arcadia-devtools@yandex-team.ru> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /library/cpp/yson/node/node_io.h | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'library/cpp/yson/node/node_io.h')
-rw-r--r-- | library/cpp/yson/node/node_io.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/library/cpp/yson/node/node_io.h b/library/cpp/yson/node/node_io.h new file mode 100644 index 0000000000..2ad23b658f --- /dev/null +++ b/library/cpp/yson/node/node_io.h @@ -0,0 +1,40 @@ +#pragma once + +#include "node.h" +#include <library/cpp/yson/public.h> + +namespace NJson { + class TJsonValue; +} // namespace NJson + +namespace NYT { + +//////////////////////////////////////////////////////////////////////////////// + +// Parse TNode from string in YSON format +TNode NodeFromYsonString(const TStringBuf input, ::NYson::EYsonType type = ::NYson::EYsonType::Node); + +// Serialize TNode to string in one of YSON formats with random order of maps' keys (don't use in tests) +TString NodeToYsonString(const TNode& node, ::NYson::EYsonFormat format = ::NYson::EYsonFormat::Text); + +// Same as the latter, but maps' keys are sorted lexicographically (to be used in tests) +TString NodeToCanonicalYsonString(const TNode& node, ::NYson::EYsonFormat format = ::NYson::EYsonFormat::Text); + +// Parse TNode from stream in YSON format +TNode NodeFromYsonStream(IInputStream* input, ::NYson::EYsonType type = ::NYson::EYsonType::Node); + +// Serialize TNode to stream in one of YSON formats with random order of maps' keys (don't use in tests) +void NodeToYsonStream(const TNode& node, IOutputStream* output, ::NYson::EYsonFormat format = ::NYson::EYsonFormat::Text); + +// Same as the latter, but maps' keys are sorted lexicographically (to be used in tests) +void NodeToCanonicalYsonStream(const TNode& node, IOutputStream* output, ::NYson::EYsonFormat format = ::NYson::EYsonFormat::Text); + +// Parse TNode from string in JSON format +TNode NodeFromJsonString(const TStringBuf input); + +// Convert TJsonValue to TNode +TNode NodeFromJsonValue(const NJson::TJsonValue& input); + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NYT |