Baloo

postingcodec.cpp
1/*
2 This file is part of the KDE Baloo project.
3 SPDX-FileCopyrightText: 2015 Vishesh Handa <vhanda@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.1-or-later
6*/
7
8#include "postingcodec.h"
9
10using namespace Baloo;
11
12QByteArray PostingCodec::encode(const QVector<quint64>& list)
13{
14 uint size = list.size() * sizeof(quint64);
15 const char* ptr = reinterpret_cast<const char*>(list.constData());
16
17 return QByteArray(ptr, size);
18}
19
20QVector<quint64> PostingCodec::decode(const QByteArray& arr)
21{
23 vec.resize(arr.size() / sizeof(quint64));
24
25 memcpy(vec.data(), arr.constData(), arr.size());
26 return vec;
27}
Implements storage for docIds without any associated data Instantiated for:
Definition coding.cpp:11
KIOCORE_EXPORT QStringList list(const QString &fileClass)
const char * constData() const const
qsizetype size() const const
const_pointer constData() const const
pointer data()
void resize(qsizetype size)
qsizetype size() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 24 2024 11:54:09 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.