Пример #1
0
void LLVOCacheEntry::writeToFile(LLFILE *fp) const
{
	checkedWrite(fp, &mLocalID, sizeof(U32));
	checkedWrite(fp, &mCRC, sizeof(U32));
	checkedWrite(fp, &mHitCount, sizeof(S32));
	checkedWrite(fp, &mDupeCount, sizeof(S32));
	checkedWrite(fp, &mCRCChangeCount, sizeof(S32));
	S32 size = mDP.getBufferSize();
	checkedWrite(fp, &size, sizeof(S32));
	checkedWrite(fp, mBuffer, size);
}
bool BinaryOutputStreamSerializer::binary(void* value, size_t size, Common::StringView name) {
  checkedWrite(static_cast<const char*>(value), size);
  return true;
}
bool BinaryOutputStreamSerializer::operator()(std::string& value, Common::StringView name) {
  writeVarint(stream, value.size());
  checkedWrite(value.data(), value.size());
  return true;
}
bool BinaryOutputStreamSerializer::operator()(bool& value, Common::StringView name) {
  char boolVal = value;
  checkedWrite(&boolVal, 1);
  return true;
}
ISerializer& BinaryOutputStreamSerializer::binary(void* value, std::size_t size, const std::string& name) {
  checkedWrite(static_cast<const char*>(value), size);
  return *this;
}
ISerializer& BinaryOutputStreamSerializer::operator()(std::string& value, const std::string& name) {
  writeVarint(stream, value.size());
  checkedWrite(value.data(), value.size());
  return *this;
}
ISerializer& BinaryOutputStreamSerializer::operator()(bool& value, const std::string& name) {
  char boolVal = value;
  checkedWrite(&boolVal, 1);
  return *this;
}