Kactus2
Kactus2 reference guide
Loading...
Searching...
No Matches
LibraryItem.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// File: libraryitem.h
3//-----------------------------------------------------------------------------
4// Project: Kactus 2
5// Author: Antti Kamppi
6// Date: 24.06.2010
7//
8// Description:
9// LibraryItem class is used to create the hierarchical structure of IP library.
10//-----------------------------------------------------------------------------
11
12#ifndef LIBRARYITEM_H
13#define LIBRARYITEM_H
14
15#include <QVector>
16#include <QString>
17#include <QObject>
18
19#include <IPXACTmodels/common/VLNV.h>
20
21#include <KactusAPI/KactusAPIGlobal.h>
22
23//-----------------------------------------------------------------------------
25//-----------------------------------------------------------------------------
26class KACTUS2_API LibraryItem : public QObject
27{
28 Q_OBJECT
29
30public:
31
36 enum class Level
37 {
38 ROOT = 0,
43 };
44
50
57 LibraryItem(VLNV const& vlnv, Level level, LibraryItem *parent);
58
60 virtual ~LibraryItem();
61
67 void createChild(VLNV const& vlnv, Level level);
68
74
79 QString name() const;
80
85 Level getLevel() const;
86
93 LibraryItem* child(int index) const;
94
99 int row();
100
106
113 VLNV getVLNV() const;
114
122
123
128 bool hasChildren() const;
129
134 QVector<VLNV> getVLNVs() const;
135
140 void removeChild(LibraryItem* childItem);
141
153
162 LibraryItem* findHighestUnique(VLNV const& vlnv);
163
170 LibraryItem* findItem(VLNV const& vlnv);
171
176 void setVlnv(VLNV& vlnv);
177
179 void clear();
180
185 QVector<LibraryItem*> getVendors() const;
186
191 QVector<LibraryItem*> getLibraries() const;
192
197 QVector<LibraryItem*> getNames() const;
198
203 QVector<LibraryItem*> getVersions() const;
204
210 bool isValid() const;
211
217 void setValid(bool valid);
218
219private:
220
222 LibraryItem(const LibraryItem &other);
223
225 LibraryItem &operator=(const LibraryItem &other);
226
227
236 LibraryItem* findChildForLevel(Level level, VLNV const& vlnv);
237
238 //-----------------------------------------------------------------------------
239 // Data.
240 //-----------------------------------------------------------------------------
241
243 QString name_;
244
246 Level level_;
247
249 QVector<LibraryItem*> childItems_;
250
252 LibraryItem *parentItem_;
253
255 VLNV vlnv_;
256
257 bool valid_;
258};
259
260#endif // LIBRARYITEM_H
bool hasChildren() const
void setValid(bool valid)
int getIndexOf(LibraryItem *item)
LibraryItem * findHighestUnique(VLNV const &vlnv)
LibraryItem(VLNV const &vlnv, Level level, LibraryItem *parent)
QVector< LibraryItem * > getLibraries() const
LibraryItem * findItem(VLNV const &vlnv)
void setVlnv(VLNV &vlnv)
virtual ~LibraryItem()
The destructor of the class LibraryItem.
int getNumberOfChildren() const
Level getLevel() const
void clear()
Remove the children of this item.
VLNV getVLNV() const
QVector< LibraryItem * > getVendors() const
bool isValid() const
QVector< LibraryItem * > getVersions() const
void removeChild(LibraryItem *childItem)
QVector< VLNV > getVLNVs() const
void createChild(VLNV const &vlnv, Level level)
LibraryItem * findHighestUnique(LibraryItem *childItem=0)
LibraryItem * parent() const
QVector< LibraryItem * > getNames() const
LibraryItem(QObject *parent)
LibraryItem * child(int index) const
QString name() const