• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Nepomuk-Core

  • sources
  • kde-4.12
  • kdelibs
  • nepomuk-core
  • libnepomukcore
  • query
groupterm.cpp
Go to the documentation of this file.
1 /*
2  This file is part of the Nepomuk KDE project.
3  Copyright (C) 2009-2010 Sebastian Trueg <trueg@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) version 3, or any
9  later version accepted by the membership of KDE e.V. (or its
10  successor approved by the membership of KDE e.V.), which shall
11  act as a proxy defined in Section 6 of version 3 of the license.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #include "groupterm.h"
23 #include "groupterm_p.h"
24 #include "util.h"
25 
26 #include <QtCore/QStringList>
27 
28 bool Nepomuk2::Query::GroupTermPrivate::equals( const TermPrivate* other ) const
29 {
30  if ( other->m_type == m_type ) {
31  const GroupTermPrivate* gtp = static_cast<const GroupTermPrivate*>( other );
32  return compareQList( gtp->m_subTerms, m_subTerms );
33  }
34  else {
35  return false;
36  }
37 }
38 
39 
40 bool Nepomuk2::Query::GroupTermPrivate::isValid() const
41 {
42  if ( m_subTerms.count() ) {
43  foreach( const Term& t, m_subTerms ) {
44  if ( !t.isValid() )
45  return false;
46  }
47  return true;
48  }
49  else {
50  return false;
51  }
52 }
53 
54 
55 Nepomuk2::Query::GroupTerm::GroupTerm( const Term& term )
56  : Term( term )
57 {
58 }
59 
60 
61 Nepomuk2::Query::GroupTerm::GroupTerm( TermPrivate* d )
62  : Term( d )
63 {
64 }
65 
66 
67 Nepomuk2::Query::GroupTerm::GroupTerm( TermPrivate* d,
68  const Term& term1,
69  const Term& term2,
70  const Term& term3,
71  const Term& term4,
72  const Term& term5,
73  const Term& term6 )
74  : Term( d )
75 {
76  addSubTerm( term1 );
77  addSubTerm( term2 );
78  if ( term3.isValid() )
79  addSubTerm( term3 );
80  if ( term4.isValid() )
81  addSubTerm( term4 );
82  if ( term5.isValid() )
83  addSubTerm( term5 );
84  if ( term6.isValid() )
85  addSubTerm( term6 );
86 }
87 
88 
89 Nepomuk2::Query::GroupTerm::~GroupTerm()
90 {
91 }
92 
93 
94 QList<Nepomuk2::Query::Term> Nepomuk2::Query::GroupTerm::subTerms() const
95 {
96  N_D_CONST( GroupTerm );
97  return d->m_subTerms;
98 }
99 
100 
101 void Nepomuk2::Query::GroupTerm::setSubTerms( const QList<Term>& terms )
102 {
103  N_D( GroupTerm );
104  d->m_subTerms = terms;
105 }
106 
107 
108 void Nepomuk2::Query::GroupTerm::addSubTerm( const Term& term )
109 {
110  N_D( GroupTerm );
111  d->m_subTerms << term;
112 }
groupterm.h
util.h
Nepomuk2::Query::Term
The base class for all term types.
Definition: term.h:64
Nepomuk2::Query::GroupTerm
Abstract base class for AndTerm and OrTerm which maintains a list of sub-terms.
Definition: groupterm.h:41
Nepomuk2::Query::GroupTerm::subTerms
QList< Term > subTerms() const
The sub terms that are combined in this group.
Definition: groupterm.cpp:94
Nepomuk2::Query::GroupTerm::setSubTerms
void setSubTerms(const QList< Term > &terms)
Set the sub terms that are combined in this group.
Definition: groupterm.cpp:101
Nepomuk2::Query::GroupTerm::~GroupTerm
~GroupTerm()
Destructor.
Definition: groupterm.cpp:89
Nepomuk2::Query::GroupTerm::addSubTerm
void addSubTerm(const Term &term)
Add a sub term to the list of terms that are combined in this group.
Definition: groupterm.cpp:108
compareQList
bool compareQList(const QList< T > &rp1, const QList< T > &rp2)
Definition: libnepomukcore/query/util.h:27
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Nepomuk-Core

Skip menu "Nepomuk-Core"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal