aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/scheme/util/utils.cpp
blob: 3e4e36fd3d81a1c89f9dd346e579b69a2efc8ed0 (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
#include "utils.h"

#include <library/cpp/string_utils/base64/base64.h> 

namespace NScUtils {

void CopyField(const NSc::TValue& from, NSc::TValue& to) {
    to = from;
}

} // namespace NScUtils

void TSerializer<NSc::TValue>::Save(IOutputStream* out, const NSc::TValue& v) {
    TString json = Base64Encode(v.ToJson());
    ::Save(out, json);
}

void TSerializer<NSc::TValue>::Load(IInputStream* in, NSc::TValue& v) {
    TString json;
    ::Load(in, json);
    json = Base64Decode(json);
    v = NSc::TValue::FromJsonThrow(json);
}