BsVSCodeEditor.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsCodeEditor.h"
  4. namespace BansheeEngine
  5. {
  6. /**
  7. * @brief Recognized types of Microsoft Visual Studio versions
  8. * recognized by VSCodeEditor.
  9. */
  10. enum class VisualStudioVersion
  11. {
  12. VS2008,
  13. VS2010,
  14. VS2012,
  15. VS2013,
  16. VS2015
  17. };
  18. /**
  19. * @brief Code editor implementation that handles interacting with Microsoft Visual Studio.
  20. */
  21. class BS_ED_EXPORT VSCodeEditor : public CodeEditor
  22. {
  23. public:
  24. VSCodeEditor(VisualStudioVersion version, const Path& execPath, const WString& CLSID);
  25. /**
  26. * @copydoc CodeEditor::openFile
  27. */
  28. void openFile(const Path& solutionPath, const Path& filePath, UINT32 lineNumber) const override;
  29. /**
  30. * @copydoc CodeEditor::syncSolution
  31. */
  32. void syncSolution(const CodeSolutionData& data, const Path& outputPath) const override;
  33. private:
  34. VisualStudioVersion mVersion;
  35. Path mExecPath;
  36. WString mCLSID;
  37. };
  38. /**
  39. * @brief Code editor factory used for creating specific instances
  40. * of the Visual Studio code editor object.
  41. */
  42. class BS_ED_EXPORT VSCodeEditorFactory : public CodeEditorFactory
  43. {
  44. public:
  45. VSCodeEditorFactory();
  46. /**
  47. * @copydoc CodeEditorFactory::getAvailableEditors
  48. */
  49. const Vector<CodeEditorType>& getAvailableEditors() const override { return mAvailableEditors; }
  50. /**
  51. * @copydoc CodeEditorFactory::create
  52. */
  53. CodeEditor* create(CodeEditorType editor) const override;
  54. private:
  55. /**
  56. * @brief Contains detailed information about a specific Visual Studio version.
  57. */
  58. struct VSVersionInfo
  59. {
  60. WString name;
  61. Path execPath;
  62. WString CLSID;
  63. VisualStudioVersion version;
  64. };
  65. /**
  66. * @brief Returns a list of Visual Studio versions installed on this machine.
  67. */
  68. Map<CodeEditorType, VSVersionInfo> getAvailableVersions() const;
  69. Map<CodeEditorType, VSVersionInfo> mAvailableVersions;
  70. Vector<CodeEditorType> mAvailableEditors;
  71. };
  72. }