PACK Qt Binding  $VERSION$
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
object.h
Go to the documentation of this file.
1 // Copyright (C) 2009-2011 by Konrad Rosenbaum <konrad@silmor.de>
2 // protected under the GNU LGPL version 3 or at your option any newer.
3 // See COPYING.LGPL file that comes with this distribution.
4 //
5 
6 #ifndef WOLF_WOBJECT_H
7 #define WOLF_WOBJECT_H
8 
9 #include <QObject>
10 #include <QList>
11 #include <QCoreApplication>
12 
13 #include "nullable.h"
14 #include "exception.h"
15 
16 class QDomElement;
17 class QDomDocument;
18 
21 {
22  Q_GADGET
23  protected:
24  WObject(){}
25  WObject(const WObject&){}
27  WObject(const QDomElement&){}
28  virtual ~WObject(){}
29  virtual QDomElement toXml(QDomDocument&,QString name="Object");
30  virtual WObject& operator=(const WObject&){return *this;}
31  virtual WObject& operator=(WObject&&){return *this;}
32  virtual void toXml(QDomDocument&,QDomElement&){}
33 
35  static QList<QDomElement>elementsByTagName(const QDomElement&,QString);
36 
38  bool str2bool(QString s);
39 };
40 
43 {
44  public:
45  WDeserializerException(QString e):WException(e,"Deserializer"){}
46 };
47 
49 #define WOBJECT(wob) public: \
50  wob():wob ## Abstract(){} \
51  wob(const wob&w):wob ## Abstract(w){} \
52  wob(wob&&w):wob ## Abstract(w){} \
53  wob(const wob ## Abstract&w):wob ## Abstract(w){} \
54  wob(wob ## Abstract&&w):wob ## Abstract(w){} \
55  wob(const QDomElement&w):wob ## Abstract(w){} \
56  wob& operator=(const wob&w){wob ## Abstract::operator=(w);return *this;} \
57  wob& operator=(const wob ## Abstract&w){wob ## Abstract::operator=(w);return *this;} \
58  wob& operator=(wob&&w){wob ## Abstract::operator=(w);return *this;} \
59  wob& operator=(wob ## Abstract&&w){wob ## Abstract::operator=(w);return *this;} \
60 private:\
61  QString tr(const char*text,const char*comment=nullptr)const{return QCoreApplication::translate("" # wob ,text,comment);}
62 
63 
64 #endif
WDeserializerException(QString e)
Definition: object.h:45
virtual WObject & operator=(WObject &&)
Definition: object.h:31
WObject()
Definition: object.h:24
WObject(const WObject &)
Definition: object.h:25
virtual ~WObject()
Definition: object.h:28
WObject(WObject &&)
Definition: object.h:26
WObject(const QDomElement &)
Definition: object.h:27
virtual WObject & operator=(const WObject &)
Definition: object.h:30
Definition: object.h:20
virtual void toXml(QDomDocument &, QDomElement &)
Definition: object.h:32
Definition: exception.h:16
#define WOLF_BASE_EXPORT
Definition: exception.h:13
Definition: object.h:42