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

libkdeedu/keduvocdocument

  • sources
  • kde-4.12
  • kdeedu
  • libkdeedu
  • keduvocdocument
keduvocmultiplechoice.cpp
Go to the documentation of this file.
1 /***************************************************************************
2 
3  manage multiple choice suggestions for queries
4 
5  -----------------------------------------------------------------------
6 
7  begin : Mon Oct 29 18:09:29 1999
8 
9  copyright : (C) 1999-2001 Ewald Arnold <kvoctrain@ewald-arnold.de>
10 
11  (C) 2005 Peter Hedlund <peter.hedlund@kdemail.net>
12 
13  -----------------------------------------------------------------------
14 
15  ***************************************************************************/
16 
17 /***************************************************************************
18  * *
19  * This program is free software; you can redistribute it and/or modify *
20  * it under the terms of the GNU General Public License as published by *
21  * the Free Software Foundation; either version 2 of the License, or *
22  * (at your option) any later version. *
23  * *
24  ***************************************************************************/
25 
26 #include "keduvocmultiplechoice.h"
27 
28 class KEduVocMultipleChoice::KEduVocMultipleChoicePrivate
29 {
30 public:
31  QStringList m_choices;
32 };
33 
34 KEduVocMultipleChoice::KEduVocMultipleChoice()
35  : d( new KEduVocMultipleChoicePrivate )
36 {}
37 
38 KEduVocMultipleChoice::KEduVocMultipleChoice( const KEduVocMultipleChoice &other )
39  : d( new KEduVocMultipleChoicePrivate )
40 {
41  d->m_choices = other.choices();
42 }
43 
44 KEduVocMultipleChoice::KEduVocMultipleChoice( const QStringList &choices )
45  : d( new KEduVocMultipleChoicePrivate )
46 {
47  foreach ( const QString &choice, choices ) {
48  // use appendChoice to check for empty entries
49  appendChoice(choice);
50  }
51 }
52 
53 KEduVocMultipleChoice::~KEduVocMultipleChoice()
54 {
55  delete d;
56 }
57 
58 KEduVocMultipleChoice &KEduVocMultipleChoice::operator= ( const KEduVocMultipleChoice &other )
59 {
60  d->m_choices = other.choices();
61  return *this;
62 }
63 
64 QStringList KEduVocMultipleChoice::choices() const
65 {
66  return d->m_choices;
67 }
68 
69 bool KEduVocMultipleChoice::isEmpty() const
70 {
71  return d->m_choices.isEmpty();
72 }
73 
74 
75 void KEduVocMultipleChoice::clear()
76 {
77  d->m_choices.clear();
78 }
79 
80 
81 QString KEduVocMultipleChoice::choice( int index ) const
82 {
83  QString choice;
84  if ( d->m_choices.size() > index ) {
85  choice = d->m_choices[index];
86  }
87  return choice;
88 }
89 
90 unsigned KEduVocMultipleChoice::size() const
91 {
92  return d->m_choices.size();
93 }
94 
95 bool KEduVocMultipleChoice::operator== ( const KEduVocMultipleChoice &choice ) const
96 {
97  return d->m_choices == choice.choices();
98 }
99 
100 void KEduVocMultipleChoice::appendChoice( const QString &s )
101 {
102  if ( !s.isEmpty() ) {
103  d->m_choices.append( s );
104  }
105 }
KEduVocMultipleChoice::appendChoice
void appendChoice(const QString &s)
Definition: keduvocmultiplechoice.cpp:100
KEduVocMultipleChoice::operator=
KEduVocMultipleChoice & operator=(const KEduVocMultipleChoice &other)
Definition: keduvocmultiplechoice.cpp:58
KEduVocMultipleChoice::clear
void clear()
Definition: keduvocmultiplechoice.cpp:75
KEduVocMultipleChoice::choice
QString choice(int index) const
Definition: keduvocmultiplechoice.cpp:81
KEduVocMultipleChoice::~KEduVocMultipleChoice
~KEduVocMultipleChoice()
Definition: keduvocmultiplechoice.cpp:53
KEduVocMultipleChoice::isEmpty
bool isEmpty() const
Definition: keduvocmultiplechoice.cpp:69
keduvocmultiplechoice.h
KEduVocMultipleChoice::operator==
bool operator==(const KEduVocMultipleChoice &choice) const
Definition: keduvocmultiplechoice.cpp:95
KEduVocMultipleChoice
Definition: keduvocmultiplechoice.h:34
KEduVocMultipleChoice::choices
QStringList choices() const
Definition: keduvocmultiplechoice.cpp:64
KEduVocMultipleChoice::size
unsigned size() const
Definition: keduvocmultiplechoice.cpp:90
KEduVocMultipleChoice::KEduVocMultipleChoice
KEduVocMultipleChoice()
Definition: keduvocmultiplechoice.cpp:34
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:37:21 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkdeedu/keduvocdocument

Skip menu "libkdeedu/keduvocdocument"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

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