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

parley

  • sources
  • kde-4.14
  • kdeedu
  • parley
  • src
  • scripts
  • scripting
expression.cpp
Go to the documentation of this file.
1 /***************************************************************************
2 
3  Copyright 2008 Avgoustinos Kadis <avgoustinos.kadis@kdemail.net>
4 
5  ***************************************************************************/
6 
7 /***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #include "expression.h"
16 #include "translation.h"
17 
18 namespace Scripting
19 {
20 
21 Expression::Expression()
22 {
23  m_expression = new KEduVocExpression();
24 }
25 
26 Expression::Expression(const QString & expression)
27 {
28  m_expression = new KEduVocExpression(expression);
29 }
30 
31 Expression::Expression(const QStringList & translations)
32 {
33  m_expression = new KEduVocExpression(translations);
34 }
35 
36 Expression::Expression(KEduVocExpression * expression)
37  : QObject(), m_expression(expression)
38 {
39 }
40 
41 Expression::Expression(const Expression & other) : QObject()
42 {
43  m_expression = other.kEduVocExpression();
44 }
45 
46 Expression::~Expression()
47 {
48 }
49 
50 QVariantList Expression::translationIndices() const
51 {
52  QVariantList vlist;
53  foreach(int k, m_expression->translationIndices()) {
54  vlist.push_back(QVariant(k));
55  }
56  return vlist;
57 }
58 
59 QVariantList Expression::translations() const
60 {
61  //build a list of all the translations
62  QList<KEduVocTranslation *> translations;
63  foreach(int k, m_expression->translationIndices()) {
64  if (m_expression->translation(k))
65  translations.push_back(m_expression->translation(k));
66  }
67  //convert it to QVariantList and return it
68  return toVariantList<KEduVocTranslation, Translation> (translations);
69 }
70 
71 QStringList Expression::translationTexts() const
72 {
73  //build a list of all the translation texts
74  QStringList list;
75  foreach(int k, m_expression->translationIndices()) {
76  if (m_expression->translation(k))
77  list << m_expression->translation(k)->text();
78  }
79  return list;
80 }
81 
82 // Expression & Expression::operator= ( const Expression &other )
83 // {
84 // m_expression = other.kEduVocEntry();
85 // return ( *this );
86 // }
87 
88 // bool Expression::operator== ( const Expression &other ) const
89 // {
90 // return m_expression == other.kEduVocEntry();
91 // }
92 
93 // void Expression::setTranslation( int index, QObject* translation ) {
94 // Translation * t = dynamic_cast<Translation*>(translation);
95 // m_expression->setTranslation(index,t->kEduVocTranslation());
96 // }
97 
98 void Expression::setTranslations(QStringList translations)
99 {
100  delete m_expression;
101  m_expression = new KEduVocExpression(translations);
102 }
103 
104 QObject* Expression::translation(int index) const
105 {
106  return new Translation(m_expression->translation(index));
107 }
108 }
109 
110 
QList::push_back
void push_back(const T &value)
Scripting::Expression::translationIndices
QVariantList translationIndices() const
Returns a list of integers (the translation indices)
Definition: expression.cpp:50
Scripting::Expression::translation
QObject * translation(int index) const
Get the translation of a specified index (translation index)
Definition: expression.cpp:104
Scripting::Translation
KEduVocTranslation wrapper class for scripting with Kross.
Definition: translation.h:36
Scripting::Expression::translations
QVariantList translations() const
Returns a list of all the translations of an entry.
Definition: expression.cpp:59
QObject
expression.h
Scripting::Expression::setTranslations
void setTranslations(QStringList translations)
Sets the translations of an entry.
Definition: expression.cpp:98
QString
QList< KEduVocTranslation * >
Scripting::Expression::translationTexts
QStringList translationTexts() const
Returns a list of all the translations texts of an entry.
Definition: expression.cpp:71
translation.h
QStringList
Scripting::Expression::Expression
Expression()
Definition: expression.cpp:21
Scripting::Expression::~Expression
~Expression()
Definition: expression.cpp:46
Scripting::Expression::kEduVocExpression
KEduVocExpression * kEduVocExpression() const
Definition: expression.h:70
Scripting::Expression
This class represents.
Definition: expression.h:35
QVariant
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:15:56 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

parley

Skip menu "parley"
  • 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
  • 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