JSBPackage.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //
  2. // Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
  3. // LICENSE: Atomic Game Engine Editor and Tools EULA
  4. // Please see LICENSE_ATOMIC_EDITOR_AND_TOOLS.md in repository root for
  5. // license information: https://github.com/AtomicGameEngine/AtomicGameEngine
  6. //
  7. #pragma once
  8. #include <Atomic/Core/Object.h>
  9. using namespace Atomic;
  10. namespace ToolCore
  11. {
  12. class JSBModule;
  13. class JSBClass;
  14. class JSBEnum;
  15. class JSBPackageWriter;
  16. class JSBPackage : public Object
  17. {
  18. friend class JSPackageWriter;
  19. friend class CSPackageWriter;
  20. OBJECT(JSBPackage)
  21. public:
  22. JSBPackage(Context* context);
  23. virtual ~JSBPackage();
  24. bool Load(const String& packageFolder);
  25. Vector<SharedPtr<JSBModule>>& GetModules() {return modules_;}
  26. void PreprocessModules();
  27. void ProcessModules();
  28. const String& GetName() { return name_; }
  29. const String& GetNamespace() { return namespace_; }
  30. JSBClass* GetClass(const String& name);
  31. PODVector<JSBClass*>& GetAllClasses() { return allClasses_; }
  32. void RegisterClass(JSBClass* cls) {allClasses_.Push(cls); }
  33. // get a class by name across all loaded packages
  34. static JSBClass* GetClassAllPackages(const String& name);
  35. JSBEnum* GetEnum(const String& name);
  36. // get an enum by name across all loaded packages
  37. static JSBEnum* GetEnumAllPackages(const String& name);
  38. bool ContainsConstant(const String& constantName);
  39. static bool ContainsConstantAllPackages(const String& constantName);
  40. void GenerateSource(JSBPackageWriter& packageWriter);
  41. private:
  42. // The name of the package
  43. String name_;
  44. // The name of the C++ namespace if any
  45. String namespace_;
  46. Vector<SharedPtr<JSBPackage> > dependencies_;
  47. HashMap<String, Vector<String>> moduleExcludes_;
  48. Vector<SharedPtr<JSBModule> > modules_;
  49. PODVector<JSBClass*> allClasses_;
  50. static Vector<SharedPtr<JSBPackage> > allPackages_;
  51. };
  52. }