Gorgon Game Engine
Property.h
Go to the documentation of this file.
1 #pragma once
2 
18 #include "Types.h"
19 #include <string>
20 #include <iostream>
21 #include <stdexcept>
22 
23 namespace Gorgon {
24 
29  template<class C_, class T_, T_(C_::*Getter_)() const = &C_::get, void(C_::*Setter_)(const T_ &) = &C_::set>
30  class Property {
31  public:
32  using Type = T_;
33 
34  protected:
35  C_ &Object;
36 
37  public:
39  { }
40 
42 
43  Property(const Property &) = delete;
44 
45  Property &operator =(const Property &) = delete;
46 
47  Property(Property &&) = default;
48 
49  Property &operator =(Property &&) = default;
50 
51  operator T_() {
52  return (Object.*Getter_)();
53  }
54 
55  operator const T_() const {
56  return (Object.*Getter_)();
57  }
58 
59  T_ Get() const {
60  return (Object.*Getter_)();
61  }
62 
63  void Set(const T_ &value) {
64  (Object.*Setter_)(value);
65  }
66 
67  Property &operator =(const T_ &value) {
68  (Object.*Setter_)(value);
69 
70  return *this;
71  }
72 
73  template <class O_>
74  Property &operator =(const O_ &value) {
75  (Object.*Setter_)(value);
76 
77  return *this;
78  }
79 
80  T_ operator *() const {
81  return (Object.*Getter_)();
82  }
83 
84  template <class AC_, T_(AC_::*G_)() const, void(AC_::*S_)(const T_ &)>
86  (Object.*Setter_)((T_)prop);
87 
88  return *this;
89  }
90 
91  bool operator ==(const T_ &v) const {
92  return (Object.*Getter_)()==v;
93  }
94 
95  bool operator !=(const T_ &v) const {
96  return (Object.*Getter_)()!=v;
97  }
98  };
99 
100 
101 
107  template<class C_, class T_, T_(C_::*Getter_)() const, void(C_::*Setter_)(const T_ &)>
108  class NumericProperty : public Property<C_, T_, Getter_, Setter_> {
109  public:
110  using Type = T_;
111 
112  NumericProperty(C_ *Object) : Property<C_, T_, Getter_, Setter_>(Object)
113  { }
114 
115  NumericProperty(C_ &Object) : Property<C_, T_, Getter_, Setter_>(Object)
116  { }
117 
118 
120 
122 
123  NumericProperty &operator =(const T_ &value) {
124  (this->Object.*Setter_)(value);
125 
126  return *this;
127  }
128 
130  (this->Object.*Setter_)(other.Get());
131 
132  return *this;
133  }
134 
135  template<class AC_, class O_, O_(C_::*G_)() const, void(C_::*S_)(const O_ &)>
137  (this->Object.*Setter_)((T_)(O_)prop);
138 
139  return *this;
140  }
141 
142  T_ operator ++(int) {
143  T_ v=(this->Object.*Getter_)();
144  T_ k=v;
145  k++;
146  (this->Object.*Setter_)(k);
147  return v;
148  }
149 
150  T_ operator --(int) {
151  T_ v=(this->Object.*Getter_)();
152  T_ k=v;
153  k--;
154  (this->Object.*Setter_)(k);
155  return v;
156  }
157 
158  T_ operator ++() {
159  T_ v=(this->Object.*Getter_)();
160  v++;
161  (this->Object.*Setter_)(v);
162  return v;
163  }
164 
165  T_ operator --() {
166  T_ v=(this->Object.*Getter_)();
167  v--;
168  (this->Object.*Setter_)(v);
169  return v;
170  }
171 
172  T_ operator +(const T_ &v) const {
173  return (this->Object.*Getter_)() + v;
174  }
175 
176  T_ operator -(const T_ &v) const {
177  return (this->Object.*Getter_)() - v;
178  }
179 
180  T_ operator *(const T_ &v) const {
181  return (this->Object.*Getter_)() * v;
182  }
183 
184  T_ operator /(const T_ &v) const {
185  return (this->Object.*Getter_)() / v;
186  }
187 
188  T_ operator +=(const T_ &v) {
189  (this->Object.*Setter_)((this->Object.*Getter_)()+v);
190  return (this->Object.*Getter_)();
191  }
192 
193  T_ operator -=(const T_ &v) {
194  (this->Object.*Setter_)((this->Object.*Getter_)()-v);
195  return (this->Object.*Getter_)();
196  }
197 
198  template <class O_>
199  T_ operator *=(const O_ &v) {
200  (this->Object.*Setter_)((this->Object.*Getter_)()*v);
201  return (this->Object.*Getter_)();
202  }
203 
204  template <class O_>
205  T_ operator /=(const O_ &v) {
206  (this->Object.*Setter_)((this->Object.*Getter_)()/v);
207  return (this->Object.*Getter_)();
208  }
209 
210  bool operator >(const T_ &v) const {
211  return (this->Object.*Getter_)()>v;
212  }
213 
214  bool operator <(const T_ &v) const {
215  return (this->Object.*Getter_)()<v;
216  }
217 
218  bool operator >=(const T_ &v) const {
219  return (this->Object.*Getter_)()>=v;
220  }
221 
222  bool operator <=(const T_ &v) const {
223  return (this->Object.*Getter_)()<=v;
224  }
225  };
226 
229  template<class C_, class T_, T_(C_::*Getter_)() const, void(C_::*Setter_)(const T_ &)>
230  class BooleanProperty : public Property<C_, T_, Getter_, Setter_> {
231  public:
232  using Type = T_;
233 
234  BooleanProperty(C_ *Object) : Property<C_, T_, Getter_, Setter_>(Object)
235  { }
236 
237  BooleanProperty(C_ &Object) : Property<C_, T_, Getter_, Setter_>(Object)
238  { }
239 
241 
243 
244  template <class O_>
245  BooleanProperty &operator =(const O_ &value) {
246  (this->Object.*Setter_)(value);
247 
248  return *this;
249  }
250 
251  template <class AC_, class O_, O_(C_::*G_)() const, void(C_::*S_)(const O_ &)>
253  (this->Object.*Setter_)((T_)(O_)prop);
254 
255  return *this;
256  }
257 
258  bool operator &&(const T_ &v) const {
259  return (this->Object.*Getter_)() && v;
260  }
261 
262  bool operator ||(const T_ &v) const {
263  return (this->Object.*Getter_)() || v;
264  }
265 
266  bool operator !() const {
267  return !(this->Object.*Getter_)();
268  }
269  };
270 
274  template<class C_, class T_, T_(C_::*Getter_)() const, void(C_::*Setter_)(const T_ &)>
275  class BinaryProperty : public NumericProperty<C_, T_, Getter_, Setter_> {
276  public:
277  using Type = T_;
278 
279  BinaryProperty(C_ *Object) : NumericProperty<C_,T_, Getter_, Setter_>(Object)
280  { }
281 
282  BinaryProperty(C_ &Object) : NumericProperty<C_,T_, Getter_, Setter_>(Object)
283  { }
284 
286 
288 
289  template <class O_>
290  BinaryProperty &operator =(const O_ &value) {
291  (this->Object.*Setter_)(T_(value));
292 
293  return *this;
294  }
295 
296  template <class AC_, T_(AC_::*G_)() const, void(AC_::*S_)(const T_ &)>
298  (this->Object.*Setter_)((T_)prop);
299 
300  return *this;
301  }
302 
303  T_ operator |= (const T_ &v) {
304  (this->Object.*Setter_)((this->Object.*Getter_)() | v);
305  return (this->Object.*Getter_)();
306  }
307 
308  T_ operator &= (const T_ &v) {
309  (this->Object.*Setter_)((this->Object.*Getter_)() & v);
310  return (this->Object.*Getter_)();
311  }
312 
313  T_ operator ^= (const T_ &v) {
314  (this->Object.*Setter_)((this->Object.*Getter_)() ^ v);
315  return (this->Object.*Getter_)();
316  }
317  };
318 
322  template<class C_, class T_, T_&(C_::*Getter_)() const, void(C_::*Setter_)(T_ &)>
323  class ObjectProperty : public Property<C_, T_&, Getter_, Setter_> {
324  public:
325  using Type = T_;
326 
327  ObjectProperty(C_ *Object) : Property<C_, T_&, Getter_, Setter_>(Object)
328  { }
329 
330  ObjectProperty(C_ &Object) : Property<C_, T_&, Getter_, Setter_>(Object)
331  { }
332 
334 
336 
337  template <class O_>
338  ObjectProperty &operator =(const O_ &value) {
339  (this->Object.*Setter_)(value);
340 
341  return *this;
342  }
343 
344  template <class AC_, T_&(C_::*G_)() const, void(C_::*S_)(const T_ &)>
346  (this->Object.*Setter_)(dynamic_cast<T_&>(prop));
347 
348  return *this;
349  }
350 
351  const T_ &operator *() const {
352  return (this->Object.*Getter_)();
353  }
354 
355  const T_ *operator ->() const {
356  return &(this->Object.*Getter_)();
357  }
358  };
359 
361  namespace internal {
362  template <class T_>
363  class ReferencePropertyWatch;
364 
365  template <class T_>
366  class ObjectPropertyWatch;
367  }
369 
376  template<class C_, class T_, T_(C_::*Getter_)() const, void(C_::*Setter_)(const T_ &)>
377  class MutableObjectProperty : public Property<C_, T_, Getter_, Setter_> {
378  public:
379  using Type = T_;
380 
381  MutableObjectProperty(C_ *Object) : Property<C_, T_, Setter_, Getter_>(Object)
382  { }
383 
384  MutableObjectProperty(C_ &Object) : Property<C_, T_, Setter_, Getter_>(Object)
385  { }
386 
388 
390 
391  template <class O_>
392  MutableObjectProperty &operator =(const O_ &value) {
393  (this->Object.*Setter_)(value);
394 
395  return *this;
396  }
397 
398  template <class AC_, T_(C_::*G_)() const, void(C_::*S_)(const T_ &)>
400  (this->Object.*Setter_)((T_)prop);
401 
402  return *this;
403  }
404 
405  T_ &operator *() {
406  return (this->Object.*Getter_)();
407  }
408 
409  const T_ &operator *() const {
410  return (this->Object.*Getter_)();
411  }
412 
413  internal::ObjectPropertyWatch<MutableObjectProperty<C_, T_, Getter_, Setter_>> operator ->();
414 
415  const T_ *operator ->() const {
416  return &(this->Object.*Getter_)();
417  }
418  };
419 
425  template<class C_, class T_, T_ *(C_::*Getter_)() const, void(C_::*Setter_)(T_ *), void(C_::*Update_)()>
427  protected:
428  C_ &Object;
429 
430  public:
431  using Type = T_;
432 
434 
436 
438 
440 
442 
444 
445  operator T_ &() {
446  return (this->Object.*Getter_)();
447  }
448 
449  operator T_ &() const {
450  return (this->Object.*Getter_)();
451  }
452 
454  (this->Object.*Setter_)(value);
455 
456  return *this;
457  }
458 
460  (this->Object.*Setter_)(&value);
461 
462  return *this;
463  }
464 
466  bool operator ==(const T_ &v) const {
467  return (this->Object.*Getter_)()==&v;
468  }
469 
471  bool operator !=(const T_ &v) const {
472  return (this->Object.*Getter_)()!=&v;
473  }
474 
476  bool operator ==(const T_ *v) const {
477  return (this->Object.*Getter_)()==v;
478  }
479 
481  bool operator !=(const T_ *v) const {
482  return (this->Object.*Getter_)()!=v;
483  }
484 
485  void Update() {
486  (this->Object.*Update_)();
487  }
488 
489  internal::ReferencePropertyWatch<ReferenceProperty<C_, T_, Getter_, Setter_, Update_>> operator ->();
490 
491  const T_ *operator ->() const {
492  return (this->Object.*Getter_)();
493  }
494 
495  T_ *GetPtr() const {
496  return (this->Object.*Getter_)();
497  }
498 
499  T_ &Get() const {
500  T_ *o=(this->Object.*Getter_)();
501  if(o)
502  return *o;
503  else
504  throw std::runtime_error("Property is empty");
505  }
506  };
507 
509  namespace internal {
510  template <class T_>
511  class ReferencePropertyWatch {
512  public:
513  ReferencePropertyWatch(T_ *obj) : obj(obj) {}
514 
515  ~ReferencePropertyWatch() {
516  obj->Update();
517  }
518 
519  auto operator ->() const {
520  return obj->GetPtr();
521  }
522 
523  private:
524  T_ *obj;
525  };
526 
527  template <class T_>
528  class ObjectPropertyWatch {
529  public:
530  ObjectPropertyWatch(T_ *obj) : obj(obj) {
531  val = obj->Get();
532  }
533 
534  ~ObjectPropertyWatch() {
535  obj->Set(val);
536  }
537 
538  auto &operator ->() const {
539  return val;
540  }
541 
542  private:
543  T_ *obj;
544  typename T_::Type val;
545  };
546  }
548 
549 
550  template<class C_, class T_, T_(C_::*Getter_)() const, void(C_::*Setter_)(const T_ &)>
551  internal::ObjectPropertyWatch<MutableObjectProperty<C_, T_, Getter_, Setter_>> MutableObjectProperty<C_, T_, Getter_, Setter_>::operator ->() {
552  return {this};
553  }
554 
555  template<class C_, class T_, T_ *(C_::*Getter_)() const, void(C_::*Setter_)(T_ *), void(C_::*Update_)()>
556  internal::ReferencePropertyWatch<ReferenceProperty<C_, T_, Getter_, Setter_, Update_>> ReferenceProperty<C_, T_, Getter_, Setter_, Update_>::operator ->() {
557  return {this};
558  }
559 
561  template<class C_, class T_, T_(C_::*Getter_)() const, void(C_::*Setter_)(const T_ &)>
562  class TextualProperty : public Property<C_, T_, Getter_, Setter_> {
563  public:
564  TextualProperty(C_ *Object) : Property<C_,T_, Getter_, Setter_>(Object)
565  { }
566 
567  TextualProperty(C_ &Object) : Property<C_,T_, Getter_, Setter_>(Object)
568  { }
569 
571 
573 
574  template <class O_>
575  TextualProperty &operator =(const O_ &value) {
576  (this->Object.*Setter_)(T_(value));
577 
578  return *this;
579  }
580 
581  template <class AC_, T_(C_::*G_)() const, void(C_::*S_)(const T_ &)>
583  (this->Object.*Setter_)((T_)prop);
584 
585  return *this;
586  }
587 
588  void operator +=(const T_ &v) {
589  return (this->Object.*Setter_)((this->Object.*Getter_)()+v);
590  }
591 
592  typename T_::size_type length() const {
593  return (this->Object.*Getter_)().length();
594  }
595 
596  const char *c_str() const {
597  return (this->Object.*Getter_)().c_str();
598  }
599 
600  T_ substr(typename T_::size_type off=0U, typename T_::size_type len=T_::npos) const {
601  return (this->Object.*Getter_)().substr(off,len);
602  }
603 
604  typename T_::size_type find ( const T_& str, typename T_::size_type pos = 0 ) const {
605  return (this->Object.*Getter_)().find(str, pos);
606  }
607  typename T_::size_type find ( const char* s, typename T_::size_type pos, typename T_::size_type n ) const {
608  return (this->Object.*Getter_)().find(s, pos, n);
609  }
610  typename T_::size_type find ( const char* s, typename T_::size_type pos = 0 ) const {
611  return (this->Object.*Getter_)().find(s, pos);
612  }
613  typename T_::size_type find ( char c, typename T_::size_type pos = 0 ) const {
614  return (this->Object.*Getter_)().find(c, pos);
615  }
616 
617  typename T_::size_type rfind ( const T_& str, typename T_::size_type pos = T_::npos ) const {
618  return (this->Object.*Getter_)().rfind(str, pos);
619  }
620  typename T_::size_type rfind ( const char* s, typename T_::size_type pos, typename T_::size_type n ) const {
621  return (this->Object.*Getter_)().rfind(s, pos, n);
622  }
623  typename T_::size_type rfind ( const char* s, typename T_::size_type pos = T_::npos ) const {
624  return (this->Object.*Getter_)().rfind(s, pos);
625  }
626  typename T_::size_type rfind ( char c, typename T_::size_type pos = T_::npos ) const {
627  return (this->Object.*Getter_)().rfind(c, pos);
628  }
629 
630  typename T_::size_type find_first_of ( const T_& str, typename T_::size_type pos = T_::npos ) const {
631  return (this->Object.*Getter_)().find_first_of(str, pos);
632  }
633  typename T_::size_type find_first_of ( const char* s, typename T_::size_type pos, typename T_::size_type n ) const {
634  return (this->Object.*Getter_)().find_first_of(s, pos, n);
635  }
636  typename T_::size_type find_first_of ( const char* s, typename T_::size_type pos = T_::npos ) const {
637  return (this->Object.*Getter_)().find_first_of(s, pos);
638  }
639  typename T_::size_type find_first_of ( char c, typename T_::size_type pos = T_::npos ) const {
640  return (this->Object.*Getter_)().find_first_of(c, pos);
641  }
642 
643  typename T_::size_type find_last_of ( const T_& str, typename T_::size_type pos = T_::npos ) const {
644  return (this->Object.*Getter_)().find_last_of(str, pos);
645  }
646  typename T_::size_type find_last_of ( const char* s, typename T_::size_type pos, typename T_::size_type n ) const {
647  return (this->Object.*Getter_)().find_last_of(s, pos, n);
648  }
649  typename T_::size_type find_last_of ( const char* s, typename T_::size_type pos = T_::npos ) const {
650  return (this->Object.*Getter_)().find_last_of(s, pos);
651  }
652  typename T_::size_type find_last_of ( char c, typename T_::size_type pos = T_::npos ) const {
653  return (this->Object.*Getter_)().find_last_of(c, pos);
654  }
655 
656  typename T_::size_type find_first_not_of ( const T_& str, typename T_::size_type pos = T_::npos ) const {
657  return (this->Object.*Getter_)().find_first_not_of(str, pos);
658  }
659  typename T_::size_type find_first_not_of ( const char* s, typename T_::size_type pos, typename T_::size_type n ) const {
660  return (this->Object.*Getter_)().find_first_not_of(s, pos, n);
661  }
662  typename T_::size_type find_first_not_of ( const char* s, typename T_::size_type pos = T_::npos ) const {
663  return (this->Object.*Getter_)().find_first_not_of(s, pos);
664  }
665  typename T_::size_type find_first_not_of ( char c, typename T_::size_type pos = T_::npos ) const {
666  return (this->Object.*Getter_)().find_first_not_of(c, pos);
667  }
668 
669  typename T_::size_type find_last_not_of ( const T_& str, typename T_::size_type pos = T_::npos ) const {
670  return (this->Object.*Getter_)().find_last_not_of(str, pos);
671  }
672  typename T_::size_type find_last_not_of ( const char* s, typename T_::size_type pos, typename T_::size_type n ) const {
673  return (this->Object.*Getter_)().find_last_not_of(s, pos, n);
674  }
675  typename T_::size_type find_last_not_of ( const char* s, typename T_::size_type pos = T_::npos ) const {
676  return (this->Object.*Getter_)().find_last_not_of(s, pos);
677  }
678  typename T_::size_type find_last_not_of ( char c, typename T_::size_type pos = T_::npos ) const {
679  return (this->Object.*Getter_)().find_last_not_of(c, pos);
680  }
681 
682  const char &operator[] (typename T_::size_type pos) const {
683  return (this->Object.*Getter_)()[pos];
684  }
685 
686  void clear() {
687  T_ s=(this->Object.*Getter_)();
688  s.clear();
689  (this->Object.*Setter_)(s);
690  }
691 
692  TextualProperty &append(const T_ &str) {
693  T_ s=(this->Object.*Getter_)();
694  s.append(str);
695  (this->Object.*Setter_)(s);
696 
697  return *this;
698  }
699 
700  TextualProperty &append(const T_ &str, typename T_::size_type pos, typename T_::size_type n) {
701  T_ s=(this->Object.*Getter_)();
702  s.append(str, pos, n);
703  (this->Object.*Setter_)(s);
704 
705  return *this;
706  }
707 
708  TextualProperty &append(const char *str, typename T_::size_type n) {
709  T_ s=(this->Object.*Getter_)();
710  s.append(str, n);
711  (this->Object.*Setter_)(s);
712 
713  return *this;
714  }
715 
716  TextualProperty &append(const char *str) {
717  T_ s=(this->Object.*Getter_)();
718  s.append(str);
719  (this->Object.*Setter_)(s);
720 
721  return *this;
722  }
723 
724  TextualProperty &append(typename T_::size_type n, char c) {
725  T_ s=(this->Object.*Getter_)();
726  s.append(n, c);
727  (this->Object.*Setter_)(s);
728 
729  return *this;
730  }
731 
732  template <class InputIterator>
733  TextualProperty& append ( InputIterator first, InputIterator last ) {
734  T_ s=(this->Object.*Getter_)();
735  s.template append<InputIterator>(first, last);
736  (this->Object.*Setter_)(s);
737 
738  return *this;
739  }
740 
741  TextualProperty &erase(typename T_::size_type pos = 0, typename T_::size_type n = T_::npos) {
742  T_ s=(this->Object.*Getter_)();
743  s.erase(pos, n);
744  (this->Object.*Setter_)(s);
745 
746  return *this;
747  }
748 
749  TextualProperty &insert(typename T_::size_type pos, const T_ str) {
750  T_ s=(this->Object.*Getter_)();
751  s.insert(pos, str);
752  (this->Object.*Setter_)(s);
753 
754  return *this;
755  }
756 
757  TextualProperty &insert(typename T_::size_type pos1, const T_ str, typename T_::size_type pos2, typename T_::size_type n = T_::npos) {
758  T_ s=(this->Object.*Getter_)();
759  s.erase(pos1, str, pos2, n);
760  (this->Object.*Setter_)(s);
761 
762  return *this;
763  }
764 
765  TextualProperty &insert(typename T_::size_type pos, const char *str, typename T_::size_type n) {
766  T_ s=(this->Object.*Getter_)();
767  s.insert(pos, str, n);
768  (this->Object.*Setter_)(s);
769 
770  return *this;
771  }
772 
773  TextualProperty &insert(typename T_::size_type pos, const char *str) {
774  T_ s=(this->Object.*Getter_)();
775  s.insert(pos, str);
776  (this->Object.*Setter_)(s);
777 
778  return *this;
779  }
780 
781  TextualProperty &insert(typename T_::size_type pos, typename T_::size_type n, char c) {
782  T_ s=(this->Object.*Getter_)();
783  s.insert(pos, n, c);
784  (this->Object.*Setter_)(s);
785 
786  return *this;
787  }
788 
789  operator T_() {
790  return (this->Object.*Getter_)();
791  }
792 
793  operator const T_() const {
794  return (this->Object.*Getter_)();
795  }
796 
797  };
798 
799 
800  template<class C_, class T_, T_(C_::*Getter_)() const, void(C_::*Setter_)(const T_ &)>
802  return T_(t)+v;
803  }
804 
805  template<class C_, class T_, T_(C_::*Getter_)() const, void(C_::*Setter_)(const T_ &)>
807  return v+T_(t);
808  }
809 
810  template<class C_, class T_, T_(C_::*Getter_)() const, void(C_::*Setter_)(const T_ &)>
812  return T_(t)+v;
813  }
814 
815  template<class C_, class T_, T_(C_::*Getter_)() const, void(C_::*Setter_)(const T_ &)>
817  return v+T_(t);
818  }
819 
820 
821 
822  template <class C_, class T_, T_(C_::*G_)() const, void(C_::*S_)(const T_ &)>
823  inline std::ostream &operator <<(std::ostream &out, const TextualProperty<C_, T_, G_, S_> &p) {
824  out<<(T_)p;
825 
826  return out;
827  }
828 
829  template <class C_, class T_, T_(C_::*G_)() const, void(C_::*S_)(const T_ &)>
830  inline std::ostream &operator <<(std::ostream &out, const NumericProperty<C_,T_, G_, S_> &p) {
831  out<<(T_)p;
832 
833  return out;
834  }
835 
836  template <class C_, class T_, T_(C_::*G_)() const, void(C_::*S_)(const T_ &)>
837  inline std::istream &operator >>(std::istream &in, TextualProperty<C_,T_, G_, S_> &p) {
838  T_ t;
839  in>>t;
840  p=t;
841 
842  return in;
843  }
844 
845  template <class C_, class T_, T_(C_::*G_)() const, void(C_::*S_)(const T_ &)>
846  inline std::istream &operator >>(std::istream &in, NumericProperty<C_,T_, G_, S_> &p) {
847  T_ t;
848  in>>t;
849  p=t;
850 
851  return in;
852  }
853 
854 
856 #define MAP_PROPERTY(type, name, variable) \
857  type get##name() const { return variable; } \
858  void set##name(const type &v) { variable=v; } \
859  type variable
860 
864 #define PROPERTY_UPDATE(cls, proptype, type, name, def) \
865 private: \
866  type m_##name = def; \
867 public: \
868  type Get##name() const { return m_##name; } \
869  void Set##name(const type &value) { m_##name=value; Update(); } \
870  \
871  Gorgon::proptype##Property<cls, type, &cls::Get##name, &cls::Set##name> name = Gorgon::proptype##Property<cls, type, &cls::Get##name, &cls::Set##name>{this}
872 }
Gorgon::ObjectProperty::ObjectProperty
ObjectProperty(C_ &Object)
Definition: Property.h:330
Gorgon::TextualProperty::append
TextualProperty & append(const char *str, typename T_::size_type n)
Definition: Property.h:708
Gorgon::TextualProperty::operator=
TextualProperty & operator=(TextualProperty &&)=default
Gorgon::Property::Set
void Set(const T_ &value)
Definition: Property.h:63
Gorgon::TextualProperty::append
TextualProperty & append(typename T_::size_type n, char c)
Definition: Property.h:724
Gorgon::TextualProperty::find_first_of
T_::size_type find_first_of(char c, typename T_::size_type pos=T_::npos) const
Definition: Property.h:639
Gorgon::Input::Keyboard::Keycodes::U
constexpr Key U
Definition: Keyboard.h:100
Gorgon::ReferenceProperty::operator->
internal::ReferencePropertyWatch< ReferenceProperty< C_, T_, Getter_, Setter_, Update_ > > operator->()
Definition: Property.h:556
Gorgon::TextualProperty::find
T_::size_type find(char c, typename T_::size_type pos=0) const
Definition: Property.h:613
Gorgon::NumericProperty::NumericProperty
NumericProperty(C_ &Object)
Definition: Property.h:115
Gorgon::ReferenceProperty::ReferenceProperty
ReferenceProperty(const ReferenceProperty &)=delete
Gorgon::NumericProperty::operator++
T_ operator++()
Definition: Property.h:158
Gorgon::ObjectProperty
Object property allows the consumers of the property to be able to access object's member functions a...
Definition: Property.h:323
Gorgon::ReferenceProperty::operator==
bool operator==(const T_ &v) const
Compares two objects, this performs reference comparison, not lexical.
Definition: Property.h:466
Gorgon::BinaryProperty::BinaryProperty
BinaryProperty(C_ *Object)
Definition: Property.h:279
Gorgon::NumericProperty
Supports arithmetic operators including +, * ..., +=, ...
Definition: Property.h:108
Gorgon::NumericProperty::NumericProperty
NumericProperty(NumericProperty &&)=default
Gorgon::TextualProperty::find_last_not_of
T_::size_type find_last_not_of(char c, typename T_::size_type pos=T_::npos) const
Definition: Property.h:678
Gorgon::TextualProperty::rfind
T_::size_type rfind(const char *s, typename T_::size_type pos=T_::npos) const
Definition: Property.h:623
Gorgon::BinaryProperty::operator=
BinaryProperty & operator=(BinaryProperty &&)=default
Gorgon::BooleanProperty::BooleanProperty
BooleanProperty(C_ &Object)
Definition: Property.h:237
Gorgon::TextualProperty::find_first_not_of
T_::size_type find_first_not_of(const T_ &str, typename T_::size_type pos=T_::npos) const
Definition: Property.h:656
Gorgon::ObjectProperty::operator*
const T_ & operator*() const
Definition: Property.h:351
Gorgon::NumericProperty::operator--
T_ operator--()
Definition: Property.h:165
Gorgon::TextualProperty::rfind
T_::size_type rfind(const char *s, typename T_::size_type pos, typename T_::size_type n) const
Definition: Property.h:620
Gorgon::ReferenceProperty::Object
C_ & Object
Definition: Property.h:428
Gorgon::TextualProperty::TextualProperty
TextualProperty(C_ *Object)
Definition: Property.h:564
Gorgon::TextualProperty::find_last_not_of
T_::size_type find_last_not_of(const char *s, typename T_::size_type pos, typename T_::size_type n) const
Definition: Property.h:672
Gorgon::BooleanProperty
Supports logic operators.
Definition: Property.h:230
Gorgon::BinaryProperty::operator|=
T_ operator|=(const T_ &v)
Definition: Property.h:303
Gorgon::TextualProperty
Supports everything that string class supports including +, +=, length()
Definition: Property.h:562
Gorgon::TextualProperty::find_first_of
T_::size_type find_first_of(const char *s, typename T_::size_type pos, typename T_::size_type n) const
Definition: Property.h:633
Gorgon::BooleanProperty::operator&&
bool operator&&(const T_ &v) const
Definition: Property.h:258
Gorgon::TextualProperty::TextualProperty
TextualProperty(C_ &Object)
Definition: Property.h:567
Gorgon::TextualProperty::TextualProperty
TextualProperty(TextualProperty &&)=default
Gorgon::TextualProperty::find_first_not_of
T_::size_type find_first_not_of(const char *s, typename T_::size_type pos, typename T_::size_type n) const
Definition: Property.h:659
Gorgon::NumericProperty::operator<=
bool operator<=(const T_ &v) const
Definition: Property.h:222
Gorgon::BooleanProperty::BooleanProperty
BooleanProperty(BooleanProperty &&)=default
Gorgon::Property::operator*
T_ operator*() const
Definition: Property.h:80
Gorgon::NumericProperty::operator/
T_ operator/(const T_ &v) const
Definition: Property.h:184
Gorgon::MutableObjectProperty::operator->
internal::ObjectPropertyWatch< MutableObjectProperty< C_, T_, Getter_, Setter_ > > operator->()
Definition: Property.h:551
Gorgon::TextualProperty::find_first_of
T_::size_type find_first_of(const T_ &str, typename T_::size_type pos=T_::npos) const
Definition: Property.h:630
Gorgon::ObjectProperty::ObjectProperty
ObjectProperty(ObjectProperty &&)=default
Gorgon::TextualProperty::find_last_not_of
T_::size_type find_last_not_of(const T_ &str, typename T_::size_type pos=T_::npos) const
Definition: Property.h:669
Gorgon::ReferenceProperty::Update
void Update()
Definition: Property.h:485
Gorgon::MutableObjectProperty
Object property allows the consumers of the property to be able to access objects member functions an...
Definition: Property.h:377
Gorgon::NumericProperty::operator=
NumericProperty & operator=(NumericProperty &&)=default
Gorgon::TextualProperty::operator+=
void operator+=(const T_ &v)
Definition: Property.h:588
Gorgon::BooleanProperty::operator!
bool operator!() const
Definition: Property.h:266
Gorgon::ObjectProperty::operator=
ObjectProperty & operator=(ObjectProperty &&)=default
Gorgon::TextualProperty::clear
void clear()
Definition: Property.h:686
Gorgon
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
Gorgon::TextualProperty::erase
TextualProperty & erase(typename T_::size_type pos=0, typename T_::size_type n=T_::npos)
Definition: Property.h:741
Gorgon::BooleanProperty::BooleanProperty
BooleanProperty(C_ *Object)
Definition: Property.h:234
Gorgon::BooleanProperty::operator=
BooleanProperty & operator=(BooleanProperty &&)=default
Gorgon::Property
This is generic property that can be set and retrieved good for enums mostly, its ok to use with POD ...
Definition: Property.h:30
Gorgon::MutableObjectProperty::operator*
T_ & operator*()
Definition: Property.h:405
Gorgon::ReferenceProperty::Get
T_ & Get() const
Definition: Property.h:499
Gorgon::MutableObjectProperty::MutableObjectProperty
MutableObjectProperty(MutableObjectProperty &&)=default
Gorgon::ReferenceProperty::ReferenceProperty
ReferenceProperty(C_ *Object)
Definition: Property.h:433
Gorgon::operator>>
std::istream & operator>>(std::istream &in, TextualProperty< C_, T_, G_, S_ > &p)
Definition: Property.h:837
Gorgon::ObjectProperty::operator->
const T_ * operator->() const
Definition: Property.h:355
Gorgon::NumericProperty::NumericProperty
NumericProperty(C_ *Object)
Definition: Property.h:112
Gorgon::TextualProperty::append
TextualProperty & append(const T_ &str, typename T_::size_type pos, typename T_::size_type n)
Definition: Property.h:700
Gorgon::Property::Property
Property(Property &&)=default
Gorgon::TextualProperty::insert
TextualProperty & insert(typename T_::size_type pos, typename T_::size_type n, char c)
Definition: Property.h:781
Gorgon::Property::operator=
Property & operator=(const Property &)=delete
Gorgon::BinaryProperty::operator^=
T_ operator^=(const T_ &v)
Definition: Property.h:313
Gorgon::TextualProperty::find_last_not_of
T_::size_type find_last_not_of(const char *s, typename T_::size_type pos=T_::npos) const
Definition: Property.h:675
Gorgon::TextualProperty::substr
T_ substr(typename T_::size_type off=0U, typename T_::size_type len=T_::npos) const
Definition: Property.h:600
Gorgon::TextualProperty::find
T_::size_type find(const char *s, typename T_::size_type pos, typename T_::size_type n) const
Definition: Property.h:607
Gorgon::Property::Property
Property(C_ *Object)
Definition: Property.h:38
Gorgon::NumericProperty::operator+=
T_ operator+=(const T_ &v)
Definition: Property.h:188
Gorgon::TextualProperty::find_first_of
T_::size_type find_first_of(const char *s, typename T_::size_type pos=T_::npos) const
Definition: Property.h:636
Gorgon::operator+
T_ operator+(TextualProperty< C_, T_, Setter_, Getter_ > &t, const T_ &v)
Definition: Property.h:801
Gorgon::Property::Object
C_ & Object
Definition: Property.h:35
Gorgon::TextualProperty::length
T_::size_type length() const
Definition: Property.h:592
Gorgon::NumericProperty::operator-
T_ operator-(const T_ &v) const
Definition: Property.h:176
Gorgon::ReferenceProperty::Type
T_ Type
Definition: Property.h:431
Gorgon::TextualProperty::rfind
T_::size_type rfind(char c, typename T_::size_type pos=T_::npos) const
Definition: Property.h:626
Gorgon::NumericProperty::operator<
bool operator<(const T_ &v) const
Definition: Property.h:214
Gorgon::TextualProperty::operator[]
const char & operator[](typename T_::size_type pos) const
Definition: Property.h:682
Gorgon::TextualProperty::insert
TextualProperty & insert(typename T_::size_type pos1, const T_ str, typename T_::size_type pos2, typename T_::size_type n=T_::npos)
Definition: Property.h:757
Gorgon::Property::operator!=
bool operator!=(const T_ &v) const
Definition: Property.h:95
Types.h
contains type definitions for Gorgon system
Gorgon::ReferenceProperty::operator!=
bool operator!=(const T_ &v) const
Compares two objects, this performs reference comparison, not lexical.
Definition: Property.h:471
Gorgon::ReferenceProperty::operator=
ReferenceProperty & operator=(const ReferenceProperty &)=delete
Gorgon::ReferenceProperty::ReferenceProperty
ReferenceProperty(C_ &Object)
Definition: Property.h:435
Gorgon::Graphics::Animation
A regular drawable animation.
Definition: Animations.h:14
Gorgon::ReferenceProperty::GetPtr
T_ * GetPtr() const
Definition: Property.h:495
Gorgon::NumericProperty::operator>=
bool operator>=(const T_ &v) const
Definition: Property.h:218
Gorgon::ObjectProperty::ObjectProperty
ObjectProperty(C_ *Object)
Definition: Property.h:327
Gorgon::MutableObjectProperty::MutableObjectProperty
MutableObjectProperty(C_ *Object)
Definition: Property.h:381
Gorgon::GL::UBOBindingPoint::Type
Type
Definition: Shader.h:14
Gorgon::operator<<
std::ostream & operator<<(std::ostream &out, const TextualProperty< C_, T_, G_, S_ > &p)
Definition: Property.h:823
Gorgon::Property< Gorgon::UI::Widget, &Widget::getsize, Getter_, Setter_ >::Type
&Widget::getsize Type
Definition: Property.h:32
Gorgon::TextualProperty::find_last_of
T_::size_type find_last_of(const char *s, typename T_::size_type pos=T_::npos) const
Definition: Property.h:649
Gorgon::ReferenceProperty::ReferenceProperty
ReferenceProperty(ReferenceProperty &&)=default
Gorgon::Property::Property
Property(const Property &)=delete
Gorgon::NumericProperty::operator/=
T_ operator/=(const O_ &v)
Definition: Property.h:205
Gorgon::TextualProperty::c_str
const char * c_str() const
Definition: Property.h:596
Gorgon::Property::Get
T_ Get() const
Definition: Property.h:59
Gorgon::TextualProperty::insert
TextualProperty & insert(typename T_::size_type pos, const char *str)
Definition: Property.h:773
Gorgon::TextualProperty::find_last_of
T_::size_type find_last_of(const T_ &str, typename T_::size_type pos=T_::npos) const
Definition: Property.h:643
Gorgon::ReferenceProperty
Reference property allows clients to access a reference object within the class.
Definition: Property.h:426
Gorgon::MutableObjectProperty::MutableObjectProperty
MutableObjectProperty(C_ &Object)
Definition: Property.h:384
Gorgon::MutableObjectProperty::operator=
MutableObjectProperty & operator=(MutableObjectProperty &&)=default
Gorgon::BinaryProperty::BinaryProperty
BinaryProperty(C_ &Object)
Definition: Property.h:282
Gorgon::TextualProperty::find_last_of
T_::size_type find_last_of(char c, typename T_::size_type pos=T_::npos) const
Definition: Property.h:652
Gorgon::TextualProperty::append
TextualProperty & append(InputIterator first, InputIterator last)
Definition: Property.h:733
Gorgon::NumericProperty::operator>
bool operator>(const T_ &v) const
Definition: Property.h:210
Gorgon::BinaryProperty::BinaryProperty
BinaryProperty(BinaryProperty &&)=default
Gorgon::TextualProperty::find
T_::size_type find(const char *s, typename T_::size_type pos=0) const
Definition: Property.h:610
Gorgon::TextualProperty::find_first_not_of
T_::size_type find_first_not_of(char c, typename T_::size_type pos=T_::npos) const
Definition: Property.h:665
Gorgon::NumericProperty::operator+
T_ operator+(const T_ &v) const
Definition: Property.h:172
Gorgon::NumericProperty::operator-=
T_ operator-=(const T_ &v)
Definition: Property.h:193
Gorgon::BooleanProperty::operator||
bool operator||(const T_ &v) const
Definition: Property.h:262
Gorgon::Property::operator==
bool operator==(const T_ &v) const
Definition: Property.h:91
Gorgon::Property::Property
Property(C_ &Object)
Definition: Property.h:41
Gorgon::TextualProperty::append
TextualProperty & append(const char *str)
Definition: Property.h:716
Gorgon::TextualProperty::find
T_::size_type find(const T_ &str, typename T_::size_type pos=0) const
Definition: Property.h:604
Gorgon::TextualProperty::find_last_of
T_::size_type find_last_of(const char *s, typename T_::size_type pos, typename T_::size_type n) const
Definition: Property.h:646
Gorgon::NumericProperty::operator*=
T_ operator*=(const O_ &v)
Definition: Property.h:199
Gorgon::TextualProperty::insert
TextualProperty & insert(typename T_::size_type pos, const char *str, typename T_::size_type n)
Definition: Property.h:765
Gorgon::TextualProperty::insert
TextualProperty & insert(typename T_::size_type pos, const T_ str)
Definition: Property.h:749
Gorgon::TextualProperty::append
TextualProperty & append(const T_ &str)
Definition: Property.h:692
Gorgon::TextualProperty::rfind
T_::size_type rfind(const T_ &str, typename T_::size_type pos=T_::npos) const
Definition: Property.h:617
Gorgon::BinaryProperty::operator&=
T_ operator&=(const T_ &v)
Definition: Property.h:308
Gorgon::BinaryProperty
Supports all operators that the numeric property supports.
Definition: Property.h:275
Gorgon::TextualProperty::find_first_not_of
T_::size_type find_first_not_of(const char *s, typename T_::size_type pos=T_::npos) const
Definition: Property.h:662