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.

77 lines
2.9KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2016 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of the ISC license
  6. http://www.isc.org/downloads/software-support-policy/isc-license/
  7. Permission to use, copy, modify, and/or distribute this software for any
  8. purpose with or without fee is hereby granted, provided that the above
  9. copyright notice and this permission notice appear in all copies.
  10. THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD
  11. TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  12. FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
  13. OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  14. USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  16. OF THIS SOFTWARE.
  17. -----------------------------------------------------------------------------
  18. To release a closed-source product which uses other parts of JUCE not
  19. licensed under the ISC terms, commercial licenses are available: visit
  20. www.juce.com for more information.
  21. ==============================================================================
  22. */
  23. #pragma once
  24. //==============================================================================
  25. /**
  26. A lightweight object that can create a stream to read some kind of resource.
  27. This may be used to refer to a file, or some other kind of source, allowing a
  28. caller to create an input stream that can read from it when required.
  29. @see FileInputSource
  30. */
  31. class JUCE_API InputSource
  32. {
  33. public:
  34. //==============================================================================
  35. InputSource() noexcept {}
  36. /** Destructor. */
  37. virtual ~InputSource() {}
  38. //==============================================================================
  39. /** Returns a new InputStream to read this item.
  40. @returns an inputstream that the caller will delete, or nullptr if
  41. the filename isn't found.
  42. */
  43. virtual InputStream* createInputStream() = 0;
  44. /** Returns a new InputStream to read an item, relative.
  45. @param relatedItemPath the relative pathname of the resource that is required
  46. @returns an inputstream that the caller will delete, or nullptr if
  47. the item isn't found.
  48. */
  49. virtual InputStream* createInputStreamFor (const String& relatedItemPath) = 0;
  50. /** Returns a hash code that uniquely represents this item.
  51. */
  52. virtual int64 hashCode() const = 0;
  53. private:
  54. //==============================================================================
  55. JUCE_LEAK_DETECTOR (InputSource)
  56. };