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.

68 lines
1.8KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2017 - ROLI Ltd.
  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. namespace juce
  14. {
  15. namespace build_tools
  16. {
  17. class ResourceFile
  18. {
  19. public:
  20. ResourceFile() = default;
  21. void setClassName (const String& className);
  22. String getClassName() const { return className; }
  23. void addFile (const File& file);
  24. String getDataVariableFor (const File& file) const;
  25. String getSizeVariableFor (const File& file) const;
  26. int getNumFiles() const { return files.size (); }
  27. const File& getFile (int index) const { return files.getReference (index); }
  28. int64 getTotalDataSize() const;
  29. struct WriteResult
  30. {
  31. Result result;
  32. Array<File> filesCreated;
  33. };
  34. WriteResult write (int maxFileSize,
  35. String projectLineFeed,
  36. File headerFile,
  37. std::function<File (int)> getCppFile);
  38. private:
  39. Array<File> files;
  40. StringArray variableNames;
  41. String className { "BinaryData" };
  42. Result writeHeader (MemoryOutputStream&);
  43. Result writeCpp (MemoryOutputStream&, const File&, int&, int);
  44. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ResourceFile)
  45. };
  46. }
  47. }