Files
thehub/libs/utils/streaming/StreamingUtils.h

37 lines
1.2 KiB
C++

/*
* This file is part of the Flowee project
* Copyright (C) 2016,2018-2025 Tom Zander <tom@flowee.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef StreamingUtils_H
#define StreamingUtils_H
#include <cstdint>
#include <string>
#include <vector>
namespace Streaming
{
int writeCompactSize(char *data, uint64_t value);
/// return the compact size int from a bytearray.
/// Fails on there not being enough bytes available by simply
/// returning zero and setting the data pointer to match \a end.
uint64_t readCompactSize(const char **data, const char *end);
std::string bytesToHex(const std::vector<char> &bytes);
}
#endif