File indexing completed on 2024-04-28 07:40:02
0001 /* 0002 This file is part of the KDE Baloo project. 0003 SPDX-FileCopyrightText: 2015 Vishesh Handa <vhanda@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.1-or-later 0006 */ 0007 0008 #include "document.h" 0009 0010 using namespace Baloo; 0011 0012 Document::Document() = default; 0013 0014 void Document::addTerm(const QByteArray& term) 0015 { 0016 Q_ASSERT(!term.isEmpty()); 0017 // This adds "term" without position data if it does not exist, otherwise it is a noop 0018 m_terms[term]; 0019 } 0020 0021 void Document::addPositionTerm(const QByteArray& term, int position) 0022 { 0023 Q_ASSERT(!term.isEmpty()); 0024 TermData& td = m_terms[term]; 0025 td.positions.append(position); 0026 } 0027 0028 void Document::addXattrPositionTerm(const QByteArray& term, int position) 0029 { 0030 Q_ASSERT(!term.isEmpty()); 0031 TermData& td = m_xattrTerms[term]; 0032 td.positions.append(position); 0033 } 0034 0035 void Document::addXattrTerm(const QByteArray& term) 0036 { 0037 Q_ASSERT(!term.isEmpty()); 0038 m_xattrTerms[term]; 0039 } 0040 0041 void Document::addFileNamePositionTerm(const QByteArray& term, int position) 0042 { 0043 Q_ASSERT(!term.isEmpty()); 0044 TermData& td = m_fileNameTerms[term]; 0045 td.positions.append(position); 0046 } 0047 0048 void Document::addFileNameTerm(const QByteArray& term) 0049 { 0050 Q_ASSERT(!term.isEmpty()); 0051 m_fileNameTerms[term]; 0052 } 0053 0054 quint64 Document::id() const 0055 { 0056 return m_id; 0057 } 0058 0059 void Document::setId(quint64 id) 0060 { 0061 Q_ASSERT(id); 0062 m_id = id; 0063 } 0064 0065 quint64 Document::parentId() const 0066 { 0067 return m_parentId; 0068 } 0069 0070 void Document::setParentId(quint64 parentId) 0071 { 0072 Q_ASSERT(parentId); 0073 m_parentId = parentId; 0074 } 0075 0076 void Document::setUrl(const QByteArray& url) 0077 { 0078 Q_ASSERT(!url.isEmpty()); 0079 m_url = url; 0080 } 0081 0082 QByteArray Document::url() const 0083 { 0084 return m_url; 0085 } 0086 0087 bool Document::contentIndexing() const 0088 { 0089 return m_contentIndexing; 0090 } 0091 0092 void Document::setContentIndexing(bool val) 0093 { 0094 m_contentIndexing = val; 0095 } 0096 0097 void Document::setData(const QByteArray& data) 0098 { 0099 m_data = data; 0100 }