Gorgon Game Engine
Reflection.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vector>
4 #include <string>
5 #include <map>
6 #include <assert.h>
7 #include <functional>
8 
9 #include "../Types.h"
10 #include "../Containers/Collection.h"
11 #include "../Containers/Hashmap.h"
12 #include "../Enum.h"
13 #include "../Any.h"
14 #include "../Utils/Assert.h"
15 
16 #include "Data.h"
17 #include "Exceptions.h"
18 
19 namespace Gorgon {
20 
21  namespace Scripting {
22 
23  class Type;
24  class Data;
25  class VirtualMachine;
26 
27  Type *TypeType();
28 
29  namespace Types {
30  const Scripting::Type &Type();
31  const Scripting::Type &Namespace();
33  const Scripting::Type &Function();
39  }
40 
41 
42 
43  template<class T_>
44  std::string GetNameOf(const T_ &val) {
45  return val.GetName();
46  }
47 
48  template<class T_>
49  std::string GetHelpOf(const T_ &val) {
50  return val.GetHelp();
51  }
52 
54  enum Tag {
57 
62 
65 
67  //OutputTag,
68 
71 
74 
78 
81 
84 
87 
90 
93 
96 
99 
103 
106 
109 
112  };
113 
114  typedef std::vector<Any> OptionList;
115 
137  class Parameter {
138  public:
139 
143  template <class ...Params_>
144  Parameter(const std::string &name, const std::string &help, const Type *type,
145  Data defaultvalue, OptionList options, Params_ ...tags) :
146  name(name), type(type), help(help), defaultvalue(defaultvalue) {
147  ASSERT((type!=nullptr), "Parameter type cannot be nullptr", 1, 2);
148  using std::swap;
149 
150  swap(options, this->Options);
151 
152  UnpackTags(tags...);
153  }
154 
156  Parameter(const std::string &name, const std::string &help, const Type *type, Data defaultvalue=Data::Invalid()) :
157  Parameter(name, help, type, defaultvalue, OptionList()) { }
158 
159  template <class ...Params_>
160  Parameter(const std::string &name, const std::string &help, const Type *type, Tag firsttag,
161  Params_ ...tags) :
162  Parameter(name, help, type, Data::Invalid(), OptionList(), firsttag, std::forward<Params_>(tags)...) {
163  }
164 
165  template <class ...Params_>
166  Parameter(const std::string &name, const std::string &help, const Type *type, Data defaultvalue,
167  Tag firsttag, Params_ ...tags) :
168  Parameter(name, help, type, defaultvalue, OptionList(), firsttag, std::forward<Params_>(tags)...) {
169  }
170 
171  Parameter(const std::string &name, const std::string &help, const Type *type,
172  Data defaultvalue, OptionList options, bool reference, bool constant, bool variable, bool allownull) :
173  Parameter(name, help, type, defaultvalue, options)
174  {
175  this->reference = reference;
176  this->constant = constant;
177  this->variable = variable;
178  this->optional = defaultvalue.IsValid();
179  this->allownull = allownull;
180  }
182 
185  name = p.name ;
186  help = p.help ;
187  type = p.type ;
188  defaultvalue= p.defaultvalue;
189  Options = p.Options ;
190  optional = p.optional ;
191  reference = p.reference ;
192  constant = p.constant ;
193  variable = p.variable ;
194  allownull = p.allownull ;
195 
196  return *this;
197  }
198 
200  bool operator ==(const Parameter &p) const {
201  return
202  name == p.name &&
203  help == p.help &&
204  type == p.type &&
205  optional == p.optional &&
206  reference == p.reference &&
207  constant == p.constant &&
208  variable == p.variable &&
209  allownull == p.allownull ;
210  }
211 
213  std::string GetName() const {
214  return name;
215  }
216 
218  std::string GetHelp() const {
219  return help;
220  }
221 
223  const Type &GetType() const {
224  return *type;
225  }
226 
228  bool IsOptional() const {
229  return optional;
230  }
231 
235  bool IsReference() const;
236 
238  bool IsConstant() const {
239  return constant;
240  }
241 
244  bool IsVariable() const {
245  return variable;
246  }
247 
249  bool AllowsNull() const {
250  return allownull;
251  }
252 
255  ASSERT(optional, name+" parameter does not have default value");
256 
257  return defaultvalue;
258  }
259 
262 
263  private:
264  void UnpackTags() {}
265 
266  template<class ...Params_>
267  void UnpackTags(Tag tag, Params_ ...tags) {
268  switch(tag) {
269  case OptionalTag:
270  optional=true;
271  break;
272 
273  case ReferenceTag:
274  reference=true;
275  break;
276 
277  case ConstTag:
278  constant=true;
279  break;
280 
281  case VariableTag:
282  variable=true;
283  break;
284 
285  case AllowNullTag:
286  allownull=true;
287  break;
288 
289  default:
290  Utils::ASSERT_FALSE("Unknown tag");
291  }
292  UnpackTags(tags...);
293  }
294 
295 
296  std::string name;
297  std::string help;
298  const Type *type;
299  Data defaultvalue=Data::Invalid();
300 
301  bool optional = false;
302  bool reference = false;
303  bool constant = false;
304  bool variable = false;
305  bool allownull = false;
306  };
307 
308  using ParameterList = std::vector<Parameter>;
309 
314  class Member {
315  friend class Namespace;
316  friend class Type;
317  public:
318 
319  Member(const std::string &name, const std::string &help) :
320  name(name), help(help) { }
321 
322  virtual ~Member() { }
323 
325  std::string GetName() const {
326  return name;
327  }
328 
330  std::string GetHelp() const {
331  return help;
332  }
333 
335  virtual bool IsInstanceMember() const = 0;
336 
338  std::string GetQualifiedName() const {
339  if(!parent)
340  return name;
341 
342  return parent->GetQualifiedName()+":"+name;
343  }
344 
345  const Member *GetOwner() const { return parent; }
346 
347  protected:
350  virtual void SetParent(const Member &parent) { this->parent=&parent; }
351 
353  std::string name;
354 
356  std::string help;
357 
358  const Member *parent = nullptr;
359  };
360 
365  class StaticMember : public Member {
366  public:
368  enum MemberType {
371 
374 
376  EnumType = 5,
377 
380 
383 
385  Function = 12,
386 
388  Constant = 14,
389  };
390 
391  StaticMember(const std::string& name, const std::string& help) : Member(name, help) {
392  }
393 
394  virtual bool IsInstanceMember() const override final { return false; }
395 
398  bool IsInstanceable() const {
399  return (GetMemberType()&1) != 0;
400  }
401 
403  virtual MemberType GetMemberType() const = 0;
404 
407  virtual Data Get() const = 0;
408 
409  };
410 
412  {StaticMember::RegularType, "RegularType"},
413  {StaticMember::EventType, "EventType"},
414  {StaticMember::EnumType, "EnumType"},
415  {StaticMember::Namespace, "Namespace"},
416  {StaticMember::DataMember, "DataMember"},
417  {StaticMember::Function, "Function"},
418  {StaticMember::Constant, "Constant"},
419  );
420 
422  public:
423  StaticDataMember(const std::string &name, const std::string &help, const Type *type,
424  bool constant, bool ref, bool readonly) :
426  {
427  }
428 
429  StaticDataMember(const std::string& name, const std::string& help, const Type *type) :
430  StaticDataMember(name, help, type, false, false, false) { }
431 
432  template <class ...P_>
433  StaticDataMember(const std::string& name, const std::string& help, const Type *type, Tag first, P_ ...rest) :
434  StaticDataMember(name, help, type, false, false, false) {
435  UnpackTags(first);
436  UnpackTags(rest...);
437  }
438 
439 
440  virtual MemberType GetMemberType() const override {
442  }
443 
445  void Set(Data &newval) {
446  if(readonly) {
447  throw ReadOnlyException(name);
448  }
449 
450  set(newval);
451  }
452 
454  virtual Data Get() const override {
455  Data d=get();
456  ASSERT(!reference || d.IsReference(), "The value returned from "+name+" should be a reference");
457  if(constant)
458  d.MakeConstant();
459 
460  return d;
461  }
462 
464  const Type &GetType() const {
465  return *type;
466  }
467 
469  bool IsConstant() const {
470  return constant;
471  }
472 
474  bool IsReference() const {
475  return reference;
476  }
477 
481  bool IsReadonly() const {
482  return readonly;
483  }
484 
485 
486  protected:
487 
491  virtual void set(Data &newval) = 0;
492 
494  virtual Data get() const = 0;
495 
497  const Type *type;
498 
500  bool constant;
501 
503  bool reference;
504 
506  bool readonly;
507 
508  private:
509  void UnpackTags() {}
510 
511  template<class ...Params_>
512  void UnpackTags(Tag tag, Params_ ...tags) {
513  switch(tag) {
514  case ConstTag:
515  constant=true;
516  break;
517 
518  case ReferenceTag:
519  reference=true;
520  break;
521 
522  case ReadonlyTag:
523  readonly=true;
524  break;
525 
526  default:
527  Utils::ASSERT_FALSE("Unknown tag");
528  }
529  UnpackTags(tags...);
530  }
531  };
532 
533 
535 
557  class Function : public StaticMember {
558  friend class Type;
559  public:
560 
588  class Overload {
589  friend class Function;
590  public:
592  template<class ...P_>
595  {
596  using std::swap;
597  swap(parameters, this->parameters);
598 
599  unpacktags(tags...);
600  }
601 
604  bool accessible, bool constant, bool returnsref, bool returnsconst, bool implicit) :
608  {
609  using std::swap;
610  swap(parameters, this->parameters);
611  }
612 
613  virtual ~Overload() { }
614 
616  bool IsSame(const Overload &var) const;
617 
622  bool StretchLast() const {
623  return stretchlast;
624  }
625 
630  bool RepeatLast() const {
631  return repeatlast;
632  }
633 
635  bool IsConstant() const {
636  return constant;
637  }
638 
640  bool ReturnsRef() const {
641  return returnsref;
642  }
643 
645  bool ReturnsConst() const {
646  return returnsconst;
647  }
648 
650  const Function &GetParent() const {
651  ASSERT(parent, "Parent is not set");
652 
653  return *parent;
654  }
655 
657  bool HasReturnType() const {
658  return returntype!=nullptr;
659  }
660 
662  const Type &GetReturnType() const {
663  ASSERT(returntype, "This function does not return a value");
664 
665  return *returntype;
666  }
667 
669  bool IsImplicit() const {
670  return implicit;
671  }
672 
678  virtual Data Call(bool ismethod, const std::vector<Data> &parameters) const = 0;
679 
682 
683  protected:
684 
686  void unpacktags() {}
687 
688  template<class ...P_>
689  void unpacktags(Tag tag, P_ ...rest) {
690  switch(tag) {
691  case ConstTag:
692  constant=true;
693  break;
694 
695  case StretchTag:
696  stretchlast=true;
697  break;
698 
699  case RepeatTag:
700  repeatlast=true;
701  break;
702 
703  case PublicTag:
704  accessible=true;
705  break;
706 
707  case PrivateTag:
708  accessible=false;
709  break;
710 
711  case ReferenceTag:
712  returnsref=true;
713  break;
714 
715  case ReturnsConstTag:
716  returnsconst=true;
717  break;
718 
719  case ImplicitTag:
720  implicit=true;
721  break;
722 
723  default:
724  ASSERT(false, "Unknown tag", 2, 16);
725  }
726 
727  unpacktags(rest...);
728  }
730 
733  virtual void dochecks(bool ismethod);
734 
737 
739  const Type *returntype = nullptr;
740 
743  bool stretchlast = false;
744 
747  bool repeatlast = false;
748 
751  bool accessible = true;
752 
754  bool constant = false;
755 
757  bool returnsref = false;
758 
760  bool returnsconst = false;
761 
764 
766  bool implicit = false;
767  };
768 
770  template<class ...P_>
771  Function(const std::string &name, const std::string &help, const Type *parent,
772  const Containers::Collection<Overload> &overloads, const Containers::Collection<Overload> &methods,
773  Tag tag, P_ ...tags) :
774  StaticMember(name, help), parent(parent), Overloads(this->overloads), Methods(this->methods)
775  {
776 
777  unpacktags(tag);
778  unpacktags(tags...);
779 
780  for(auto &variant : overloads) {
781  AddOverload(variant);
782  }
783 
784  for(auto &variant : methods) {
785  AddMethod(variant);
786  }
787 
788  init();
789  }
790 
792  template<class ...P_>
793  Function(const std::string &name, const std::string &help, const Type *parent,
794  const Containers::Collection<Overload> &overloads, Tag tag, P_ ...tags) :
795  StaticMember(name, help), parent(parent), Overloads(this->overloads), Methods(this->methods)
796  {
797  unpacktags(tag);
798  unpacktags(tags...);
799 
800  for(auto &overload : overloads) {
801  AddOverload(overload);
802  }
803 
804  init();
805  }
806 
808  template<class ...P_>
809  Function(const std::string &name, const std::string &help, const Type *parent,
811  ) :
812  StaticMember(name, help), parent(parent), Overloads(this->overloads), Methods(this->methods)
813  {
814  for(auto &overload : overloads) {
815  AddOverload(overload);
816  }
817 
818  for(auto &overload : methods) {
819  AddMethod(overload);
820  }
821 
822  init();
823  }
824 
826  template<class ...P_>
827  Function(const std::string &name, const std::string &help, const Type *parent,
828  bool keyword, bool isoperator, bool staticmember) :
829  Function(name, help, parent, Containers::Collection<Overload>()) {
830  this->keyword=keyword;
831  this->isoperator=isoperator;
832  this->staticmember=staticmember;
833 
834  init();
835  }
836 
837  Function(const Function &) = delete;
838 
839  virtual ~Function() {
840  overloads.Destroy();
841  methods.Destroy();
842  }
843 
844  virtual MemberType GetMemberType() const override {
845  return StaticMember::Function;
846  }
847 
848  virtual Data Get() const override final;
849 
850  virtual void SetParent(const Member &parent) override final;
851 
853  bool IsKeyword() const {
854  return keyword;
855  }
856 
858  bool IsStatic() const {
859  return staticmember;
860  }
861 
863  bool IsMember() const {
864  return parent!=nullptr;
865  }
866 
868  bool IsOperator() const {
869  return isoperator;
870  }
871 
874  const Type &GetOwner() const {
875  ASSERT(parent, "This function does not have an owner.", 1, 5);
876 
877  return *parent;
878  }
879 
881  virtual void AddOverload(Overload &overload) {
882  ASSERT(
883  !isoperator || overload.parameters.size()==1,
884  "Operators should have only a single parameter\n"
885  "in function "+name, 1, 3
886  );
887 
888  overload.parent=this;
889  for(const auto &v : overloads) {
890  if(overload.IsSame(v)) {
891  throw AmbiguousSymbolException(name, SymbolType::Function, "Ambiguous function variant");
892  }
893  }
894 
895 #ifndef NDEBUG
896  overload.dochecks(false);
897 #endif
898  overloads.Push(overload);
899  }
900 
902  virtual void AddMethod(Overload &overload) {
903  ASSERT(!isoperator, "Operators cannot be methods\n in function "+name, 1, 3);
904 
905  overload.parent=this;
906  for(const auto &v : methods) {
907  if(overload.IsSame(v)) {
908  throw AmbiguousSymbolException(name, SymbolType::Function, "Ambiguous function variant");
909  }
910  }
911 
912 #ifndef NDEBUG
913  overload.dochecks(true);
914 #endif
915  methods.Push(overload);
916  }
917 
919  virtual void AddOverload(Overload *overload) {
920  ASSERT(overload, "Empty variant\n in function "+name);
921 
922  AddOverload(*overload);
923  }
924 
926  virtual void AddMethod(Overload *overload) {
927  ASSERT(overload, "Empty variant\n in function "+name);
928 
929  AddMethod(*overload);
930  }
931 
934 
937 
938  private:
939 
941  void unpacktags() {}
942 
943  template<class ...P_>
944  void unpacktags(Tag tag, P_ ...rest) {
945  switch(tag) {
946  case KeywordTag:
947  keyword=true;
948  break;
949 
950  case StaticTag:
951  staticmember=true;
952  ASSERT(!isoperator, "A function cannot be a static operator");
953  break;
954 
955  case OperatorTag:
956  isoperator=true;
957  ASSERT(!staticmember, "A function cannot be a static operator");
958  ASSERT(parent, "Operators should be member functions");
959 
960  break;
961 
962  default:
963  ASSERT(false, "Unknown tag", 2, 16);
964  }
965 
966  unpacktags(rest...);
967  }
968 
969  void init();
971 
972 
973  const Type *parent = nullptr;
974 
975  bool keyword = false;
976 
977  bool isoperator = false;
978 
979  bool staticmember = false;
980 
981  Containers::Collection<Overload> overloads;
982 
983  Containers::Collection<Overload> methods;
984  };
985 
989  class InstanceMember : public Member {
990  friend class Type;
991  public:
992 
994  InstanceMember(const std::string &name, const std::string &help,
995  const Type &type, bool constant=false, bool ref=false, bool readonly=false) :
997  {
998  }
999 
1000  virtual bool IsInstanceMember() const override final { return true; }
1001 
1003  const Type &GetType() const {
1004  return *type;
1005  }
1006 
1008  Data Get( Data &source) const {
1009  Data d=get(source);
1010  ASSERT(!reference || d.IsReference(), "The value returned from "+name+" should be a reference");
1011  if(constant)
1012  d.MakeConstant();
1013 
1014  return d;
1015  }
1016 
1019  void Set(Data &source, Data &value) const {
1020  if(readonly) {
1021  throw ReadOnlyException(name);
1022  }
1023 
1024  set(source, value);
1025  }
1027  bool IsConstant() const {
1028  return constant;
1029  }
1030 
1032  bool IsReference() const {
1033  return reference;
1034  }
1035 
1039  bool IsReadonly() const {
1040  return readonly;
1041  }
1042 
1043  virtual ~InstanceMember() { }
1044 
1045  protected:
1047  virtual void set(Data &source, Data &value) const = 0;
1048 
1050  virtual Data get( Data &source) const = 0;
1051 
1053  virtual void typecheck(const Type *type) const = 0;
1054 
1056  const Type *type;
1057 
1059  bool constant;
1060 
1063 
1065  bool readonly;
1066  };
1067 
1069 
1073  class Namespace : public StaticMember {
1074  public:
1075  Namespace(const std::string &name, const std::string &help) : StaticMember(name, help),
1076  Members(members) {
1077  }
1078 
1079  virtual MemberType GetMemberType() const override {
1080  return StaticMember::DataMember;
1081  }
1082 
1083  virtual Data Get() const override {
1084  return {Types::Namespace(), dynamic_cast<const Namespace*>(this), true, true};
1085  }
1086 
1088  virtual void AddMember(StaticMember &member) {
1089  ASSERT(!members.Find(member.GetName()).IsValid(), "Symbol "+member.GetName()+" is already added.");
1090 
1091  members.Add(member);
1092  member.SetParent(*this);
1093  }
1095  virtual void AddMember(StaticMember *member) {
1096  ASSERT(member!=nullptr, "Member is null");
1097  ASSERT(!members.Find(member->GetName()).IsValid(), "Symbol "+member->GetName()+" is already added.");
1098 
1099  members.Add(member);
1100  member->SetParent(*this);
1101  }
1102 
1104  virtual void AddMembers(std::initializer_list<StaticMember*> newmembers) {
1105  for(auto member : newmembers) {
1106  ASSERT(member!=nullptr, "Member is null");
1107  ASSERT(!members.Find(member->GetName()).IsValid(), "Symbol "+member->GetName()+" is already added.");
1108 
1109  members.Add(member);
1110  member->SetParent(*this);
1111  }
1112  }
1113 
1115  virtual void AddMembers(std::vector<StaticMember*> newmembers) {
1116  for(auto member : newmembers) {
1117  ASSERT(member!=nullptr, "Member is null");
1118  ASSERT(!members.Find(member->GetName()).IsValid(), "Symbol "+member->GetName()+" is already added.");
1119 
1120  members.Add(member);
1121  member->SetParent(*this);
1122  }
1123  }
1124 
1128  const Namespace &GetNamespace(const std::string &name) const;
1129 
1132  const Type &GetType(const std::string &name) const;
1133 
1136  const Scripting::Function &GetFunction(const std::string &name) const;
1137 
1139  Data ValueOf(const std::string &name) const {
1140  auto elm=members.Find(name);
1141  if(!elm.IsValid())
1142  throw SymbolNotFoundException(name, SymbolType::Identifier,"Symbol "+name+" cannot be found.");
1143 
1144  return elm.Current().second.Get();
1145  }
1146 
1149 
1150  protected:
1151 
1153  };
1154 
1165  class Type : public Namespace {
1166  public:
1167 
1169  enum MorphType {
1172 
1175 
1178 
1181 
1184 
1185  };
1186 
1187  class Inheritance {
1188  friend class Type;
1189 
1190  public:
1191  using ConversionFunction = std::function<Data(Data)>;
1192 
1194  target(target), from(from), to(to) { }
1195 
1196  const Type &target;
1197 
1198  private:
1199  ConversionFunction from, to;
1200  };
1201 
1202  Type(const std::string &name, const std::string &help, const Any &defaultvalue,
1203  TMP::RTTH *typeinterface, bool isref);
1204 
1205  virtual MemberType GetMemberType() const override { return StaticMember::RegularType; }
1206 
1207  virtual Data Get() const override {
1208  Type *TypeType( );
1209 
1210  return {TypeType(), dynamic_cast<const Type*>(this), true, true};
1211  }
1212 
1214  virtual void AddMember(StaticMember &member) override {
1215  ASSERT(!instancemembers.Find(member.GetName()).IsValid(), "Symbol "+member.GetName()+" is already added.");
1216 
1217  Namespace::AddMember(member);
1218  }
1219 
1221  virtual void AddMember(StaticMember *member) override {
1222  ASSERT(!instancemembers.Find(member->GetName()).IsValid(), "Symbol "+member->GetName()+" is already added.");
1223 
1224  Namespace::AddMember(member);
1225  }
1226 
1228  virtual void AddMembers(std::initializer_list<StaticMember*> newmembers) override {
1229  for(auto member : newmembers) {
1230  ASSERT(!instancemembers.Find(member->GetName()).IsValid(), "Symbol "+member->GetName()+" is already added.");
1231 
1232  Namespace::AddMember(*member);
1233  }
1234  }
1235 
1237  virtual void AddMembers(std::vector<StaticMember*> newmembers) override {
1238  for(auto member : newmembers) {
1239  ASSERT(!instancemembers.Find(member->GetName()).IsValid(), "Symbol "+member->GetName()+" is already added.");
1240 
1241  Namespace::AddMember(*member);
1242  }
1243  }
1244 
1246  virtual void AddMember(InstanceMember &member) {
1247  member.typecheck(this);
1248 
1249  ASSERT(!members.Find(member.GetName()).IsValid(), "Symbol "+member.GetName()+" is already added.");
1250  ASSERT(!instancemembers.Find(member.GetName()).IsValid(), "Symbol "+member.GetName()+" is already added.");
1251 
1252  instancemembers.Add(member);
1253  member.SetParent(*this);
1254  }
1255 
1257  virtual void AddMember(InstanceMember *member) {
1258  member->typecheck(this);
1259 
1260  ASSERT(member!=nullptr, "Member is null");
1261 
1262  ASSERT(!members.Find(member->GetName()).IsValid(), "Symbol "+member->GetName()+" is already added.");
1263  ASSERT(!instancemembers.Find(member->GetName()).IsValid(), "Symbol "+member->GetName()+" is already added.");
1264 
1265  instancemembers.Add(member);
1266  member->SetParent(*this);
1267  }
1268 
1270  virtual void AddMembers(std::initializer_list<InstanceMember*> newmembers) {
1271  for(auto member : newmembers) {
1272  member->typecheck(this);
1273 
1274  ASSERT(member!=nullptr, "Member is null");
1275  ASSERT(!members.Find(member->GetName()).IsValid(), "Symbol "+member->GetName()+" is already added.");
1276  ASSERT(!instancemembers.Find(member->GetName()).IsValid(), "Symbol "+member->GetName()+" is already added.");
1277 
1278  instancemembers.Add(member);
1279  member->SetParent(*this);
1280  }
1281  }
1282 
1284  virtual void AddMembers(std::vector<InstanceMember*> newmembers) {
1285  for(auto member : newmembers) {
1286  member->typecheck(this);
1287 
1288  ASSERT(member!=nullptr, "Member is null");
1289  ASSERT(!members.Find(member->GetName()).IsValid(), "Symbol "+member->GetName()+" is already added.");
1290  ASSERT(!instancemembers.Find(member->GetName()).IsValid(), "Symbol "+member->GetName()+" is already added.");
1291 
1292  instancemembers.Add(member);
1293  member->SetParent(*this);
1294  }
1295  }
1296 
1298  void AddConstructors(std::initializer_list<Function::Overload*> elements) {
1299  for(auto element : elements) {
1300  ASSERT((element != nullptr), "Given element cannot be nullptr", 1, 2);
1301  ASSERT(element->HasReturnType() && element->GetReturnType()==this,
1302  "Given constructor should return this ("+name+") type", 1, 2);
1303 
1304  constructor.AddOverload(*element);
1305  }
1306  }
1307 
1310  ASSERT(element.HasReturnType() && element.GetReturnType()==this,
1311  "Given constructor should return this ("+name+") type", 1, 2);
1312 
1313  constructor.AddOverload(element);
1314  }
1315 
1320 
1323  return defaultvalue;
1324  }
1325 
1327  bool IsReferenceType() const {
1328  return referencetype;
1329  }
1330 
1332  Data MorphTo(const Type &type, Data source, bool allowtypecast=true) const;
1333 
1335  MorphType CanMorphTo(const Type &type) const;
1336 
1338  bool operator ==(const Type &other) const {
1339  return this==&other;
1340  }
1341 
1342  bool operator ==(const Type *other) const {
1343  return this==other;
1344  }
1345 
1347  bool operator !=(const Type &other) const {
1348  return this!=&other;
1349  }
1350 
1351  bool operator !=(const Type *other) const {
1352  return this!=other;
1353  }
1354 
1356  operator const Type *() const {
1357  return this;
1358  }
1359 
1363  const Function::Overload *GetTypeCastingFrom(const Type *other, bool implicit=true) const {
1364  for(const auto &ctor : constructor.Overloads) {
1365  if(ctor.Parameters.size()==1 && ctor.Parameters[0].GetType()==other &&
1366  (!implicit || ctor.IsImplicit())
1367  ) {
1368  return &ctor;
1369  }
1370  }
1371 
1372  return nullptr;
1373  }
1374 
1376  Data Construct(const std::vector<Data> &parameters) const;
1377 
1379  void Delete(const Data &obj) const {
1380  deleteobject(obj);
1381  }
1382 
1384  bool Compare(const Data &l, const Data &r) const;
1385 
1388  virtual std::string ToString(const Data &) const = 0;
1389 
1391  virtual Data Parse(const std::string &) const = 0;
1392 
1394  virtual void Assign(Data &l, const Data &r) const = 0;
1395 
1396 
1400 
1402  const std::map<const Type *, const Type *> &Parents;
1403 
1405  const std::map<const Type *, Inheritance> &InheritsFrom;
1406 
1409 
1411 
1415 
1417  virtual ~Type() {
1418  delete &TypeInterface;
1420  }
1421 
1422  protected:
1423 
1425  virtual void deleteobject(const Data &) const=0;
1426 
1429  virtual bool compare(const Data &l, const Data &r) const { throw std::runtime_error("These elements cannot be compared"); }
1430 
1433 
1437 
1441 
1443  std::map<const Type *, Inheritance> inheritsfrom;
1444 
1447 
1449  std::map<const Type *, const Type *> parents;
1450 
1452  bool referencetype = false;
1453  };
1454 
1458  class Constant : public StaticMember {
1459  public:
1460  Constant(const std::string &name, const std::string &help, Data value) :
1462  ASSERT(value.IsValid(), "A constant cannot have an invalid value");
1463  this->value.MakeConstant();
1464  }
1465 
1466  virtual Data Get() const override final {
1467  return value;
1468  }
1469 
1470  virtual MemberType GetMemberType() const override final {
1471  return StaticMember::Constant;
1472  }
1473 
1475  const Type &GetType() const {
1476  return value.GetType();
1477  }
1478 
1479  protected:
1481  };
1482 
1484  inline std::ostream &operator <<(std::ostream &out, const Type &type) {
1485  out<<type.GetName();
1486  return out;
1487  }
1488 
1491  class EventType : public Type {
1492  public:
1493  EventType(const std::string &name, const std::string &help, const Any &defaultvalue,
1494  TMP::RTTH *typeinterface, const Type *ret, ParameterList parameters) :
1495  Type(name, help, defaultvalue, typeinterface, true), Parameters(this->parameters), returntype(ret) {
1496  using std::swap;
1497 
1498  swap(parameters, this->parameters);
1499  }
1500 
1501  virtual MemberType GetMemberType() const override {
1502  return StaticMember::EventType;
1503  }
1504 
1505  virtual Data Get() const override final {
1506  return {Types::EventType(), dynamic_cast<const EventType*>(this), true, true};
1507  }
1508 
1510  bool HasReturnType() const {
1511  return returntype!=nullptr;
1512  }
1513 
1515  const Type &GetReturnType() const {
1516  ASSERT(returntype, "This event does not allow returns");
1517 
1518  return *returntype;
1519  }
1520 
1521  virtual void Assign(Data &l, const Data &r) const override {
1522  }
1523 
1524 
1527 
1528  protected:
1531 
1534  };
1535 
1540  class EnumType : public Type {
1541  public:
1543  ElementInitializer(std::string name, std::string help, Any value) : name(name), help(help), value(value) { }
1544 
1545  std::string name;
1546  std::string help;
1548  };
1549 
1550  EnumType(const std::string& name, const std::string& help,
1551  const std::vector<ElementInitializer> &elements,
1552  TMP::RTTH* typeinterface) :
1553  Type(name, help, elements[0].value, typeinterface, false), Ordered(ordered)
1554  {
1555  for(const ElementInitializer &element : elements) {
1556  auto elm=new Scripting::Constant(element.name, element.help, {this, element.value});
1557  ordered.push_back(elm);
1558  AddMember(elm);
1559  }
1560  }
1561 
1562  virtual MemberType GetMemberType() const override {
1563  return StaticMember::EnumType;
1564  }
1565 
1566  virtual Data Get() const override final {
1567  return {Types::EnumType(), dynamic_cast<const EnumType*>(this), true, true};
1568  }
1569 
1571  const std::vector<const Scripting::Constant*> &Ordered;
1572 
1573  protected:
1574 
1575  EnumType(const std::string& name, const std::string& help, Any defval,
1576  TMP::RTTH* typeinterface) :
1577  Type(name, help, defval, typeinterface, false), Ordered(ordered)
1578  { }
1579 
1580  void add(const ElementInitializer &element) {
1581  auto elm=new Scripting::Constant(element.name, element.help, {this, element.value});
1582  ordered.push_back(elm);
1583  AddMember(elm);
1584  }
1585 
1586  private:
1587  std::vector<const Scripting::Constant*> ordered;
1588 
1589  };
1590 
1596  class Library : public Namespace {
1597  public:
1599  Library(const std::string &name, const std::string &help) : Namespace(name, help) {
1600  }
1601 
1603  }
1604 
1605  virtual void SetParent(const Member &parent) override {
1606  Utils::ASSERT_FALSE("Cannot set parent of a library");
1607  }
1608  };
1609  }
1610 }
Gorgon::Scripting::Function::Overload::dochecks
virtual void dochecks(bool ismethod)
This function should perform validity checks on the variant.
Definition: Reflection.cpp:295
Gorgon::Scripting::Type::Parse
virtual Data Parse(const std::string &) const =0
Parses a string into this data. This function is allowed to throw.
Gorgon::Scripting::InstanceMember::GetType
const Type & GetType() const
Returns the type of this data member.
Definition: Reflection.h:1003
Gorgon::Scripting::Function::Overload::Overload
Overload(const Type *returntype, ParameterList parameters, bool stretchlast, bool repeatlast, bool accessible, bool constant, bool returnsref, bool returnsconst, bool implicit)
A full constructor.
Definition: Reflection.h:603
Gorgon::Scripting::Parameter::IsOptional
bool IsOptional() const
Checks if the parameter is optional.
Definition: Reflection.h:228
Gorgon::Scripting::EventType::HasReturnType
bool HasReturnType() const
Returns whether event handlers should return a value.
Definition: Reflection.h:1510
Gorgon::Scripting::StaticDataMember::get
virtual Data get() const =0
This function should return the data. It is overloaded to enforce modifiers.
Gorgon::Scripting::EnumType::EnumType
EnumType(const std::string &name, const std::string &help, Any defval, TMP::RTTH *typeinterface)
Definition: Reflection.h:1575
Gorgon::Scripting::Function::AddOverload
virtual void AddOverload(Overload &overload)
Adds the given overload to this function after performing necessary checks.
Definition: Reflection.h:881
Gorgon::swap
void swap(Event< Source_, Args_... > &l, Event< Source_, Args_... > &r)
Swaps two events.
Definition: Event.h:351
Gorgon::Scripting::Function::AddMethod
virtual void AddMethod(Overload *overload)
Adds the given overload as a method to this function after performing necessary checks.
Definition: Reflection.h:926
Gorgon::Scripting::Namespace::ValueOf
Data ValueOf(const std::string &name) const
Convenience function, returns the value of the symbol with the given name.
Definition: Reflection.h:1139
Gorgon::Scripting::StaticDataMember::Get
virtual Data Get() const override
Gets data from the datamember.
Definition: Reflection.h:454
Gorgon::Scripting::StaticDataMember::GetMemberType
virtual MemberType GetMemberType() const override
Returns the type of this member.
Definition: Reflection.h:440
Gorgon::Scripting::Type::ToString
virtual std::string ToString(const Data &) const =0
Converts a data of this type to string.
Gorgon::String::From
std::enable_if< decltype(gorgon__enum_tr_loc(T_()))::isupgradedenum, std::string >::type From(const T_ &e)
Definition: Enum.h:303
Gorgon::Scripting::StaticDataMember::IsReference
bool IsReference() const
Returns whether this member is a reference.
Definition: Reflection.h:474
Gorgon::Scripting::EventType::EventType
EventType(const std::string &name, const std::string &help, const Any &defaultvalue, TMP::RTTH *typeinterface, const Type *ret, ParameterList parameters)
Definition: Reflection.h:1493
Gorgon::Scripting::Function::Overload::HasReturnType
bool HasReturnType() const
Returns whether this variant returns a value.
Definition: Reflection.h:657
Gorgon::Scripting::InputTag
@ InputTag
Marks the object as input.
Definition: Reflection.h:64
Gorgon::Resource::GID::Data
constexpr Type Data
Data resource.
Definition: GID.h:164
Gorgon::Scripting::EventType::GetReturnType
const Type & GetReturnType() const
Returns the return type expected from the handlers.
Definition: Reflection.h:1515
Gorgon::Scripting::ReadonlyTag
@ ReadonlyTag
Marks a data member readonly, so that it can be manipulated, but cannot be changed.
Definition: Reflection.h:111
Gorgon::Scripting::Function::IsOperator
bool IsOperator() const
Returns if this function is an operator.
Definition: Reflection.h:868
Gorgon::Scripting::Function::Get
virtual Data Get() const override final
Returns the value of this static member.
Definition: Reflection.cpp:380
Gorgon::Scripting::Type::InstanceMembers
const InstanceMemberList & InstanceMembers
Definition: Reflection.h:1410
Gorgon::Scripting::Constant::value
Data value
Definition: Reflection.h:1480
Gorgon::Scripting::Namespace::AddMembers
virtual void AddMembers(std::initializer_list< StaticMember * > newmembers)
Adds a list of members to this namespace.
Definition: Reflection.h:1104
Gorgon::Scripting::Member::SetParent
virtual void SetParent(const Member &parent)
Changes the parent of the member.
Definition: Reflection.h:350
Gorgon::Scripting::Function::Overload::Overload
Overload(const Type *returntype, ParameterList parameters, P_ ...tags)
Regular constructor that can take as many tags as needed.
Definition: Reflection.h:593
Gorgon::Scripting::EnumType::Get
virtual Data Get() const override final
Returns the value of this static member.
Definition: Reflection.h:1566
Gorgon::Scripting::OperatorTag
@ OperatorTag
Makes a function operator.
Definition: Reflection.h:92
Gorgon::Scripting::PublicTag
@ PublicTag
Makes the object public, allowing it to be accessed from all.
Definition: Reflection.h:86
Gorgon::Scripting::Type::Inheritance
Definition: Reflection.h:1187
Gorgon::Scripting::Types::Constant
const Scripting::Type & Constant()
Gorgon::Scripting::ReferenceCounter::Register
void Register(const Data &data)
Registers a new object of reference counting, this will set reference count to one.
Definition: Runtime.h:24
Gorgon::Scripting::InstanceMember::typecheck
virtual void typecheck(const Type *type) const =0
Type checks the parent.
Gorgon::Scripting::Function::Overload::Call
virtual Data Call(bool ismethod, const std::vector< Data > &parameters) const =0
Class the stub for this function.
Gorgon::Scripting::Type::AddMembers
virtual void AddMembers(std::initializer_list< StaticMember * > newmembers) override
Adds a list of static members to this type.
Definition: Reflection.h:1228
Gorgon::Scripting::Type::Delete
void Delete(const Data &obj) const
Deletes the object.
Definition: Reflection.h:1379
Gorgon::Containers::Hashmap< std::string, const StaticMember, GetNameOf< StaticMember >, std::map, String::CaseInsensitiveLess >
Gorgon::Scripting::Parameter::GetDefaultValue
Data GetDefaultValue() const
Returns the default value for this parameter.
Definition: Reflection.h:254
Gorgon::Scripting::Type::TypeInterface
TMP::RTTH & TypeInterface
Type interface used for this type.
Definition: Reflection.h:1414
Gorgon::Scripting::InstanceMember::IsInstanceMember
virtual bool IsInstanceMember() const override final
Returns if this member is an instance member.
Definition: Reflection.h:1000
Gorgon::Any
This class can hold any other information providing type erasure.
Definition: Any.h:32
Gorgon::Scripting::EnumType::GetMemberType
virtual MemberType GetMemberType() const override
Returns the type of this member.
Definition: Reflection.h:1562
Gorgon::Scripting::Function::SetParent
virtual void SetParent(const Member &parent) override final
Changes the parent of the member.
Definition: Reflection.cpp:365
Gorgon::Scripting::Function::Overload::IsConstant
bool IsConstant() const
Returns whether this function is a constant.
Definition: Reflection.h:635
Gorgon::Scripting::Tag
Tag
Tags define behavior of reflection objects.
Definition: Reflection.h:54
Gorgon::Scripting::VirtualMachine::References
ReferenceCounter References
This system allows objects of automatic lifetime.
Definition: VirtualMachine.h:222
Gorgon::Scripting::EventType::parameters
ParameterList parameters
Parameters that every event handler should accept.
Definition: Reflection.h:1530
Gorgon::Scripting::ReturnsConstTag
@ ReturnsConstTag
Denotes a function that returns const.
Definition: Reflection.h:98
Reflection.h
Gorgon::Scripting::operator<<
std::ostream & operator<<(std::ostream &out, const Data &data)
This function parses the code and returns any syntax errors.
Definition: Scripting.h:73
Gorgon::Scripting::StaticDataMember::reference
bool reference
This instance member is a reference.
Definition: Reflection.h:503
Gorgon::Scripting::Type::UpCasting
@ UpCasting
This is an upcasting, but not a direct one.
Definition: Reflection.h:1177
Gorgon::Scripting::Function::Overload::returntype
const Type * returntype
Return type of this function variant. If nullptr this function does not return a value.
Definition: Reflection.h:739
Gorgon::Scripting::PrivateTag
@ PrivateTag
Makes the object private, allowing only access from it parent.
Definition: Reflection.h:83
Gorgon::Scripting::StaticDataMember::StaticDataMember
StaticDataMember(const std::string &name, const std::string &help, const Type *type)
Definition: Reflection.h:429
Gorgon::Scripting::Type::DownCasting
@ DownCasting
This is a down casting.
Definition: Reflection.h:1180
Gorgon::Scripting::Parameter::Parameter
Parameter(const std::string &name, const std::string &help, const Type *type, Data defaultvalue, OptionList options, Params_ ...tags)
Constructs a new parameter.
Definition: Reflection.h:144
Gorgon::Scripting::Function::Overload::implicit
bool implicit
If the parent function is constructor, marks this variant as an implicit type conversion.
Definition: Reflection.h:766
Gorgon::Scripting::Data
Data describes a piece of data.
Definition: Data.h:22
Gorgon::Scripting::Type::AddMembers
virtual void AddMembers(std::vector< InstanceMember * > newmembers)
Adds an instance member to this type.
Definition: Reflection.h:1284
Gorgon::Scripting::Type::InheritedSymbols
const Containers::Hashmap< std::string, const Type, nullptr, std::map, String::CaseInsensitiveLess > & InheritedSymbols
Inherited symbols.
Definition: Reflection.h:1408
Gorgon::Scripting::MethodTag
@ MethodTag
Marks the object as output. This may set ReferenceTag and unset InputTag.
Definition: Reflection.h:70
Gorgon::Scripting::Namespace::AddMembers
virtual void AddMembers(std::vector< StaticMember * > newmembers)
Adds a list of members to this namespace.
Definition: Reflection.h:1115
Gorgon::WindowManager::init
void init()
Definition: X11.cpp:143
Gorgon::Scripting::Type::parents
std::map< const Type *, const Type * > parents
This lists all parents of this type in the entire hierarchy.
Definition: Reflection.h:1449
Gorgon::Scripting::StaticDataMember::readonly
bool readonly
Marks this instance as read-only.
Definition: Reflection.h:506
Gorgon::Scripting::Type::AddMember
virtual void AddMember(InstanceMember *member)
Adds a list of instance members to this type.
Definition: Reflection.h:1257
Gorgon::Scripting::ParameterList
std::vector< Parameter > ParameterList
Definition: Reflection.h:308
Gorgon::Scripting::Type::Constructor
const Scripting::Function & Constructor
Constructors of this type.
Definition: Reflection.h:1399
Gorgon::Scripting::Parameter::operator=
Parameter & operator=(const Parameter &p)
Copy assignment.
Definition: Reflection.h:184
Gorgon::Scripting::Namespace::Members
const StaticMemberList & Members
List of static members.
Definition: Reflection.h:1148
Gorgon::Scripting::Parameter::GetName
std::string GetName() const
Returns the name of the parameter.
Definition: Reflection.h:213
Gorgon::Scripting::InstanceMember::Get
Data Get(Data &source) const
Gets data from the datamember.
Definition: Reflection.h:1008
Gorgon::Scripting::EnumType::ElementInitializer::name
std::string name
Definition: Reflection.h:1545
Gorgon::Scripting::GetNameOf
std::string GetNameOf(const T_ &val)
Definition: Reflection.h:44
Gorgon::Scripting::Function::GetOwner
const Type & GetOwner() const
If this function is a member function, returns the owner object.
Definition: Reflection.h:874
Gorgon::Scripting::Function::Overload::RepeatLast
bool RepeatLast() const
Returns if the last parameter of this function should be repeated.
Definition: Reflection.h:630
Gorgon::Scripting::Type::GetTypeCastingFrom
const Function::Overload * GetTypeCastingFrom(const Type *other, bool implicit=true) const
This function returns type casting function from a given type to this one.
Definition: Reflection.h:1363
Gorgon::Scripting::Types::InstanceMember
const Scripting::Type & InstanceMember()
Gorgon::Scripting::StaticDataMember::constant
bool constant
This instance member is a constant.
Definition: Reflection.h:500
Gorgon::Containers::Hashmap::Add
void Add(const K_ &key, T_ &obj, bool deleteprev=false)
Adds the given item with the related key.
Definition: Hashmap.h:264
Gorgon::TMP::RTTH
Runtime Type Hierarchy.
Definition: TMP.h:364
Gorgon::Scripting::StaticDataMember::StaticDataMember
StaticDataMember(const std::string &name, const std::string &help, const Type *type, bool constant, bool ref, bool readonly)
Definition: Reflection.h:423
Gorgon::Scripting::Library::SetParent
virtual void SetParent(const Member &parent) override
Changes the parent of the member.
Definition: Reflection.h:1605
Gorgon::Scripting::Type::Compare
bool Compare(const Data &l, const Data &r) const
This function compares two instances of this type. Both left and right should of this type.
Definition: Reflection.cpp:95
Gorgon::Scripting::Function::IsMember
bool IsMember() const
Returns if this function is a member function of a type.
Definition: Reflection.h:863
Gorgon::Scripting::Function::Overload::accessible
bool accessible
Only meaningful in class member functions.
Definition: Reflection.h:751
Gorgon::Scripting::VirtualMachine::Get
static VirtualMachine & Get()
Returns the current VM for this thread.
Definition: VirtualMachine.h:109
Gorgon::Scripting::Type::operator==
bool operator==(const Type &other) const
Compares two types.
Definition: Reflection.h:1338
Gorgon::Scripting::Type::MorphType
MorphType
There are multiple ways to morph a type to another, this enumeration holds these types.
Definition: Reflection.h:1169
Gorgon::Scripting::Member::parent
const Member * parent
Definition: Reflection.h:358
Gorgon::Scripting::Type::AddInheritance
void AddInheritance(const Type &type, Inheritance::ConversionFunction from, Inheritance::ConversionFunction to)
Adds an inheritance parent.
Definition: Reflection.cpp:257
Gorgon::Scripting::Type::IsReferenceType
bool IsReferenceType() const
Returns whether this type is a reference type.
Definition: Reflection.h:1327
Gorgon::Scripting::Types::StaticDataMember
const Scripting::Type & StaticDataMember()
Gorgon::Scripting::Parameter::GetHelp
std::string GetHelp() const
Returns the help related with this parameter.
Definition: Reflection.h:218
Gorgon::Scripting::EnumType::EnumType
EnumType(const std::string &name, const std::string &help, const std::vector< ElementInitializer > &elements, TMP::RTTH *typeinterface)
Definition: Reflection.h:1550
Gorgon::Scripting::Type::AddConstructors
void AddConstructors(std::initializer_list< Function::Overload * > elements)
Adds the given constructors.
Definition: Reflection.h:1298
Gorgon::Scripting::StaticDataMember::StaticDataMember
StaticDataMember(const std::string &name, const std::string &help, const Type *type, Tag first, P_ ...rest)
Definition: Reflection.h:433
Gorgon::Scripting::MapFunctionToInstanceMember
InstanceMember * MapFunctionToInstanceMember(F_ reader, const std::string &name, const std::string &help, const Type *membertype, const Type *parenttype)
This function will map a const data returning function to a read-only, non-ref, const instance member...
Definition: Embedding.h:1147
Gorgon::Scripting::Type::Inheritance::Inheritance
Inheritance(const Type &target, ConversionFunction from, ConversionFunction to)
Definition: Reflection.h:1193
Gorgon::Scripting::GetHelpOf
std::string GetHelpOf(const T_ &val)
Definition: Reflection.h:49
Gorgon::Utils::ASSERT_FALSE
void ASSERT_FALSE(const std::string &message, int skip=1, int depth=4)
Definition: Assert.h:192
Gorgon::Scripting::Types::Namespace
const Scripting::Type & Namespace()
Definition: Reflection.h:315
Gorgon::Scripting::Data::GetType
const Type & GetType() const
Returns the type of the data.
Definition: Data.h:173
Gorgon::Scripting::EventType::GetMemberType
virtual MemberType GetMemberType() const override
Returns the type of this member.
Definition: Reflection.h:1501
Gorgon::Scripting::InstanceMember::get
virtual Data get(Data &source) const =0
This function should return the value of this member.
Gorgon::Scripting::Function::AddMethod
virtual void AddMethod(Overload &overload)
Adds the given overload as a method to this function after performing necessary checks.
Definition: Reflection.h:902
Gorgon::Scripting::EnumType::Ordered
const std::vector< const Scripting::Constant * > & Ordered
Ordered list of allowed values.
Definition: Reflection.h:1571
Gorgon::Scripting::Type::Parents
const std::map< const Type *, const Type * > & Parents
Parents of this type. This includes indirect parents as well.
Definition: Reflection.h:1402
Gorgon::Scripting::Member
Represents a member of a type.
Definition: Reflection.h:314
Gorgon::Scripting::Parameter::IsReference
bool IsReference() const
Checks if the parameter is a reference.
Definition: Reflection.cpp:362
Gorgon::Scripting::StaticMember::MemberType
MemberType
Possible member types.
Definition: Reflection.h:368
Gorgon::TMP::RTTI::TypeInfo
virtual const std::type_info & TypeInfo() const =0
Gorgon::Scripting::Function::Function
Function(const std::string &name, const std::string &help, const Type *parent, const Containers::Collection< Overload > &overloads, const Containers::Collection< Overload > &methods, Tag tag, P_ ...tags)
Regular constructor with both overloads and methods specified a long with at least a single tag.
Definition: Reflection.h:771
Gorgon::Containers::Hashmap::Destroy
void Destroy()
Deletes and removes all the elements of this map, in addition to destroying data used.
Definition: Hashmap.h:366
Gorgon::Scripting::StaticMember::Namespace
@ Namespace
Namespace, which is also a type.
Definition: Reflection.h:379
Gorgon::Scripting::Parameter::AllowsNull
bool AllowsNull() const
If true, a null reference can be passed to this parameter.
Definition: Reflection.h:249
Gorgon::Scripting::Member::~Member
virtual ~Member()
Definition: Reflection.h:322
Gorgon::Scripting::Function::~Function
virtual ~Function()
Definition: Reflection.h:839
Gorgon::Scripting::Data::MakeConstant
void MakeConstant()
Makes this data a constant.
Definition: Data.cpp:199
Gorgon::Scripting::StaticDataMember::IsConstant
bool IsConstant() const
Returns whether this member is a constant.
Definition: Reflection.h:469
Gorgon::Scripting::Type
This class stores information about types.
Definition: Reflection.h:1165
Gorgon::Scripting::Type::AddConstructor
void AddConstructor(Function::Overload &element)
Adds the given constructor.
Definition: Reflection.h:1309
Gorgon
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
Gorgon::Scripting::InstanceMember::type
const Type * type
Type of the datamember.
Definition: Reflection.h:1056
Gorgon::Scripting::Library
This class represents a library.
Definition: Reflection.h:1596
Gorgon::Scripting::Namespace::members
StaticMemberList members
Definition: Reflection.h:1152
Gorgon::Scripting::Function::Methods
const Containers::Collection< Overload > & Methods
The list of methods this function has.
Definition: Reflection.h:936
Gorgon::Scripting::InstanceMember::IsReference
bool IsReference() const
Returns whether this member is a reference.
Definition: Reflection.h:1032
Gorgon::TMP::RTTH::NormalType
RTTS & NormalType
Definition: TMP.h:375
Gorgon::Scripting::Namespace
Namespace contains other static members as members.
Definition: Reflection.h:1073
Gorgon::Scripting::Library::~Library
~Library()
Definition: Reflection.h:1602
Gorgon::Scripting::Type::referencetype
bool referencetype
Whether this type is a reference type.
Definition: Reflection.h:1452
Gorgon::Scripting::Type::AddMember
virtual void AddMember(InstanceMember &member)
Adds a list of instance members to this type.
Definition: Reflection.h:1246
Gorgon::Scripting::StaticMember::StaticMember
StaticMember(const std::string &name, const std::string &help)
Definition: Reflection.h:391
Gorgon::Scripting::Constant::Get
virtual Data Get() const override final
Returns the value of this static member.
Definition: Reflection.h:1466
Gorgon::Scripting::Type::AlreadMatching
@ AlreadMatching
Already that type.
Definition: Reflection.h:1174
Gorgon::Scripting::Type::Assign
virtual void Assign(Data &l, const Data &r) const =0
Assigns the value of the second parameter to the first, reference types can ignore this function.
Gorgon::Scripting::Namespace::GetMemberType
virtual MemberType GetMemberType() const override
Returns the type of this member.
Definition: Reflection.h:1079
Gorgon::Scripting::RepeatTag
@ RepeatTag
Marks an object as repeatable.
Definition: Reflection.h:73
Gorgon::Scripting::StaticMember::Get
virtual Data Get() const =0
Returns the value of this static member.
Gorgon::Scripting::StaticDataMember::set
virtual void set(Data &newval)=0
Implementers of static data member should overload this function for assignment.
Gorgon::Scripting::Function::Overload::StretchLast
bool StretchLast() const
Returns if the last parameter of this function should be stretched.
Definition: Reflection.h:622
Gorgon::Scripting::Function::Overload::IsImplicit
bool IsImplicit() const
Returns if this variant can be used as implicit conversion.
Definition: Reflection.h:669
Gorgon::Scripting::Parameter::operator==
bool operator==(const Parameter &p) const
Compares two parameters, not very reliable, it does not check defaultvalue and options.
Definition: Reflection.h:200
Gorgon::Scripting::Function::Overload::~Overload
virtual ~Overload()
Definition: Reflection.h:613
Gorgon::Scripting::Data::IsReference
bool IsReference() const
Returns if this data contains a reference.
Definition: Data.cpp:212
Gorgon::Scripting::InstanceMember::IsConstant
bool IsConstant() const
Returns whether this member is a constant.
Definition: Reflection.h:1027
Gorgon::Containers::Hashmap::end
Iterator end()
end iterator
Definition: Hashmap.h:420
Gorgon::Scripting::StaticMember
This is the base class for all static members.
Definition: Reflection.h:365
ASSERT
#define ASSERT(expression, message,...)
Replaces regular assert to allow messages and backtrace.
Definition: Assert.h:161
Gorgon::Scripting::Data::Invalid
static Data Invalid()
Constructs an invalid data object.
Definition: Data.h:27
Gorgon::Scripting::DefineEnumStringsCM
DefineEnumStringsCM(StaticMember, MemberType, {StaticMember::RegularType, "RegularType"}, {StaticMember::EventType, "EventType"}, {StaticMember::EnumType, "EnumType"}, {StaticMember::Namespace, "Namespace"}, {StaticMember::DataMember, "DataMember"}, {StaticMember::Function, "Function"}, {StaticMember::Constant, "Constant"},)
Gorgon::Scripting::Type::AddMember
virtual void AddMember(StaticMember &member) override
Adds a static member to this type.
Definition: Reflection.h:1214
Gorgon::Scripting::StaticDataMember::IsReadonly
bool IsReadonly() const
Returns whether this member is read-only.
Definition: Reflection.h:481
Gorgon::Scripting::Constant
This class represents a static constant.
Definition: Reflection.h:1458
Gorgon::Containers::Collection
Collection is a container for reference typed objects.
Definition: Collection.h:21
Gorgon::Scripting::InstanceMember::InstanceMember
InstanceMember(const std::string &name, const std::string &help, const Type &type, bool constant=false, bool ref=false, bool readonly=false)
Constructor.
Definition: Reflection.h:994
Gorgon::Scripting::Function::Overload::parent
Function * parent
The parent function of this variant.
Definition: Reflection.h:763
Gorgon::Scripting::Type::AddMembers
virtual void AddMembers(std::vector< StaticMember * > newmembers) override
Adds a list of static members to this type.
Definition: Reflection.h:1237
Gorgon::Scripting::OptionList
std::vector< Any > OptionList
Definition: Reflection.h:114
Gorgon::Scripting::Array
Definition: Array.h:14
Gorgon::Any::TypeInfo
TMP::RTTI & TypeInfo() const
Returns TypeInfo used by current data.
Definition: Any.h:87
Gorgon::Scripting::Types::Library
const Scripting::Type & Library()
Gorgon::Scripting::EventType::Get
virtual Data Get() const override final
Returns the value of this static member.
Definition: Reflection.h:1505
Gorgon::Scripting::InstanceMember::Set
void Set(Data &source, Data &value) const
Sets the data of the data member, if the source is a reference, this function should perform in place...
Definition: Reflection.h:1019
Gorgon::Scripting::Parameter::Options
OptionList Options
Allowed values for this parameter.
Definition: Reflection.h:261
Gorgon::Scripting::ReferenceTag
@ ReferenceTag
Marks the object as a reference.
Definition: Reflection.h:61
Gorgon::Scripting::Type::AddMembers
virtual void AddMembers(std::initializer_list< InstanceMember * > newmembers)
Adds an instance member to this type.
Definition: Reflection.h:1270
VirtualMachine.h
Gorgon::Scripting::Types::EnumType
const Scripting::Type & EnumType()
Gorgon::Scripting::OptionalTag
@ OptionalTag
Marks the object as optional.
Definition: Reflection.h:56
Gorgon::Scripting::StaticTag
@ StaticTag
Makes an object static.
Definition: Reflection.h:89
Gorgon::Scripting::Type::Inheritance::target
const Type & target
Definition: Reflection.h:1196
Gorgon::Scripting::Function::Overload::IsSame
bool IsSame(const Overload &var) const
Compares two variants if they have the same signature.
Definition: Reflection.cpp:332
Gorgon::Scripting::StaticMember::Function
@ Function
Function, functions can also be represented as data members.
Definition: Reflection.h:385
Gorgon::Scripting::StaticMember::IsInstanceMember
virtual bool IsInstanceMember() const override final
Returns if this member is an instance member.
Definition: Reflection.h:394
Gorgon::Scripting::Type::AddMember
virtual void AddMember(StaticMember *member) override
Adds a static member to this type.
Definition: Reflection.h:1221
Gorgon::Scripting::Function::Overload::Parameters
const ParameterList & Parameters
The parameters of this overload.
Definition: Reflection.h:681
Gorgon::Scripting::Type::Construct
Data Construct(const std::vector< Data > &parameters) const
!Unsafe. Constructs a new object from the given parameters. Requires parameters to be the exact type.
Definition: Reflection.cpp:15
Gorgon::Scripting::StretchTag
@ StretchTag
Used only in functions with console dialect.
Definition: Reflection.h:77
Gorgon::Scripting::Namespace::Namespace
Namespace(const std::string &name, const std::string &help)
Definition: Reflection.h:1075
Gorgon::Scripting::KeywordTag
@ KeywordTag
Marks object as a keyword.
Definition: Reflection.h:80
Gorgon::Scripting::Function::AddOverload
virtual void AddOverload(Overload *overload)
Adds the given overload to this function after performing necessary checks.
Definition: Reflection.h:919
Gorgon::Scripting::Function::Overload
Represents a function overload.
Definition: Reflection.h:588
Gorgon::Scripting::StaticMember::DataMember
@ DataMember
Data member.
Definition: Reflection.h:382
Gorgon::Scripting::Type::~Type
virtual ~Type()
Destructor.
Definition: Reflection.h:1417
Gorgon::Scripting::Function::Overload::stretchlast
bool stretchlast
If true, in console dialect, spaces in the last parameter are not treated as parameter separator as i...
Definition: Reflection.h:743
Gorgon::Scripting::StaticMember::GetMemberType
virtual MemberType GetMemberType() const =0
Returns the type of this member.
Gorgon::Scripting::Type::constructor
Scripting::Function constructor
Constructors of this type.
Definition: Reflection.h:1440
Gorgon::Scripting::Type::inheritsfrom
std::map< const Type *, Inheritance > inheritsfrom
Inheritance list.
Definition: Reflection.h:1443
Gorgon::Scripting::InstanceMember::IsReadonly
bool IsReadonly() const
Returns whether this member is read-only.
Definition: Reflection.h:1039
Gorgon::Scripting::Type::GetDefaultValue
Any GetDefaultValue() const
Returns the value of the type.
Definition: Reflection.h:1322
Gorgon::Scripting::EventType::returntype
const Type * returntype
The return type of this event, if it is allowed to return a value.
Definition: Reflection.h:1533
Gorgon::Scripting::Function::Overload::repeatlast
bool repeatlast
If true last parameter can be specified any number of times.
Definition: Reflection.h:747
Gorgon::Scripting::Parameter::GetType
const Type & GetType() const
Returns the type of the parameter.
Definition: Reflection.h:223
Gorgon::Scripting::ConstTag
@ ConstTag
Marks a parameter or a function constant.
Definition: Reflection.h:95
Gorgon::Scripting::Parameter::IsVariable
bool IsVariable() const
If true, this parameter is a variable and its name is given to the function as a string.
Definition: Reflection.h:244
Gorgon::Scripting::Function::Overload::parameters
ParameterList parameters
Modifiable parameters of this overload.
Definition: Reflection.h:736
Gorgon::Scripting::MappedValueType
This class allows embedded types to become scripting types that are passed around as values.
Definition: Embedding.h:1300
Gorgon::Scripting::Type::Get
virtual Data Get() const override
Returns the value of this static member.
Definition: Reflection.h:1207
Gorgon::Scripting::MappedStringEnum
E_ is an enumeration with defined strings.
Definition: Embedding.h:1786
Gorgon::Scripting::Function::GetMemberType
virtual MemberType GetMemberType() const override
Returns the type of this member.
Definition: Reflection.h:844
Gorgon::Scripting::Function::Overload::GetParent
const Function & GetParent() const
Returns the function this variant belongs.
Definition: Reflection.h:650
Gorgon::Scripting::ArrayType
Type * ArrayType()
Definition: Array.cpp:74
Gorgon::Scripting::Data::GetData
Any GetData() const
Returns the data contained in this data element.
Definition: Data.h:133
Gorgon::Scripting::Namespace::Get
virtual Data Get() const override
Returns the value of this static member.
Definition: Reflection.h:1083
Gorgon::Input::Mouse::EventType
EventType
The type of a mouse event.
Definition: Mouse.h:14
Gorgon::Scripting::Namespace::GetType
const Type & GetType(const std::string &name) const
Convenience function, returns the type with the given name.
Definition: Reflection.cpp:395
Gorgon::Scripting::Member::IsInstanceMember
virtual bool IsInstanceMember() const =0
Returns if this member is an instance member.
Gorgon::Scripting::Function::Overload::returnsref
bool returnsref
This function variant returns a reference.
Definition: Reflection.h:757
Gorgon::Scripting::KeywordNames
std::set< std::string, String::CaseInsensitiveLess > KeywordNames
Definition: Scripting.cpp:13
Gorgon::Scripting::Function::IsKeyword
bool IsKeyword() const
Returns if this function is actually a keyword.
Definition: Reflection.h:853
Gorgon::Scripting::Parameter
This class represents a function parameter description.
Definition: Reflection.h:137
Gorgon::Scripting::StaticDataMember::GetType
const Type & GetType() const
Returns the type of this static member.
Definition: Reflection.h:464
Gorgon::Scripting::InstanceMember::readonly
bool readonly
Marks this instance as read-only.
Definition: Reflection.h:1065
Gorgon::Scripting::EnumType::ElementInitializer::value
Any value
Definition: Reflection.h:1547
Gorgon::Scripting::Function::Function
Function(const std::string &name, const std::string &help, const Type *parent, const Containers::Collection< Overload > &overloads, const Containers::Collection< Overload > &methods=Containers::Collection< Overload >())
Regular constructor with both overloads and methods without any tags.
Definition: Reflection.h:809
Gorgon::Scripting::InstanceMember::reference
bool reference
This instance member is a reference.
Definition: Reflection.h:1062
Gorgon::Scripting::Namespace::GetFunction
const Scripting::Function & GetFunction(const std::string &name) const
Convenience function, returns the function with the given name.
Definition: Reflection.cpp:406
Gorgon::Scripting::EnumType
Represents an enumeration type.
Definition: Reflection.h:1540
Gorgon::Scripting::Type::Inheritance::ConversionFunction
std::function< Data(Data)> ConversionFunction
Definition: Reflection.h:1191
Gorgon::Scripting::Member::name
std::string name
The name of the datamember.
Definition: Reflection.h:353
Gorgon::Scripting::Type::TypeCasting
@ TypeCasting
This is a type casting.
Definition: Reflection.h:1183
Gorgon::Scripting::Function::Overload::GetReturnType
const Type & GetReturnType() const
Returns the type this variant returns.
Definition: Reflection.h:662
Gorgon::Scripting::TypeType
Type * TypeType()
Definition: Reflection.cpp:15
Gorgon::Scripting::VariableTag
@ VariableTag
Makes this parameter a variable accepting parameter.
Definition: Reflection.h:102
Gorgon::GL::UBOBindingPoint::Type
Type
Definition: Shader.h:14
Gorgon::Any::Pointer
void * Pointer() const
Returns the pointer without type information.
Definition: Any.h:332
Gorgon::Containers::Collection::Destroy
void Destroy()
Destroys the entire collection, effectively deleting the contents and the list including all the memo...
Definition: Collection.h:662
Gorgon::Scripting::EnumType::add
void add(const ElementInitializer &element)
Definition: Reflection.h:1580
Gorgon::Scripting::StaticMember::IsInstanceable
bool IsInstanceable() const
Whether this member can be used to instantiate an object.
Definition: Reflection.h:398
Gorgon::Scripting::Constant::GetType
const Type & GetType() const
Returns the type of the constant.
Definition: Reflection.h:1475
Gorgon::Scripting::InstanceMember::~InstanceMember
virtual ~InstanceMember()
Definition: Reflection.h:1043
Gorgon::Scripting::Function::Function
Function(const std::string &name, const std::string &help, const Type *parent, bool keyword, bool isoperator, bool staticmember)
Full constructor.
Definition: Reflection.h:827
Gorgon::Scripting::Type::deleteobject
virtual void deleteobject(const Data &) const =0
This function should delete the given object.
Gorgon::Scripting::Member::GetQualifiedName
std::string GetQualifiedName() const
Returns the namespace qualified name of this member.
Definition: Reflection.h:338
Gorgon::Scripting::Namespace::GetNamespace
const Namespace & GetNamespace(const std::string &name) const
Convenience function, returns the namespace with the given name.
Definition: Reflection.cpp:384
Data.h
Gorgon::Scripting::Reflection
Library Reflection
Definition: Builtin.cpp:17
Gorgon::Scripting::Member::help
std::string help
Help string of the datamember.
Definition: Reflection.h:356
Gorgon::Scripting::Namespace::AddMember
virtual void AddMember(StaticMember &member)
Adds a new member to this namespace.
Definition: Reflection.h:1088
Gorgon::Scripting::Type::operator!=
bool operator!=(const Type &other) const
Compares two types.
Definition: Reflection.h:1347
Gorgon::Scripting::MappedReferenceType
This class allows embedded types to become scripting types that are passed around as references.
Definition: Embedding.h:1406
Gorgon::String::CaseInsensitiveLess
Definition: String.h:25
Array.h
Gorgon::Scripting::Namespace::AddMember
virtual void AddMember(StaticMember *member)
Adds a new member to this namespace.
Definition: Reflection.h:1095
Gorgon::Scripting::Member::GetOwner
const Member * GetOwner() const
Definition: Reflection.h:345
Gorgon::Scripting::StaticDataMember::Set
void Set(Data &newval)
Changes the value of this member.
Definition: Reflection.h:445
Gorgon::Scripting::Reflection
Library Reflection("Reflection", "This library contains reflection objects")
Gorgon::Scripting::MapFunction
Scripting::Function::Overload * MapFunction(F_ fn, const Type *returntype, ParameterList parameters, P_ ...tags)
Definition: Embedding.h:614
Gorgon::Scripting::Type::InheritsFrom
const std::map< const Type *, Inheritance > & InheritsFrom
Inheritance list.
Definition: Reflection.h:1405
Gorgon::Scripting::Function::Overloads
const Containers::Collection< Overload > & Overloads
The list of overloads this function has.
Definition: Reflection.h:933
Gorgon::Scripting::InstanceMember::constant
bool constant
This instance member is a constant.
Definition: Reflection.h:1059
Gorgon::Scripting::Constant::GetMemberType
virtual MemberType GetMemberType() const override final
Returns the type of this member.
Definition: Reflection.h:1470
Exceptions.h
Exceptions This file contains string related exceptions.
Gorgon::Scripting::EnumType::ElementInitializer::ElementInitializer
ElementInitializer(std::string name, std::string help, Any value)
Definition: Reflection.h:1543
Gorgon::Scripting::Type::inheritedsymbols
Containers::Hashmap< std::string, const Type, nullptr, std::map, String::CaseInsensitiveLess > inheritedsymbols
Inherited symbols.
Definition: Reflection.h:1446
Gorgon::Scripting::StaticMember::Constant
@ Constant
Static fixed constant.
Definition: Reflection.h:388
Gorgon::Scripting::Function::Overload::returnsconst
bool returnsconst
This function variant returns a constant, useful with references.
Definition: Reflection.h:760
Gorgon::Scripting::Member::Type
friend class Type
Definition: Reflection.h:316
Gorgon::Scripting::Types::EventType
const Scripting::Type & EventType()
Gorgon::Scripting::Function::Function
Function(const std::string &name, const std::string &help, const Type *parent, const Containers::Collection< Overload > &overloads, Tag tag, P_ ...tags)
Regular constructor with overloads specified a long with at least a single tag.
Definition: Reflection.h:793
Gorgon::TMP::RTTH::PtrType
RTTS & PtrType
Definition: TMP.h:375
Gorgon::Scripting::Function::Overload::constant
bool constant
Makes this function constant. Only works on member functions.
Definition: Reflection.h:754
Gorgon::Scripting::Types::Function
const Scripting::Type & Function()
Definition: Reflection.h:589
Gorgon::Scripting::BuildArray
Array * BuildArray(const Type *type, std::vector< Data > datav)
Definition: Array.cpp:184
Gorgon::Scripting::Function
Represents a function.
Definition: Reflection.h:557
Gorgon::Containers::Hashmap::First
Iterator First()
returns the iterator to the first item
Definition: Hashmap.h:425
Gorgon::Scripting::Member::GetHelp
std::string GetHelp() const
Returns the help string. Help strings may contain markdown notation.
Definition: Reflection.h:330
Gorgon::Scripting::Library::Library
Library(const std::string &name, const std::string &help)
Constructor.
Definition: Reflection.h:1599
Gorgon::Scripting::StaticMember::EnumType
@ EnumType
Enumeration, which is also a type.
Definition: Reflection.h:376
Gorgon::Scripting::Types::Type
const Scripting::Type & Type()
Definition: Reflection.h:316
Gorgon::Scripting::Parameter::IsConstant
bool IsConstant() const
Checks if this parameter accepts a constant value.
Definition: Reflection.h:238
Gorgon::Scripting::Type::compare
virtual bool compare(const Data &l, const Data &r) const
This function should compare two instances of the type.
Definition: Reflection.h:1429
Gorgon::Scripting::Type::CanMorphTo
MorphType CanMorphTo(const Type &type) const
Check if it is possible to morph this type to the other.
Definition: Reflection.cpp:214
Gorgon::Scripting::Member::Member
Member(const std::string &name, const std::string &help)
Definition: Reflection.h:319
Gorgon::Scripting::Function::Overload::ReturnsRef
bool ReturnsRef() const
This function variant returns a reference to a value rather than the value itself.
Definition: Reflection.h:640
Gorgon::Scripting::Function::Overload::ReturnsConst
bool ReturnsConst() const
This function variant returns a constant.
Definition: Reflection.h:645
Gorgon::Scripting::Type::NotPossible
@ NotPossible
Morphing is not possible.
Definition: Reflection.h:1171
Gorgon::Scripting::StaticMember::EventType
@ EventType
An event type, which contains additional information about an event.
Definition: Reflection.h:373
Gorgon::Scripting::Type::instancemembers
InstanceMemberList instancemembers
Instance members of this type.
Definition: Reflection.h:1432
Gorgon::Scripting::Data::IsValid
bool IsValid() const
Returns if the data is in a valid state.
Definition: Data.h:152
Gorgon::Scripting::Constant::Constant
Constant(const std::string &name, const std::string &help, Data value)
Definition: Reflection.h:1460
Gorgon::Scripting::Function::Function
Function(const Function &)=delete
Gorgon::Scripting::EnumType::ElementInitializer
Definition: Reflection.h:1542
Gorgon::Scripting::StaticMember::RegularType
@ RegularType
A type.
Definition: Reflection.h:370
Gorgon::Scripting::Function::Type
friend class Type
Definition: Reflection.h:558
Gorgon::Scripting::EventType::Parameters
const ParameterList & Parameters
Read only list of parameters.
Definition: Reflection.h:1526
Gorgon::Scripting::InstanceMember
This class represents an instance data member.
Definition: Reflection.h:989
Gorgon::Containers::Hashmap::Find
Iterator Find(const K_ &key)
Finds the given key in the hashmap and returns iterator for it.
Definition: Hashmap.h:402
Gorgon::Scripting::ImplicitTag
@ ImplicitTag
Makes a constructor implicit.
Definition: Reflection.h:105
Gorgon::Scripting::StaticDataMember::type
const Type * type
Type of the datamember.
Definition: Reflection.h:497
Gorgon::Scripting::EventType::Assign
virtual void Assign(Data &l, const Data &r) const override
Assigns the value of the second parameter to the first, reference types can ignore this function.
Definition: Reflection.h:1521
Gorgon::Scripting::Type::GetMemberType
virtual MemberType GetMemberType() const override
Returns the type of this member.
Definition: Reflection.h:1205
Gorgon::Scripting::Type::MorphTo
Data MorphTo(const Type &type, Data source, bool allowtypecast=true) const
Morphs the given data into the target type.
Definition: Reflection.cpp:123
Gorgon::Scripting::InstanceMember::set
virtual void set(Data &source, Data &value) const =0
This function should perform set operation.
Gorgon::Scripting::Function::IsStatic
bool IsStatic() const
Returns if this function is static. Only meaningful when the function is a member function.
Definition: Reflection.h:858
Gorgon::Scripting::EventType
Events allow an easy mechanism to program logic into actions instead of checking actions continuously...
Definition: Reflection.h:1491
Gorgon::Scripting::AllowNullTag
@ AllowNullTag
Allows a parameter to be NULL.
Definition: Reflection.h:108
Gorgon::Scripting::StaticDataMember
Definition: Reflection.h:421
Gorgon::Scripting::EnumType::ElementInitializer::help
std::string help
Definition: Reflection.h:1546
Gorgon::Containers::Hashmap::Exists
bool Exists(const K_ &key) const
Checks if an element with the given key exists.
Definition: Hashmap.h:396
Gorgon::Scripting::InitReflection
void InitReflection()
Definition: Reflection.cpp:30
Gorgon::Scripting::Type::defaultvalue
Any defaultvalue
Default value of this type.
Definition: Reflection.h:1436
Gorgon::Scripting::Member::GetName
std::string GetName() const
Returns the name of this member.
Definition: Reflection.h:325