The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.9KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. You may use this code under the terms of the GPL v3
  6. (see www.gnu.org/licenses).
  7. For this technical preview, this file is not subject to commercial licensing.
  8. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  9. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  10. DISCLAIMED.
  11. ==============================================================================
  12. */
  13. #pragma once
  14. //==============================================================================
  15. class ModuleDescription
  16. {
  17. public:
  18. ModuleDescription() = default;
  19. ModuleDescription (const File& folder)
  20. : moduleFolder (folder),
  21. moduleInfo (parseJUCEHeaderMetadata (getHeader()))
  22. {
  23. }
  24. bool isValid() const { return getID().isNotEmpty(); }
  25. String getID() const { return moduleInfo [Ids::ID_uppercase].toString(); }
  26. String getVendor() const { return moduleInfo [Ids::vendor].toString(); }
  27. String getVersion() const { return moduleInfo [Ids::version].toString(); }
  28. String getName() const { return moduleInfo [Ids::name].toString(); }
  29. String getDescription() const { return moduleInfo [Ids::description].toString(); }
  30. String getLicense() const { return moduleInfo [Ids::license].toString(); }
  31. String getMinimumCppStandard() const { return moduleInfo [Ids::minimumCppStandard].toString(); }
  32. String getPreprocessorDefs() const { return moduleInfo [Ids::defines].toString(); }
  33. String getExtraSearchPaths() const { return moduleInfo [Ids::searchpaths].toString(); }
  34. var getModuleInfo() const { return moduleInfo; }
  35. File getModuleFolder() const { return moduleFolder; }
  36. File getFolder() const
  37. {
  38. jassert (moduleFolder != File());
  39. return moduleFolder;
  40. }
  41. File getHeader() const
  42. {
  43. if (moduleFolder != File())
  44. {
  45. static const char* extensions[] = { ".h", ".hpp", ".hxx" };
  46. for (auto e : extensions)
  47. {
  48. auto header = moduleFolder.getChildFile (moduleFolder.getFileName() + e);
  49. if (header.existsAsFile())
  50. return header;
  51. }
  52. }
  53. return {};
  54. }
  55. StringArray getDependencies() const
  56. {
  57. auto moduleDependencies = StringArray::fromTokens (moduleInfo ["dependencies"].toString(), " \t;,", "\"'");
  58. moduleDependencies.trim();
  59. moduleDependencies.removeEmptyStrings();
  60. return moduleDependencies;
  61. }
  62. private:
  63. File moduleFolder;
  64. var moduleInfo;
  65. URL url;
  66. };