BsCodeEditor.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsModule.h"
  4. namespace BansheeEngine
  5. {
  6. class CodeEditor;
  7. class CodeEditorFactory;
  8. struct BS_ED_EXPORT CodeProjectReference
  9. {
  10. WString name;
  11. Path path;
  12. };
  13. struct BS_ED_EXPORT CodeProjectData
  14. {
  15. WString name;
  16. Vector<Path> codeFiles;
  17. Vector<Path> nonCodeFiles;
  18. Vector<WString> defines;
  19. Vector<CodeProjectReference> references;
  20. };
  21. struct BS_ED_EXPORT CodeSolutionData
  22. {
  23. Vector<CodeProjectData> projects;
  24. };
  25. class BS_ED_EXPORT CodeEditorManager : public Module<CodeEditorManager>
  26. {
  27. public:
  28. CodeEditorManager();
  29. ~CodeEditorManager();
  30. const Vector<WString>& getAvailableEditors() const { return mEditors; }
  31. void setActive(const WString& editor);
  32. void openFile(const Path& path, UINT32 lineNumber) const;
  33. void syncSolution(const CodeSolutionData& data, const Path& outputPath) const; // TODO - Need some kind of project information like: name, list of files, list of references, possibly defines and other?
  34. private:
  35. CodeEditor* mActiveEditor;
  36. Map<WString, CodeEditorFactory*> mFactoryPerEditor;
  37. Vector<WString> mEditors;
  38. Vector<CodeEditorFactory*> mFactories;
  39. };
  40. class BS_ED_EXPORT CodeEditor
  41. {
  42. public:
  43. virtual void openFile(const Path& solutionPath, const Path& path, UINT32 lineNumber) const = 0;
  44. virtual void syncSolution(const CodeSolutionData& data, const Path& outputPath) const = 0;
  45. };
  46. class BS_ED_EXPORT CodeEditorFactory
  47. {
  48. public:
  49. virtual const Vector<WString>& getAvailableEditors() const = 0;
  50. virtual CodeEditor* create(const WString& editor) const = 0;
  51. };
  52. }