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

rocs/RocsCore

  • sources
  • kde-4.12
  • kdeedu
  • rocs
  • RocsCore
  • DataStructures
  • LinkedList
ListNode.cpp
Go to the documentation of this file.
1 /*
2  This file is part of Rocs.
3  Copyright 2011 Tomaz Canabrava <tomaz.canabrava@gmail.com>
4  Copyright 2013 Andreas Cord-Landwehr <cordlandwehr@kde.org>
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License as
8  published by the Free Software Foundation; either version 2 of
9  the License, or (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #include "ListNode.h"
21 #include <Pointer.h>
22 #include "KDebug"
23 
24 ListNode::ListNode(DataStructurePtr parent, int uniqueIdentifier, int dataType):
25  Data(parent, uniqueIdentifier, dataType)
26 {
27 }
28 
29 DataPtr ListNode::create(DataStructurePtr parent, int uniqueIdentifier, int dataType)
30 {
31  return Data::create<ListNode>(parent, uniqueIdentifier, dataType);
32 }
33 
34 ListNode::~ListNode()
35 {
36 }
37 
38 void ListNode::pointTo(boost::shared_ptr< ListNode > target)
39 {
40  Q_ASSERT(target);
41  createPointer(boost::static_pointer_cast<Data>(target));
42 }
43 
44 boost::shared_ptr<ListNode> ListNode::next() const
45 {
46  if (outPointerList().count() == 1) {
47  if (boost::shared_ptr<ListNode> n = boost::static_pointer_cast<ListNode>(outPointerList().at(0)->to())) {
48  return n;
49  }
50  }
51  return boost::shared_ptr<ListNode>();
52 }
53 
54 QScriptValue ListNode::nextNodeScriptValue()
55 {
56  if (boost::shared_ptr<ListNode> n = next()) {
57  return n->scriptValue();
58  }
59  return 0;
60 }
ListNode::ListNode
ListNode(DataStructurePtr parent, int uniqueIdentifier, int dataType)
Definition: ListNode.cpp:24
DataStructurePtr
boost::shared_ptr< DataStructure > DataStructurePtr
Definition: CoreTypes.h:38
ListNode.h
ListNode::next
boost::shared_ptr< ListNode > next() const
Return target of out-pointer if exactly one outgoing pointer exists, otherwise returns empty node...
Data::dataType
int dataType() const
Definition: Data.cpp:387
ListNode::create
static DataPtr create(DataStructurePtr parent, int uniqueIdentifier, int dataType)
Definition: ListNode.cpp:29
Data::createPointer
PointerPtr createPointer(DataPtr to)
Create new pointer to to.
Definition: Data.cpp:257
Data::outPointerList
PointerList & outPointerList() const
Definition: Data.cpp:377
Pointer.h
DataPtr
boost::shared_ptr< Data > DataPtr
Definition: CoreTypes.h:34
Data
Definition: Data.h:40
ListNode::nextNodeScriptValue
QScriptValue nextNodeScriptValue()
Definition: ListNode.cpp:54
ListNode::~ListNode
~ListNode()
Definition: ListNode.cpp:34
ListNode::pointTo
Q_INVOKABLE void pointTo(boost::shared_ptr< ListNode > target)
Set outgoing pointer to target.
Definition: ListNode.cpp:38
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:42:26 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

rocs/RocsCore

Skip menu "rocs/RocsCore"
  • 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