Files
integration/Source/Integration/StringDecoder.cpp

26 lines
490 B
C++
Raw Normal View History

#include "StringDecoder.h"
2023-09-08 05:38:09 -04:00
FStringDecoder::FStringDecoder(std::string_view s) {
Text = s.data();
Size = s.size();
ErrBeyondEOF = false;
ErrStringTooLong = false;
}
std::string_view FStringDecoder::read_string_view() {
size_t length = read_length();
if (length > Size) {
ErrBeyondEOF = true;
return std::string_view();
}
std::string_view result(Text, length);
Text += length;
Size -= length;
return result;
}
2023-09-08 05:38:09 -04:00
void FStringDecoder::set_at_eof() {
Text += Size;
Size = 0;
}