• 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
container.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 "container.h"
16 
17 namespace Scripting
18 {
19 
20 Container::Container(KEduVocContainer * container)
21  : QObject(), m_container(container)
22 {
23 
24 }
25 
26 // Container::Container ( const QString& name, EnumContainerType type, KEduVocContainer *parent = 0 )
27 // : QObject()
28 // {
29 // m_container = new KEduVocContainer ( name,type,parent );
30 // }
31 
32 // Container::Container ( const Container &other )
33 // : QObject()
34 // {
35 // m_container = new KEduVocLesson ( other.kEduVocLesson() );
36 // }
37 
38 
39 Container::~Container()
40 {
41 }
42 
43 bool Container::enumToBool(KEduVocContainer::EnumEntriesRecursive recursive)
44 {
45  if (recursive == KEduVocContainer::Recursive)
46  return true;
47  return false;
48 }
49 
50 KEduVocContainer::EnumEntriesRecursive Container::boolToEnum(bool recursive)
51 {
52  if (recursive)
53  return KEduVocContainer::Recursive;
54  return KEduVocContainer::NotRecursive;
55 }
56 
57 QVariantList Container::childContainers()
58 {
59  return toVariantList<KEduVocContainer, Container> (m_container->childContainers());
60 }
61 
62 QList<KEduVocContainer*> Container::flattenContainer(KEduVocContainer * root)
63 {
64  QList<KEduVocContainer*> list;
65  if (root) {
66  list << root;
67  foreach(KEduVocContainer * child, root->childContainers())
68  list += flattenContainer(child);
69  }
70  return list;
71 }
72 
73 KEduVocContainer * Container::findContainer(const QString& name)
74 {
75  QList<KEduVocContainer*> list = flattenContainer(m_container);
76  foreach(KEduVocContainer * container, list)
77  if (container->name() == name)
78  return container;
79  return 0;
80 }
81 
82 
83 }
QObject::child
QObject * child(const char *objName, const char *inheritsClass, bool recursiveSearch) const
Scripting::Container::boolToEnum
static KEduVocContainer::EnumEntriesRecursive boolToEnum(bool recursive)
Definition: container.cpp:50
Scripting::Container::Container
Container(KEduVocContainer *container=0)
Definition: container.cpp:20
Scripting::Container::~Container
~Container()
Definition: container.cpp:39
QObject
Scripting::Container::enumToBool
static bool enumToBool(KEduVocContainer::EnumEntriesRecursive recursive)
Definition: container.cpp:43
Scripting::Container::findContainer
KEduVocContainer * findContainer(const QString &name)
Definition: container.cpp:73
QString
QList< KEduVocContainer * >
Scripting::Container::childContainers
QVariantList childContainers()
Definition: container.cpp:57
container.h
Scripting::Container::m_container
KEduVocContainer * m_container
Definition: container.h:204
Scripting::Container::name
QString name()
Definition: container.h:84
Scripting::Container::flattenContainer
static QList< KEduVocContainer * > flattenContainer(KEduVocContainer *root)
Definition: container.cpp:62
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