QCAD
Open Source 2D CAD
RLinkedStorage.h
Go to the documentation of this file.
1 
20 #ifndef RLINKEDSTORAGE_H_
21 #define RLINKEDSTORAGE_H_
22 
23 #include "core_global.h"
24 
25 #include <QSharedPointer>
26 
27 #include "RMemoryStorage.h"
28 #include "RBlockReferenceEntity.h"
29 
40 public:
41  RLinkedStorage(RStorage& backStorage);
42  virtual ~RLinkedStorage();
43 
44  virtual void clear();
45 
46  virtual QSet<RObject::Id> queryAllObjects();
47  virtual QSet<REntity::Id> queryAllVisibleEntities();
48  virtual QSet<REntity::Id> queryAllEntities(bool undone = false, bool allBlocks = false, RS::EntityType type = RS::EntityAll);
49  virtual QSet<REntity::Id> queryAllEntities(bool undone, bool allBlocks, QList<RS::EntityType> types);
50  virtual QSet<RUcs::Id> queryAllUcs();
51  virtual QSet<RLayer::Id> queryAllLayers(bool undone = false);
52  virtual QSet<RBlock::Id> queryAllBlocks(bool undone = false);
53  virtual QSet<RBlock::Id> queryAllLayoutBlocks(bool undone = false);
54  virtual QSet<RView::Id> queryAllViews(bool undone = false);
55  virtual QSet<RLinetype::Id> queryAllLinetypes();
56  virtual QSet<REntity::Id> queryInfiniteEntities();
57  virtual QSet<REntity::Id> querySelectedEntities() const;
58 
59  virtual QSet<REntity::Id> queryLayerEntities(RLayer::Id layerId, bool allBlocks = false);
60  virtual bool hasBlockEntities(RBlock::Id blockId) const;
61  virtual QSet<REntity::Id> queryBlockEntities(RBlock::Id blockId);
62  virtual QSet<REntity::Id> queryLayerBlockEntities(RLayer::Id layerId, RBlock::Id blockId);
63  virtual QSet<REntity::Id> queryChildEntities(REntity::Id parentId, RS::EntityType type = RS::EntityAll);
64  virtual bool hasChildEntities(REntity::Id parentId);
65  virtual QSet<REntity::Id> queryBlockReferences(RBlock::Id blockId);
66  virtual QSet<REntity::Id> queryAllBlockReferences();
67 
68  QSharedPointer<RDocumentVariables> queryDocumentVariablesDirect() const;
69  QSharedPointer<RDocumentVariables> queryDocumentVariables() const;
70 
71  //virtual QSharedPointer<RDocumentVariables> queryDocumentVariables() const;
72  virtual QSharedPointer<RObject> queryObjectDirect(RObject::Id objectId) const;
73  virtual QSharedPointer<RObject> queryObject(RObject::Id objectId) const;
74  virtual QSharedPointer<RObject> queryObjectByHandle(RObject::Handle objectHandle) const;
75 
76  virtual QSharedPointer<REntity> queryEntityDirect(REntity::Id objectId) const;
77  virtual QSharedPointer<REntity> queryEntity(REntity::Id objectId) const;
78 
79  virtual QSharedPointer<RLayer> queryLayerDirect(RLayer::Id layerId) const;
80  virtual QSharedPointer<RLayer> queryLayer(RLayer::Id layerId) const;
81  virtual QSharedPointer<RLayer> queryLayer(const QString& layerName) const;
82 
83  virtual QSharedPointer<RLayout> queryLayoutDirect(RLayout::Id layoutId) const;
84  virtual QSharedPointer<RLayout> queryLayout(RLayout::Id layoutId) const;
85  virtual QSharedPointer<RLayout> queryLayout(const QString& layoutName) const;
86 
87  virtual QSharedPointer<RBlock> queryBlockDirect(RBlock::Id blockId) const;
88  virtual QSharedPointer<RBlock> queryBlock(RBlock::Id blockId) const;
89  virtual QSharedPointer<RBlock> queryBlock(const QString& blockName) const;
90 
91  virtual QSharedPointer<RView> queryView(RView::Id viewId) const;
92  virtual QSharedPointer<RView> queryView(const QString& viewName) const;
93 
94  virtual QSharedPointer<RUcs> queryUcsDirect(RUcs::Id ucsId) const;
95  virtual QSharedPointer<RUcs> queryUcs(RUcs::Id ucsId) const;
96  virtual QSharedPointer<RUcs> queryUcs(const QString& ucsName) const;
97 
98  virtual QSharedPointer<RLinetype> queryLinetypeDirect(RLinetype::Id linetypeId) const;
99  virtual QSharedPointer<RLinetype> queryLinetype(RLinetype::Id linetypeId) const;
100  virtual QSharedPointer<RLinetype> queryLinetype(const QString& linetypeName) const;
101 
102  virtual QString getLayerName(RLayer::Id layerId) const;
103  virtual QSet<QString> getLayerNames(const QString& rxStr = RDEFAULT_QSTRING) const;
104  virtual RLayer::Id getLayerId(const QString& layerName) const;
105 
106  virtual QString getLayoutName(RLayout::Id layoutId) const;
107  virtual QSet<QString> getLayoutNames(const QString& rxStr = RDEFAULT_QSTRING) const;
108  virtual RLayout::Id getLayoutId(const QString& layoutName) const;
109 
110  virtual QString getBlockName(RBlock::Id blockId) const;
111  virtual QSet<QString> getBlockNames(const QString& rxStr = RDEFAULT_QSTRING) const;
112  virtual RBlock::Id getBlockId(const QString& blockName) const;
113 
114  virtual QString getViewName(RView::Id viewId) const;
115  virtual QSet<QString> getViewNames() const;
116  virtual RView::Id getViewId(const QString& viewName) const;
117 
118  virtual QString getLinetypeName(RLinetype::Id linetypeId) const;
119  virtual QString getLinetypeDescription(RLinetype::Id linetypeId) const;
120  virtual QString getLinetypeLabel(RLinetype::Id linetypeId) const;
121  virtual QSet<QString> getLinetypeNames() const;
122  virtual QList<RLinetypePattern> getLinetypePatterns() const;
123  virtual RLinetype::Id getLinetypeId(const QString& linetypeName) const;
124 
125 
126  virtual RObject::Id getNewObjectId();
128 
129  virtual RLayer::Id getCurrentLayerId() const;
130  virtual RBlock::Id getCurrentBlockId() const;
131  virtual RView::Id getCurrentViewId() const;
132  virtual RColor getCurrentColor() const;
134  virtual RLinetype::Id getCurrentLinetypeId() const;
135 
136  virtual bool deleteObject(RObject::Id objectId);
137  virtual bool setUndoStatus(RObject::Id objectId, bool status);
138  virtual QString getDimensionFont() const;
139 
140  virtual QVariant getKnownVariable(RS::KnownVariable key) const;
141 
142  virtual bool isInBackStorage(RObject::Id object);
143 
145  return backStorage;
146  }
147 
148 private:
151 };
152 
154 
155 #endif /* RMEMORYSTOARGE_H_ */
virtual QSet< QString > getViewNames() const
Definition: RMemoryStorage.cpp:707
virtual QSet< RBlock::Id > queryAllBlocks(bool undone=false)
Definition: RMemoryStorage.cpp:268
int Handle
Definition: RObject.h:55
virtual RLineweight::Lineweight getCurrentLineweight() const
Definition: RStorage.cpp:154
virtual QSharedPointer< RUcs > queryUcs(RUcs::Id ucsId) const
Definition: RMemoryStorage.cpp:750
virtual QSharedPointer< REntity > queryEntityDirect(REntity::Id objectId) const
Definition: RMemoryStorage.cpp:570
virtual QSet< REntity::Id > queryAllBlockReferences()
Definition: RMemoryStorage.cpp:467
virtual QSharedPointer< RObject > queryObjectByHandle(RObject::Handle objectHandle) const
Definition: RMemoryStorage.cpp:525
virtual QSet< RLinetype::Id > queryAllLinetypes()
Definition: RMemoryStorage.cpp:304
virtual bool hasChildEntities(REntity::Id parentId)
Definition: RMemoryStorage.cpp:441
virtual QSet< REntity::Id > queryLayerBlockEntities(RLayer::Id layerId, RBlock::Id blockId)
Definition: RMemoryStorage.cpp:408
virtual QSharedPointer< RUcs > queryUcsDirect(RUcs::Id ucsId) const
Definition: RMemoryStorage.cpp:743
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:76
RStorage * getBackStorage() const
Definition: RLinkedStorage.h:144
#define QCADCORE_EXPORT
Definition: core_global.h:10
virtual QSet< REntity::Id > queryBlockReferences(RBlock::Id blockId)
Definition: RMemoryStorage.cpp:455
virtual QSet< REntity::Id > queryInfiniteEntities()
Definition: RMemoryStorage.cpp:316
virtual QSet< QString > getLinetypeNames() const
Definition: RMemoryStorage.cpp:1533
int Id
Definition: RObject.h:53
virtual RView::Id getViewId(const QString &viewName) const
Definition: RMemoryStorage.cpp:1501
This is the abstract base class for all storage implementations.
Definition: RStorage.h:62
virtual QString getLinetypeName(RLinetype::Id linetypeId) const
Definition: RMemoryStorage.cpp:1509
int objectIdOffset
Definition: RLinkedStorage.h:150
virtual QSet< QString > getLayoutNames(const QString &rxStr=RDEFAULT_QSTRING) const
Definition: RMemoryStorage.cpp:1470
virtual QSet< REntity::Id > queryLayerEntities(RLayer::Id layerId, bool allBlocks=false)
Definition: RMemoryStorage.cpp:361
virtual QSet< RObject::Id > queryAllObjects()
Definition: RMemoryStorage.cpp:131
virtual QSharedPointer< RObject > queryObject(RObject::Id objectId) const
Definition: RMemoryStorage.cpp:508
virtual QSharedPointer< RLayout > queryLayoutDirect(RLayout::Id layoutId) const
Definition: RMemoryStorage.cpp:611
virtual QSet< REntity::Id > queryChildEntities(REntity::Id parentId, RS::EntityType type=RS::EntityAll)
Definition: RMemoryStorage.cpp:420
virtual QSet< QString > getLayerNames(const QString &rxStr=RDEFAULT_QSTRING) const
Definition: RMemoryStorage.cpp:1439
virtual QSet< RBlock::Id > queryAllLayoutBlocks(bool undone=false)
Definition: RMemoryStorage.cpp:280
virtual RBlock::Id getCurrentBlockId() const
Definition: RStorage.h:328
virtual RView::Id getCurrentViewId() const
Definition: RStorage.h:293
virtual QSharedPointer< RLinetype > queryLinetype(RLinetype::Id linetypeId) const
Definition: RMemoryStorage.cpp:779
Lineweight
Definition: RLineweight.h:42
virtual QSet< RLayer::Id > queryAllLayers(bool undone=false)
Definition: RMemoryStorage.cpp:256
virtual RLayer::Id getCurrentLayerId() const
Definition: RStorage.cpp:134
Color.
Definition: RColor.h:42
virtual bool isInBackStorage(RObject::Id)
Linked storages should return true if the given object is stored in the storage the linked storage li...
Definition: RStorage.h:640
virtual QVariant getKnownVariable(RS::KnownVariable key) const
Definition: RMemoryStorage.cpp:1423
virtual QSharedPointer< RView > queryView(RView::Id viewId) const
Definition: RMemoryStorage.cpp:719
virtual RLinetype::Id getCurrentLinetypeId() const
Definition: RStorage.cpp:178
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RMemoryStorage.h:37
virtual QString getBlockName(RBlock::Id blockId) const
Definition: RMemoryStorage.cpp:676
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RLinkedStorage.h:39
virtual QSharedPointer< RLinetype > queryLinetypeDirect(RLinetype::Id linetypeId) const
Definition: RMemoryStorage.cpp:772
Q_DECLARE_METATYPE(RMath *)
virtual QSharedPointer< RLayer > queryLayerDirect(RLayer::Id layerId) const
Definition: RMemoryStorage.cpp:577
virtual QSet< REntity::Id > queryAllEntities(bool undone=false, bool allBlocks=false, RS::EntityType type=RS::EntityAll)
Definition: RMemoryStorage.cpp:196
virtual RObject::Id getNewObjectId()
Definition: RStorage.cpp:69
virtual RColor getCurrentColor() const
Definition: RStorage.cpp:146
virtual QString getViewName(RView::Id viewId) const
Definition: RMemoryStorage.cpp:699
virtual bool deleteObject(RObject::Id objectId)
Deletes the object with the given ID.
Definition: RMemoryStorage.cpp:1217
virtual QSharedPointer< RObject > queryObjectDirect(RObject::Id objectId) const
Definition: RMemoryStorage.cpp:518
virtual QSharedPointer< RDocumentVariables > queryDocumentVariablesDirect() const
Definition: RMemoryStorage.cpp:501
virtual QSharedPointer< RLayer > queryLayer(RLayer::Id layerId) const
Definition: RMemoryStorage.cpp:584
KnownVariable
Well established document variables.
Definition: RS.h:305
virtual QSet< REntity::Id > queryAllVisibleEntities()
Definition: RMemoryStorage.cpp:143
virtual QSet< REntity::Id > queryBlockEntities(RBlock::Id blockId)
Definition: RMemoryStorage.cpp:391
virtual RObject::Handle getNewObjectHandle()
Definition: RStorage.cpp:77
virtual QString getLinetypeLabel(RLinetype::Id linetypeId) const
Definition: RMemoryStorage.cpp:1525
All entities (for filters)
Definition: RS.h:86
RStorage * backStorage
Definition: RLinkedStorage.h:149
virtual bool hasBlockEntities(RBlock::Id blockId) const
Definition: RMemoryStorage.cpp:375
virtual QSharedPointer< RBlock > queryBlockDirect(RBlock::Id blockId) const
Definition: RMemoryStorage.cpp:658
virtual QString getLinetypeDescription(RLinetype::Id linetypeId) const
Definition: RMemoryStorage.cpp:1517
#define RDEFAULT_QSTRING
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RDebug.h:48
virtual RLinetype::Id getLinetypeId(const QString &linetypeName) const
Definition: RMemoryStorage.cpp:1557
virtual QSharedPointer< REntity > queryEntity(REntity::Id objectId) const
Definition: RMemoryStorage.cpp:560
virtual QSharedPointer< RLayout > queryLayout(RLayout::Id layoutId) const
Definition: RMemoryStorage.cpp:618
virtual QSharedPointer< RBlock > queryBlock(RBlock::Id blockId) const
Definition: RMemoryStorage.cpp:645
virtual QSet< RView::Id > queryAllViews(bool undone=false)
Definition: RMemoryStorage.cpp:292
virtual QSharedPointer< RDocumentVariables > queryDocumentVariables() const
Definition: RMemoryStorage.cpp:493
virtual QList< RLinetypePattern > getLinetypePatterns() const
Definition: RMemoryStorage.cpp:1545
virtual QString getLayerName(RLayer::Id layerId) const
Definition: RMemoryStorage.cpp:1431
virtual bool setUndoStatus(RObject::Id objectId, bool status)
Definition: RMemoryStorage.cpp:1335
virtual QString getLayoutName(RLayout::Id layoutId) const
Definition: RMemoryStorage.cpp:1462
virtual QString getDimensionFont() const
Definition: RStorage.cpp:308
virtual QSet< RUcs::Id > queryAllUcs()
Definition: RMemoryStorage.cpp:244
virtual QSet< REntity::Id > querySelectedEntities() const
Definition: RMemoryStorage.cpp:355
virtual RLayer::Id getLayerId(const QString &layerName) const
Definition: RMemoryStorage.cpp:1454
virtual QSet< QString > getBlockNames(const QString &rxStr=RDEFAULT_QSTRING) const
Definition: RMemoryStorage.cpp:684
virtual void clear()
Resets this storage to its initial, empty state.
Definition: RMemoryStorage.cpp:39
virtual RBlock::Id getBlockId(const QString &blockName) const
Definition: RMemoryStorage.cpp:1493
virtual RLayout::Id getLayoutId(const QString &layoutName) const
Definition: RMemoryStorage.cpp:1485