QCAD
Open Source 2D CAD
REntityExportListener.h
Go to the documentation of this file.
1 
20 #ifndef RENTITYEXPORTLISTENER_H
21 #define RENTITYEXPORTLISTENER_H
22 
23 #include "core_global.h"
24 
25 #include <QSet>
26 #include <QString>
27 #include <QPair>
28 
29 #include "REntity.h"
30 
31 class RExporter;
32 
41 public:
43 
48  virtual void registerCustomProperty(const QString& title, const QString& regExp) {
49  registeredProperties.insert(QPair<QString, QString>(title, regExp));
50  }
51 
52  virtual bool checkCustomProperty(REntity* e) const {
53  QSet<QPair<QString, QString> >::const_iterator it;
54  for (it=registeredProperties.constBegin(); it!=registeredProperties.constEnd(); it++) {
55  if (e->hasCustomProperty((*it).first, QRegExp((*it).second))) {
56  return true;
57  }
58  }
59 
60  return false;
61  }
62 
71  virtual void exportEntity(RExporter* exporter, REntity* entity) = 0;
72 
73 private:
74  QSet<QPair<QString, QString> > registeredProperties;
75 };
76 
78 
79 #endif
#define QCADCORE_EXPORT
Definition: core_global.h:10
virtual bool checkCustomProperty(REntity *e) const
Definition: REntityExportListener.h:52
Abstract base class for classes that wish to be notified when an entity is exported.
Definition: REntityExportListener.h:40
bool hasCustomProperty(const QString &title, const QString &key) const
Definition: RObject.cpp:418
virtual void registerCustomProperty(const QString &title, const QString &regExp)
Registers the given custom property as trigger.
Definition: REntityExportListener.h:48
virtual ~REntityExportListener()
Definition: REntityExportListener.h:42
Base class for all entity classes.
Definition: REntity.h:64
Q_DECLARE_METATYPE(RMath *)
Abstract base class for exporters.
Definition: RExporter.h:71
QSet< QPair< QString, QString > > registeredProperties
Definition: REntityExportListener.h:74