• 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
translation.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 "translation.h"
16 
17 namespace Scripting
18 {
19 Translation::Translation(Expression * entry)
20 {
21  m_translation = new KEduVocTranslation(entry->kEduVocExpression());
22  m_text = m_translation;
23 }
24 
25 Translation::Translation(Expression * entry, const QString & translation)
26 {
27  m_translation = new KEduVocTranslation(entry->kEduVocExpression(), translation);
28  m_text = m_translation;
29 }
30 
31 Translation::Translation(KEduVocTranslation * translation)
32  : Text(translation), m_translation(translation)
33 {
34 }
35 
36 Translation::~Translation()
37 {
38 }
39 
40 QString Translation::wordType() const
41 {
42  if (m_translation->wordType())
43  return m_translation->wordType()->name();
44  return QString();
45 }
46 
47 void Translation::setConjugationText(const QString& conjugation, const QString& tense, const KEduVocWordFlags& flags)
48 {
49  KEduVocConjugation & conjug = m_translation->conjugation(tense);
50  conjug.setConjugation(conjugation, flags);
51  m_translation->setConjugation(tense, conjug);
52 }
53 
54 QObject * Translation::conjugation(const QString & tense, const KEduVocWordFlags& flags)
55 {
56  KEduVocConjugation conjug = m_translation->conjugation(tense);
57  return new Text(conjug.conjugation(flags));
58 }
59 
60 void Translation::setConjugation(QObject * conjugation, const QString& tense, const KEduVocWordFlags& flags)
61 {
62  Text * txt = dynamic_cast<Text*>(conjugation);
63  if (txt) {
64  KEduVocConjugation & conjug = m_translation->conjugation(tense);
65  conjug.setConjugation(*(txt->kEduVocText()), flags);
66  m_translation->setConjugation(tense, conjug);
67  }
68 }
69 
70 
71 QStringList Translation::conjugationTexts(const QString& tense)
72 {
73  Q_UNUSED(tense)
74 // KEduVocConjugation conjug = m_translation->conjugation ( tense );
75 
76  QStringList list;
77 
78 // for ( int n = 0; n <= KEduVocConjugation::Plural; n++ )
79 // for ( int p = 0; p <= KEduVocConjugation::ThirdNeutralCommon; p++ )
80 // list << conjug.conjugation ( ( KEduVocConjugation::ConjugationPerson ) p, ( KEduVocConjugation::ConjugationNumber ) n ).text();
81 
82  return list;
83 }
84 
85 QStringList Translation::conjugationTexts(const QString& tense, const KEduVocWordFlags& flags)
86 {
87  Q_UNUSED(tense)
88  Q_UNUSED(flags)
89 // KEduVocConjugation conjug = m_translation->conjugation ( tense );
90 
91  QStringList list;
92 
93 // for ( int p = 0; p <= KEduVocConjugation::ThirdNeutralCommon; p++ )
94 // list << conjug.conjugation ( ( KEduVocConjugation::ConjugationPerson ) p, number ).text();
95 
96  return list;
97 }
98 
99 
100 // QObject * Translation::declension ( KEduVocWordFlag::DeclensionNumber number, KEduVocWordFlag::DeclensionCase decCase )
101 // {
102 // kDebug() << number << decCase;
103 // kDebug() << m_translation->declension();
104 // if ( m_translation->declension() ) {
105 // kDebug() << "in here";
106 // //crashes here!
107 // m_translation->declension()->declension ( number,decCase );
108 // kDebug() << "in here";
109 // return new Text ( m_translation->declension()->declension ( number,decCase ) );
110 // }
111 // else
112 // return new Text ( QString() );
113 // }
114 
115 // void Translation::setDeclension ( const QString& declension, KEduVocWordFlag::DeclensionNumber number, KEduVocWordFlag::DeclensionCase decCase )
116 // {
117 // kDebug() << number << decCase;
118 // KEduVocDeclension * dec = m_translation->declension();
119 // kDebug() << dec;
120 // if ( !dec )
121 // dec = new KEduVocDeclension();
122 // kDebug() << "here";
123 // dec->setDeclension ( KEduVocText ( declension ),number,decCase );
124 // m_translation->setDeclension ( dec );
125 // }
126 
127 }
Scripting::Text::Text
Text(const QString &text=QString())
Definition: text.cpp:20
Scripting::Translation::setConjugation
void setConjugation(QObject *conjugation, const QString &tense, const KEduVocWordFlags &flags)
Sets the conjugation of the verb in the given tense, number and person.
Definition: translation.cpp:60
Scripting::Translation::conjugationTexts
QStringList conjugationTexts(const QString &tense)
Returns all the possible conjugations of the given tense.
Definition: translation.cpp:71
Scripting::Translation::~Translation
~Translation()
Definition: translation.cpp:36
Scripting::Translation::setConjugationText
void setConjugationText(const QString &conjugation, const QString &tense, const KEduVocWordFlags &flags)
Sets the conjugation of the verb in the given tense, number and person.
Definition: translation.cpp:47
Scripting::Text::kEduVocText
KEduVocText * kEduVocText()
Definition: text.h:81
QObject
QString
translation.h
QStringList
Scripting::Text
Scripting::Text class object provides methods and properties for accessing Parley text's value and gr...
Definition: text.h:39
Scripting::Translation::conjugation
QObject * conjugation(const QString &tense, const KEduVocWordFlags &flags)
returns the conjugation of the verb in the given tense, number and person
Definition: translation.cpp:54
Scripting::Text::m_text
KEduVocText * m_text
Definition: text.h:231
Scripting::Translation::Translation
Translation(Expression *entry)
Definition: translation.cpp:19
Scripting::Expression::kEduVocExpression
KEduVocExpression * kEduVocExpression() const
Definition: expression.h:70
Scripting::Expression
This class represents.
Definition: expression.h:35
Scripting::Translation::wordType
QString wordType() const
returns the word type of this expression
Definition: translation.cpp:40
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