Baloo

document.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 "document.h"
9
10using namespace Baloo;
11
12Document::Document() = default;
13
14void Document::addTerm(const QByteArray& term)
15{
16 Q_ASSERT(!term.isEmpty());
17 // This adds "term" without position data if it does not exist, otherwise it is a noop
18 m_terms[term];
19}
20
21void Document::addPositionTerm(const QByteArray& term, int position)
22{
23 Q_ASSERT(!term.isEmpty());
24 TermData& td = m_terms[term];
25 td.positions.append(position);
26}
27
28void Document::addXattrPositionTerm(const QByteArray& term, int position)
29{
30 Q_ASSERT(!term.isEmpty());
31 TermData& td = m_xattrTerms[term];
32 td.positions.append(position);
33}
34
35void Document::addXattrTerm(const QByteArray& term)
36{
37 Q_ASSERT(!term.isEmpty());
38 m_xattrTerms[term];
39}
40
41void Document::addFileNamePositionTerm(const QByteArray& term, int position)
42{
43 Q_ASSERT(!term.isEmpty());
44 TermData& td = m_fileNameTerms[term];
45 td.positions.append(position);
46}
47
48void Document::addFileNameTerm(const QByteArray& term)
49{
50 Q_ASSERT(!term.isEmpty());
51 m_fileNameTerms[term];
52}
53
54quint64 Document::id() const
55{
56 return m_id;
57}
58
59void Document::setId(quint64 id)
60{
61 Q_ASSERT(id);
62 m_id = id;
63}
64
65quint64 Document::parentId() const
66{
67 return m_parentId;
68}
69
70void Document::setParentId(quint64 parentId)
71{
72 Q_ASSERT(parentId);
73 m_parentId = parentId;
74}
75
76void Document::setUrl(const QByteArray& url)
77{
78 Q_ASSERT(!url.isEmpty());
79 m_url = url;
80}
81
82QByteArray Document::url() const
83{
84 return m_url;
85}
86
87bool Document::contentIndexing() const
88{
89 return m_contentIndexing;
90}
91
92void Document::setContentIndexing(bool val)
93{
94 m_contentIndexing = val;
95}
96
97void Document::setData(const QByteArray& data)
98{
99 m_data = data;
100}
Implements storage for docIds without any associated data Instantiated for:
Definition coding.cpp:11
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:51:09 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.