OpenShot Audio Library | OpenShotAudio: juce_WebInputStream.h Source File

OpenShot Audio Library | OpenShotAudio 0.3.0

Loading...
Searching...
No Matches
juce_WebInputStream.h
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2017 - ROLI Ltd.
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
26//==============================================================================
32 class JUCE_API WebInputStream : public InputStream
33{
34 public:
36 class JUCE_API Listener
37 {
38 public:
39 virtual ~Listener() = default;
40
41 virtual bool postDataSendProgress (WebInputStream& /*request*/, int /*bytesSent*/, int /*totalBytes*/) { return true; }
42 };
43
51 WebInputStream (const URL& url, const bool usePost);
52
53 ~WebInputStream() override;
54
55
64 WebInputStream& withExtraHeaders (const String& extraHeaders);
65
76 WebInputStream& withCustomRequestCommand (const String& customRequestCommand);
77
85 WebInputStream& withConnectionTimeout (int timeoutInMs);
86
95 WebInputStream& withNumRedirectsToFollow (int numRedirects);
96
98 StringPairArray getRequestHeaders() const;
99
109 StringPairArray getResponseHeaders();
110
120 int getStatusCode();
121
140 bool connect (Listener* listener);
141
143 bool isError() const;
144
146 void cancel();
147
148 //==============================================================================
161 int64 getTotalLength() override;
162
178 int read (void* destBuffer, int maxBytesToRead) override;
179
181 bool isExhausted() override;
182
186 int64 getPosition() override;
187
201 bool setPosition (int64 wantedPos) override;
202
203 private:
204 static void createHeadersAndPostData (const URL&, String&, MemoryBlock&);
205 static StringPairArray parseHttpHeaders (const String& headerData);
206
207 class Pimpl;
208 friend class Pimpl;
209
210 Pimpl* const pimpl;
211 bool hasCalledConnect;
212
213 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WebInputStream)
214};
215
216} // namespace juce
juce::InputStream
Definition: juce_InputStream.h:37
juce::MemoryBlock
Definition: juce_MemoryBlock.h:33
juce::StringPairArray
Definition: juce_StringPairArray.h:35
juce::String
Definition: juce_String.h:39
juce::URL
Definition: juce_URL.h:38
juce::WebInputStream::Listener
Definition: juce_WebInputStream.h:37
juce::WebInputStream
Definition: juce_WebInputStream.h:33