LMMS
Loading...
Searching...
No Matches
FileInputStream.h
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the Water library.
5 Copyright (c) 2016 ROLI Ltd.
6 Copyright (C) 2017-2022 Filipe Coelho <falktx@falktx.com>
7
8 Permission is granted to use this software under the terms of the ISC license
9 http://www.isc.org/downloads/software-support-policy/isc-license/
10
11 Permission to use, copy, modify, and/or distribute this software for any
12 purpose with or without fee is hereby granted, provided that the above
13 copyright notice and this permission notice appear in all copies.
14
15 THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD
16 TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17 FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
18 OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
19 USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
21 OF THIS SOFTWARE.
22
23 ==============================================================================
24*/
25
26#ifndef WATER_FILEINPUTSTREAM_H_INCLUDED
27#define WATER_FILEINPUTSTREAM_H_INCLUDED
28
29#include "File.h"
31
32namespace water {
33
34//==============================================================================
41{
42public:
43 //==============================================================================
50 explicit FileInputStream (const File& fileToRead);
51
54
55 //==============================================================================
57 const File& getFile() const noexcept { return file; }
58
63 const Result& getStatus() const noexcept { return status; }
64
68 bool failedToOpen() const noexcept { return status.failed(); }
69
73 bool openedOk() const noexcept { return status.wasOk(); }
74
75
76 //==============================================================================
77 int64 getTotalLength() override;
78 int read (void*, int) override;
79 bool isExhausted() override;
80 int64 getPosition() override;
81 bool setPosition (int64) override;
82
83private:
84 //==============================================================================
85 const File file;
89
90 void openHandle();
91 size_t readInternal (void*, size_t);
92
94};
95
96}
97
98#endif // WATER_FILEINPUTSTREAM_H_INCLUDED
#define CARLA_DECLARE_NON_COPYABLE(ClassName)
Definition CarlaDefines.h:242
#define noexcept
Definition DistrhoDefines.h:72
Definition File.h:50
FileInputStream(const File &fileToRead)
Definition FileInputStream.cpp:33
int64 getPosition() override
Definition FileInputStream.cpp:70
const Result & getStatus() const noexcept
Definition FileInputStream.h:63
~FileInputStream()
Definition FileInputStream.cpp:120
const File file
Definition FileInputStream.h:85
int64 currentPosition
Definition FileInputStream.h:87
const File & getFile() const noexcept
Definition FileInputStream.h:57
bool openedOk() const noexcept
Definition FileInputStream.h:73
bool failedToOpen() const noexcept
Definition FileInputStream.h:68
int read(void *, int) override
Definition FileInputStream.cpp:50
Result status
Definition FileInputStream.h:88
void * fileHandle
Definition FileInputStream.h:86
void openHandle()
Definition FileInputStream.cpp:126
bool setPosition(int64) override
Definition FileInputStream.cpp:75
int64 getTotalLength() override
Definition FileInputStream.cpp:42
bool isExhausted() override
Definition FileInputStream.cpp:65
size_t readInternal(void *, size_t)
Definition FileInputStream.cpp:136
InputStream() noexcept
Definition InputStream.h:259
Definition Result.h:64
Definition AudioSampleBuffer.h:33
long long int64
Definition water.h:100
#define const
Definition zconf.h:137