Format all C++ and Java code via clang-format

Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
Konstantin Pastbin
2025-08-17 14:32:37 +07:00
parent 9f0290c0ec
commit bfffa1fff4
2169 changed files with 56441 additions and 64188 deletions

View File

@@ -1,7 +1,7 @@
#pragma once
#include "coding/streams_common.hpp"
#include "coding/reader.hpp"
#include "coding/streams_common.hpp"
#include "coding/write_to_sink.hpp"
#include <cstdint>
@@ -10,73 +10,75 @@
namespace stream
{
template <class TReader> class SinkReaderStream
template <class TReader>
class SinkReaderStream
{
TReader & m_reader;
public:
SinkReaderStream(TReader & reader) : m_reader(reader) {}
template <typename T>
std::enable_if_t<std::is_integral<T>::value, SinkReaderStream &> operator>>(T & t)
{
TReader & m_reader;
t = ReadPrimitiveFromSource<T>(m_reader);
return (*this);
}
public:
SinkReaderStream(TReader & reader) : m_reader(reader) {}
template <typename T>
std::enable_if_t<std::is_integral<T>::value, SinkReaderStream &> operator>>(T & t)
{
t = ReadPrimitiveFromSource<T>(m_reader);
return (*this);
}
SinkReaderStream & operator >> (bool & t)
{
detail::ReadBool(*this, t);
return *this;
}
SinkReaderStream & operator >> (string & t)
{
detail::ReadString(*this, t);
return *this;
}
SinkReaderStream & operator >> (double & t)
{
static_assert(sizeof(double) == sizeof(int64_t), "");
int64_t * tInt = reinterpret_cast<int64_t *>(&t);
operator >> (*tInt);
return *this;
}
};
template <class TWriter> class SinkWriterStream
SinkReaderStream & operator>>(bool & t)
{
TWriter & m_writer;
detail::ReadBool(*this, t);
return *this;
}
public:
SinkWriterStream(TWriter & writer) : m_writer(writer) {}
SinkReaderStream & operator>>(string & t)
{
detail::ReadString(*this, t);
return *this;
}
template <typename T>
std::enable_if_t<std::is_integral<T>::value, SinkWriterStream &> operator<<(T const & t)
{
WriteToSink(m_writer, t);
return (*this);
}
SinkReaderStream & operator>>(double & t)
{
static_assert(sizeof(double) == sizeof(int64_t), "");
int64_t * tInt = reinterpret_cast<int64_t *>(&t);
operator>>(*tInt);
return *this;
}
};
SinkWriterStream & operator << (bool t)
{
detail::WriteBool(*this, t);
return (*this);
}
template <class TWriter>
class SinkWriterStream
{
TWriter & m_writer;
SinkWriterStream & operator<<(std::string const & t)
{
detail::WriteString(*this, m_writer, t);
return *this;
}
public:
SinkWriterStream(TWriter & writer) : m_writer(writer) {}
SinkWriterStream & operator << (double t)
{
static_assert(sizeof(double) == sizeof(int64_t), "");
int64_t const tInt = *reinterpret_cast<int64_t const *>(&t);
operator << (tInt);
return (*this);
}
};
}
template <typename T>
std::enable_if_t<std::is_integral<T>::value, SinkWriterStream &> operator<<(T const & t)
{
WriteToSink(m_writer, t);
return (*this);
}
SinkWriterStream & operator<<(bool t)
{
detail::WriteBool(*this, t);
return (*this);
}
SinkWriterStream & operator<<(std::string const & t)
{
detail::WriteString(*this, m_writer, t);
return *this;
}
SinkWriterStream & operator<<(double t)
{
static_assert(sizeof(double) == sizeof(int64_t), "");
int64_t const tInt = *reinterpret_cast<int64_t const *>(&t);
operator<<(tInt);
return (*this);
}
};
} // namespace stream