• 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
DataStructure.h
Go to the documentation of this file.
1 /*
2  This file is part of Rocs.
3  Copyright 2004-2011 Tomaz Canabrava <tomaz.canabrava@gmail.com>
4  Copyright 2010-2011 Wagner Reck <wagner.reck@gmail.com>
5  Copyright 2011-2012 Andreas Cord-Landwehr <cola@uni-paderborn.de>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public
9  License as published by the Free Software Foundation; either
10  version 2.1 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public
18  License along with this library. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef DATASTRUCTURE_H
22 #define DATASTRUCTURE_H
23 
24 #include <QObject>
25 #include <QList>
26 #include <QString>
27 #include <QtScript>
28 #include <QColor>
29 
30 #include "RocsCoreExport.h"
31 #include "CoreTypes.h"
32 #include "Document.h"
33 
34 class Group;
35 class Document;
36 class Data;
37 class Pointer;
38 class DataStructurePrivate;
39 
43 class ROCSLIB_EXPORT DataStructure : public QObject
44 {
45  Q_OBJECT
46  Q_PROPERTY(QString name READ name WRITE setName)
47 
48  // interal deleter class
49  class deleter;
50  friend class deleter;
51 
52 public:
53  static DataStructurePtr create(Document *parent = 0);
54  static DataStructurePtr create(DataStructurePtr other, Document *parent = 0);
55 
56  virtual DataStructurePtr getDataStructure() const;
57 
58  Document *document() const;
59 
60  void setReadOnly(bool r);
61  bool readOnly() const;
62 
63  QScriptValue scriptValue() const;
64  virtual void setEngine(QScriptEngine *engine);
65  QScriptEngine *engine() const;
66 
71  void updateData(DataPtr data);
72 
77  void updatePointer(PointerPtr pointer);
78 
83  bool isDataVisible(int dataType) const;
84 
89  bool isPointerVisible(int pointerType) const;
90 
91  QString name() const;
92 
99  const DataList dataList(int dataType) const;
100 
105  DataList dataListAll() const;
106 
113  const PointerList pointers(int pointerType) const;
114 
119  PointerList pointerListAll() const;
120 
121  const QList<GroupPtr> groups() const;
122 
125  virtual void cleanUpBeforeConvert();
126 
131  virtual QMap<QString,QString> pluginProperties() const;
132 
138  virtual void setPluginProperty(const QString& /*identifier*/, const QString& /*property*/);
139 
140 public Q_SLOTS:
141  virtual DataPtr createData(const QString& name, int dataType);
142  virtual DataPtr createData(const QString& name, const QPointF& point, int dataType);
143 
148  virtual DataList addDataList(DataList dataList);
149 
158  virtual PointerPtr createPointer(DataPtr from, DataPtr to, int pointerType);
159 
166  DataPtr getData(int uniqueIdentifier);
167 
174  virtual void remove(DataPtr data);
175 
182  virtual void remove(PointerPtr pointer);
183 
190  virtual void remove(GroupPtr group);
191 
192  virtual GroupPtr addGroup(const QString& name);
193  virtual DataList addDataList(QList< QPair<QString, QPointF> > dataList, int dataType);
194 
195  void addDynamicProperty(const QString& property, const QVariant& value = QVariant(0));
196  void removeDynamicProperty(const QString& property);
197  void renameDynamicProperty(const QString& oldName, const QString& newName);
198 
203  void add_property(const QString& name, const QVariant& value);
204 
208  void remove_property(const QString& name);
209 
213  void remove();
214 
215  // setters
216  void setName(const QString& s);
217 
218 private Q_SLOTS:
224  void registerDataType(int identifier);
225 
231  void registerPointerType(int identifier);
232 
238  void removeDataType(int identifier);
239 
245  void removePointerType(int identifier);
246 
247 Q_SIGNALS:
248  void dataCreated(DataPtr n);
249  void dataPositionChanged(const QPointF);
250  void pointerCreated(PointerPtr e);
251  void nameChanged(const QString &name);
252  void changed();
253  void scriptError(const QString &message);
254 
255 protected:
256  DataPtr addData(DataPtr data);
257  PointerPtr addPointer(PointerPtr pointer);
258  int generateUniqueIdentifier();
259 
265  DataStructure(Document *parent = 0);
266 
270  virtual ~DataStructure();
271 
279  virtual void importStructure(DataStructurePtr other);
280 
281  void initialize();
282  template<typename T> static DataStructurePtr create(Document *parent = 0) {
283  DataStructurePtr pi(new T(parent), deleter());
284  pi->setQpointer(pi);
285  pi->initialize();
286  return pi;
287  }
288  template<typename T> static DataStructurePtr create(DataStructurePtr other, Document *parent = 0) {
289  DataStructurePtr pi(new T(parent), deleter());
290  pi->setQpointer(pi);
291  pi->initialize();
292  pi->importStructure(other);
293  return pi;
294  }
295 
296 private:
301  const QScopedPointer<DataStructurePrivate> d;
302 
303  DataStructure(const DataStructure&);
304  DataStructure& operator=(const DataStructure&);
305 
310  void setQpointer(DataStructurePtr q);
311 
316  class deleter
317  {
318  public:
319  void operator()(DataStructure * p) { delete p; }
320  };
321 };
322 
323 #endif
DataStructure
Definition: DataStructure.h:43
DataStructurePtr
boost::shared_ptr< DataStructure > DataStructurePtr
Definition: CoreTypes.h:38
GmlParser::document
Document * document
Definition: GmlGrammar.cpp:40
DotParser::createData
void createData(const std::string &str)
Definition: DotGrammar.cpp:372
DataList
QList< boost::shared_ptr< Data > > DataList
Definition: CoreTypes.h:30
CoreTypes.h
RocsCoreExport.h
QObject
Document.h
PointerPtr
boost::shared_ptr< Pointer > PointerPtr
Definition: CoreTypes.h:35
Document
Definition: Document.h:41
GroupPtr
boost::shared_ptr< Group > GroupPtr
Definition: CoreTypes.h:39
ROCSLIB_EXPORT
#define ROCSLIB_EXPORT
Definition: RocsCoreExport.h:32
DataPtr
boost::shared_ptr< Data > DataPtr
Definition: CoreTypes.h:34
Pointer
Pointers are connections between two nodes in the data structure.
Definition: Pointer.h:48
Data
Definition: Data.h:40
DataStructure::create
static DataStructurePtr create(DataStructurePtr other, Document *parent=0)
Definition: DataStructure.h:288
Group
Definition: Group.h:29
PointerList
QList< boost::shared_ptr< Pointer > > PointerList
Definition: CoreTypes.h:33
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:42:25 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