// // Copyright 2012 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. //
// BinaryStream.h: Provides binary serialization of simple types.
class BinaryOutputStream : angle::NonCopyable
{ public:
BinaryOutputStream();
~BinaryOutputStream();
// writeInt also handles bool types template <class IntT> void writeInt(IntT param)
{
static_assert(std::is_integral<IntT>::value, "Not an integral type");
static_assert(!std::is_same<bool, std::remove_cv<IntT>()>(), "Use writeBool"); using PromotedIntT = typename PromotedIntegerType<IntT>::type;
ASSERT(angle::IsValueInRangeForNumericType<PromotedIntT>(param));
PromotedIntT intValue = static_cast<PromotedIntT>(param);
write(&intValue, 1);
}
// Specialized writeInt for values that can also be exactly -1. template <class UintT> void writeIntOrNegOne(UintT param)
{ if (param == static_cast<UintT>(-1))
{
writeInt(-1);
} else
{
writeInt(param);
}
}
template <class IntT> void writeIntVector(const std::vector<IntT> ¶m)
{
writeInt(param.size()); for (IntT element : param)
{
writeIntOrNegOne(element);
}
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.12Bemerkung:
(vorverarbeitet am 2026-04-27)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.