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

parley

  • sources
  • kde-4.12
  • 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  {
55  vlist.push_back ( QVariant ( k ) );
56  }
57  return vlist;
58  }
59 
60  QVariantList Expression::translations() const
61  {
62  //build a list of all the translations
63  QList<KEduVocTranslation *> translations;
64  foreach ( int k, m_expression->translationIndices() )
65  {
66  if ( m_expression->translation ( k ) )
67  translations.push_back ( m_expression->translation ( k ) );
68  }
69  //convert it to QVariantList and return it
70  return toVariantList<KEduVocTranslation,Translation> ( translations );
71  }
72 
73  QStringList Expression::translationTexts() const
74  {
75  //build a list of all the translation texts
76  QStringList list;
77  foreach ( int k, m_expression->translationIndices() )
78  {
79  if ( m_expression->translation ( k ) )
80  list << m_expression->translation(k)->text();
81  }
82  return list;
83  }
84 
85 // Expression & Expression::operator= ( const Expression &other )
86 // {
87 // m_expression = other.kEduVocEntry();
88 // return ( *this );
89 // }
90 
91 // bool Expression::operator== ( const Expression &other ) const
92 // {
93 // return m_expression == other.kEduVocEntry();
94 // }
95 
96 // void Expression::setTranslation( int index, QObject* translation ) {
97 // Translation * t = dynamic_cast<Translation*>(translation);
98 // m_expression->setTranslation(index,t->kEduVocTranslation());
99 // }
100 
101  void Expression::setTranslations ( QStringList translations )
102  {
103  delete m_expression;
104  m_expression = new KEduVocExpression ( translations );
105  }
106 
107  QObject* Expression::translation ( int index ) const
108  {
109  return new Translation ( m_expression->translation ( index ) );
110  }
111 }
112 
113 
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:107
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:60
QObject
expression.h
Scripting::Expression::setTranslations
void setTranslations(QStringList translations)
Sets the translations of an entry.
Definition: expression.cpp:101
Scripting::Expression::translationTexts
QStringList translationTexts() const
Returns a list of all the translations texts of an entry.
Definition: expression.cpp:73
translation.h
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
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:42:05 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
  • 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