openshot-audio  0.1.7
juce_MemoryMappedFile.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_MEMORYMAPPEDFILE_H_INCLUDED
30 #define JUCE_MEMORYMAPPEDFILE_H_INCLUDED
31 
32 
33 //==============================================================================
38 {
39 public:
42  {
44  readWrite
46  };
47 
60  MemoryMappedFile (const File& file, AccessMode mode);
61 
78  MemoryMappedFile (const File& file,
79  const Range<int64>& fileRange,
80  AccessMode mode);
81 
84 
88  void* getData() const noexcept { return address; }
89 
93  size_t getSize() const noexcept { return (size_t) range.getLength(); }
94 
96  Range<int64> getRange() const noexcept { return range; }
97 
98 private:
99  //==============================================================================
100  void* address;
101  Range<int64> range;
102 
103  #if JUCE_WINDOWS
104  void* fileHandle;
105  #else
106  int fileHandle;
107  #endif
108 
109  void openInternal (const File&, AccessMode);
110 
112 };
113 
114 
115 #endif // JUCE_MEMORYMAPPEDFILE_H_INCLUDED
Definition: juce_MemoryMappedFile.h:43
#define noexcept
Definition: juce_CompilerSupport.h:141
void * getData() const noexcept
Definition: juce_MemoryMappedFile.h:88
size_t getSize() const noexcept
Definition: juce_MemoryMappedFile.h:93
#define JUCE_API
Definition: juce_StandardHeader.h:139
#define const
png_structrp int mode
Definition: juce_PNGLoader.cpp:1243
AccessMode
Definition: juce_MemoryMappedFile.h:41
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition: juce_PlatformDefs.h:198
Definition: juce_MemoryMappedFile.h:37
Definition: juce_File.h:45
Range< int64 > getRange() const noexcept
Definition: juce_MemoryMappedFile.h:96