aboutsummaryrefslogtreecommitdiffstats
path: root/util/ysaveload.cpp
blob: 77ac669f0ca46cd544cb30d82147001fdcdfdb45 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "ysaveload.h"
 
#include <util/generic/buffer.h> 
 
void TSerializer<TBuffer>::Save(IOutputStream* rh, const TBuffer& buf) {
    ::SaveSize(rh, buf.Size()); 
    ::SavePodArray(rh, buf.Data(), buf.Size()); 
} 
 
void TSerializer<TBuffer>::Load(IInputStream* rh, TBuffer& buf) {
    const size_t s = ::LoadSize(rh); 
    buf.Resize(s); 
    ::LoadPodArray(rh, buf.Data(), buf.Size()); 
} 

[[noreturn]] void NPrivate::ThrowLoadEOFException(size_t typeSize, size_t realSize, TStringBuf structName) {
    ythrow TLoadEOF() << "can not load " << structName << "(" << typeSize << ", " << realSize << " bytes)";
}

[[noreturn]] void NPrivate::ThrowUnexpectedVariantTagException(ui8 tagIndex) {
    ythrow TLoadEOF() << "Unexpected tag value " << tagIndex << " while loading TVariant";
}