OpenShot Audio Library | OpenShotAudio  0.3.1
juce_OutputStream.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 
23 namespace juce
24 {
25 
26 //==============================================================================
37 class JUCE_API OutputStream
38 {
39 protected:
40  //==============================================================================
41  OutputStream();
42 
43 public:
49  virtual ~OutputStream();
50 
51  //==============================================================================
54  virtual void flush() = 0;
55 
63  virtual bool setPosition (int64 newPosition) = 0;
64 
69  virtual int64 getPosition() = 0;
70 
71  //==============================================================================
82  virtual bool write (const void* dataToWrite,
83  size_t numberOfBytes) = 0;
84 
85  //==============================================================================
90  virtual bool writeByte (char byte);
91 
97  virtual bool writeBool (bool boolValue);
98 
104  virtual bool writeShort (short value);
105 
111  virtual bool writeShortBigEndian (short value);
112 
117  virtual bool writeInt (int value);
118 
123  virtual bool writeIntBigEndian (int value);
124 
129  virtual bool writeInt64 (int64 value);
130 
135  virtual bool writeInt64BigEndian (int64 value);
136 
142  virtual bool writeFloat (float value);
143 
149  virtual bool writeFloatBigEndian (float value);
150 
156  virtual bool writeDouble (double value);
157 
163  virtual bool writeDoubleBigEndian (double value);
164 
168  virtual bool writeRepeatedByte (uint8 byte, size_t numTimesToRepeat);
169 
181  virtual bool writeCompressedInt (int value);
182 
196  virtual bool writeString (const String& text);
197 
209  virtual bool writeText (const String& text,
210  bool asUTF16,
211  bool writeUTF16ByteOrderMark,
212  const char* lineEndings);
213 
222  virtual int64 writeFromInputStream (InputStream& source, int64 maxNumBytesToWrite);
223 
224  //==============================================================================
228  void setNewLineString (const String& newLineString);
229 
231  const String& getNewLineString() const noexcept { return newLineString; }
232 
233 private:
234  //==============================================================================
235  String newLineString;
236 
237  JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OutputStream)
238 };
239 
240 //==============================================================================
242 JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, int number);
243 
245 JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, int64 number);
246 
248 JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, double number);
249 
251 JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, char character);
252 
254 JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const char* text);
255 
257 JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const MemoryBlock& data);
258 
260 JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const File& fileToRead);
261 
263 JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, InputStream& streamToRead);
264 
272 JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const NewLine&);
273 
274 } // namespace juce
const String & getNewLineString() const noexcept