File indexing completed on 2024-05-12 15:59:59
0001 /* This file is part of the KDE project 0002 SPDX-FileCopyrightText: 2005-2006 Ariya Hidayat <ariya@kde.org> 0003 SPDX-FileCopyrightText: 2015 Friedrich W. H. Kossebau <kossebau@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef KO_LZF_H 0009 #define KO_LZF_H 0010 0011 class QByteArray; 0012 0013 namespace KoLZF 0014 { 0015 0016 /** 0017 * @param input where to read the data to compress from 0018 * @param length length of the input 0019 * @param output where to write the compressed data to 0020 * @param maxout maximal usable length of output, needs to be at least 2 bytes 0021 * @return the length of data written to output, or, on failure, 0 0022 */ 0023 int compress(const void* input, int length, void* output, int maxout); 0024 0025 /** 0026 * @param input where to read the data to decompress from 0027 * @param length length of the input 0028 * @param output where to write the decompressed data to 0029 * @param maxout maximal usable length of output 0030 * @return the length of data written to output, or, on failure, 0 0031 */ 0032 int decompress(const void* input, int length, void* output, int maxout); 0033 0034 /** 0035 * @param data the data to compress 0036 * @return the compressed data (with KoLZF header) 0037 */ 0038 QByteArray compress(const QByteArray& data); 0039 0040 /** 0041 * @param data the data to decompress (with KoLZF header) 0042 * @param output where to write the decompressed data to 0043 * Existing content will be lost. 0044 * On failure will be an empty QByteArray. 0045 */ 0046 void decompress(const QByteArray &data, QByteArray &output); 0047 0048 } 0049 0050 #endif