openshot-audio  0.1.7
juce_FileInputStream.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the juce_core module of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission to use, copy, modify, and/or distribute this software for any purpose with
8  or without fee is hereby granted, provided that the above copyright notice and this
9  permission notice appear in all copies.
10 
11  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
12  TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
13  NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
15  IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 
18  ------------------------------------------------------------------------------
19 
20  NOTE! This permissive ISC license applies ONLY to files within the juce_core module!
21  All other JUCE modules are covered by a dual GPL/commercial license, so if you are
22  using any other modules, be sure to check that you also comply with their license.
23 
24  For more details, visit www.juce.com
25 
26  ==============================================================================
27 */
28 
29 #ifndef JUCE_FILEINPUTSTREAM_H_INCLUDED
30 #define JUCE_FILEINPUTSTREAM_H_INCLUDED
31 
32 
33 //==============================================================================
40 {
41 public:
42  //==============================================================================
49  explicit FileInputStream (const File& fileToRead);
50 
52  ~FileInputStream();
53 
54  //==============================================================================
56  const File& getFile() const noexcept { return file; }
57 
62  const Result& getStatus() const noexcept { return status; }
63 
67  bool failedToOpen() const noexcept { return status.failed(); }
68 
72  bool openedOk() const noexcept { return status.wasOk(); }
73 
74 
75  //==============================================================================
76  int64 getTotalLength() override;
77  int read (void*, int) override;
78  bool isExhausted() override;
79  int64 getPosition() override;
80  bool setPosition (int64) override;
81 
82 private:
83  //==============================================================================
84  const File file;
85  void* fileHandle;
86  int64 currentPosition;
87  Result status;
88 
89  void openHandle();
90  size_t readInternal (void*, size_t);
91 
93 };
94 
95 
96 #endif // JUCE_FILEINPUTSTREAM_H_INCLUDED
bool failedToOpen() const noexcept
Definition: juce_FileInputStream.h:67
virtual int64 getTotalLength()=0
#define noexcept
Definition: juce_CompilerSupport.h:141
virtual int read(void *destBuffer, int maxBytesToRead)=0
const Result & getStatus() const noexcept
Definition: juce_FileInputStream.h:62
Definition: juce_InputStream.h:41
virtual bool isExhausted()=0
Definition: juce_Result.h:61
#define JUCE_API
Definition: juce_StandardHeader.h:139
long long int64
Definition: juce_MathsFunctions.h:60
Definition: juce_FileInputStream.h:39
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition: juce_PlatformDefs.h:198
const File & getFile() const noexcept
Definition: juce_FileInputStream.h:56
bool openedOk() const noexcept
Definition: juce_FileInputStream.h:72
Definition: juce_File.h:45
virtual bool setPosition(int64 newPosition)=0
virtual int64 getPosition()=0