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.

102 lines
3.6KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCER_GENERATEDCODE_JUCEHEADER__
  19. #define __JUCER_GENERATEDCODE_JUCEHEADER__
  20. class JucerDocument;
  21. //==============================================================================
  22. /**
  23. A class for collecting the various snippets of c++ that will be assembled into
  24. the final cpp and header files.
  25. */
  26. class GeneratedCode
  27. {
  28. public:
  29. GeneratedCode (const JucerDocument*);
  30. ~GeneratedCode();
  31. //==============================================================================
  32. void applyToCode (String& code,
  33. const String& fileNameRoot,
  34. const bool isForPreview,
  35. const String& oldFileWithUserData = String::empty) const;
  36. int getUniqueSuffix();
  37. //==============================================================================
  38. const JucerDocument* const document;
  39. String className;
  40. String componentName;
  41. String parentClassInitialiser; // optional parent class initialiser to go before the items in the initialisers list
  42. StringArray initialisers; // (a list of the member variables that need initalising after the constructor declaration)
  43. String parentClasses;
  44. String constructorParams;
  45. String privateMemberDeclarations;
  46. String publicMemberDeclarations;
  47. StringArray includeFilesH, includeFilesCPP;
  48. String constructorCode;
  49. String destructorCode;
  50. String staticMemberDefinitions;
  51. String jucerMetadata;
  52. struct CallbackMethod
  53. {
  54. String requiredParentClass;
  55. String returnType;
  56. String prototype;
  57. String content;
  58. bool hasPrePostUserSections;
  59. };
  60. OwnedArray <CallbackMethod> callbacks;
  61. String& getCallbackCode (const String& requiredParentClass,
  62. const String& returnType,
  63. const String& prototype,
  64. const bool hasPrePostUserSections);
  65. void removeCallback (const String& returnType, const String& prototype);
  66. void addImageResourceLoader (const String& imageMemberName, const String& resourceName);
  67. String getCallbackDeclarations() const;
  68. String getCallbackDefinitions() const;
  69. StringArray getExtraParentClasses() const;
  70. private:
  71. String getClassDeclaration() const;
  72. String getInitialiserList() const;
  73. int suffix;
  74. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (GeneratedCode)
  75. };
  76. #endif // __JUCER_GENERATEDCODE_JUCEHEADER__