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.

94 lines
3.2KB

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