• 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
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  {
67  list << root;
68  foreach ( KEduVocContainer * child, root->childContainers() )
69  list += flattenContainer ( child );
70  }
71  return list;
72  }
73 
74  KEduVocContainer * Container::findContainer ( const QString& name )
75  {
76  QList<KEduVocContainer*> list = flattenContainer(m_container);
77  foreach (KEduVocContainer * container, list)
78  if (container->name() == name)
79  return container;
80  return 0;
81  }
82 
83 
84 }
Scripting::Container::boolToEnum
static KEduVocContainer::EnumEntriesRecursive boolToEnum(bool recursive)
Definition: container.cpp:50
Scripting::Container::Container
Container(KEduVocContainer *container=0)
Definition: container.cpp:20
QObject
Scripting::Container::~Container
~Container()
Definition: container.cpp:39
Scripting::Container::enumToBool
static bool enumToBool(KEduVocContainer::EnumEntriesRecursive recursive)
Definition: container.cpp:43
Scripting::Container::findContainer
KEduVocContainer * findContainer(const QString &name)
Definition: container.cpp:74
Scripting::Container::childContainers
QVariantList childContainers()
Definition: container.cpp:57
container.h
Scripting::Container::m_container
KEduVocContainer * m_container
Definition: container.h:168
Scripting::Container::name
QString name()
Definition: container.h:80
Scripting::Container::flattenContainer
static QList< KEduVocContainer * > flattenContainer(KEduVocContainer *root)
Definition: container.cpp:62
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