BsCodeEditor.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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> assemblyReferences;
  20. Vector<CodeProjectReference> projectReferences;
  21. };
  22. struct BS_ED_EXPORT CodeSolutionData
  23. {
  24. WString name;
  25. Vector<CodeProjectData> projects;
  26. };
  27. class BS_ED_EXPORT CodeEditorManager : public Module<CodeEditorManager>
  28. {
  29. public:
  30. CodeEditorManager();
  31. ~CodeEditorManager();
  32. const Vector<CodeEditorType>& getAvailableEditors() const { return mEditors; }
  33. void setActive(CodeEditorType editor);
  34. void openFile(const Path& path, UINT32 lineNumber) const;
  35. void syncSolution() const;
  36. private:
  37. Path getSolutionPath() const;
  38. CodeEditor* mActiveEditor;
  39. Map<CodeEditorType, CodeEditorFactory*> mFactoryPerEditor;
  40. Vector<CodeEditorType> mEditors;
  41. Vector<CodeEditorFactory*> mFactories;
  42. };
  43. class BS_ED_EXPORT CodeEditor
  44. {
  45. public:
  46. virtual void openFile(const Path& solutionPath, const Path& path, UINT32 lineNumber) const = 0;
  47. virtual void syncSolution(const CodeSolutionData& data, const Path& outputPath) const = 0;
  48. };
  49. class BS_ED_EXPORT CodeEditorFactory
  50. {
  51. public:
  52. virtual const Vector<CodeEditorType>& getAvailableEditors() const = 0;
  53. virtual CodeEditor* create(CodeEditorType editor) const = 0;
  54. };
  55. }