juce_FileInputSource.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. ==============================================================================
  3. This file is part of the juce_core module of the JUCE library.
  4. Copyright (c) 2015 - ROLI Ltd.
  5. Permission to use, copy, modify, and/or distribute this software for any purpose with
  6. or without fee is hereby granted, provided that the above copyright notice and this
  7. permission notice appear in all copies.
  8. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
  9. TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
  10. NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  11. DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
  12. IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  13. CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  14. ------------------------------------------------------------------------------
  15. NOTE! This permissive ISC license applies ONLY to files within the juce_core module!
  16. All other JUCE modules are covered by a dual GPL/commercial license, so if you are
  17. using any other modules, be sure to check that you also comply with their license.
  18. For more details, visit www.juce.com
  19. ==============================================================================
  20. */
  21. #ifndef JUCE_FILEINPUTSOURCE_H_INCLUDED
  22. #define JUCE_FILEINPUTSOURCE_H_INCLUDED
  23. //==============================================================================
  24. /**
  25. A type of InputSource that represents a normal file.
  26. @see InputSource
  27. */
  28. class JUCE_API FileInputSource : public InputSource
  29. {
  30. public:
  31. //==============================================================================
  32. /** Creates a FileInputSource for a file.
  33. If the useFileTimeInHashGeneration parameter is true, then this object's
  34. hashCode() method will incorporate the file time into its hash code; if
  35. false, only the file name will be used for the hash.
  36. */
  37. FileInputSource (const File& file, bool useFileTimeInHashGeneration = false);
  38. /** Destructor. */
  39. ~FileInputSource();
  40. InputStream* createInputStream();
  41. InputStream* createInputStreamFor (const String& relatedItemPath);
  42. int64 hashCode() const;
  43. private:
  44. //==============================================================================
  45. const File file;
  46. bool useFileTimeInHashGeneration;
  47. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileInputSource)
  48. };
  49. #endif // JUCE_FILEINPUTSOURCE_H_INCLUDED