OpenShot Audio Library | OpenShotAudio 0.3.2

Loading...
Searching...
No Matches
juce_PropertiesFile.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 By using JUCE, you agree to the terms of both the JUCE 5 End-User License
11 Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
12 27th April 2017).
13
14 End User License Agreement: www.juce.com/juce-5-licence
15 Privacy Policy: www.juce.com/juce-5-privacy-policy
16
17 Or: You may also use this code under the terms of the GPL v3 (see
18 www.gnu.org/licenses).
19
20 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
21 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
22 DISCLAIMED.
23
24 ==============================================================================
25*/
26
27 namespace juce
28{
29
30//==============================================================================
46 class JUCE_API PropertiesFile : public PropertySet,
47 public ChangeBroadcaster,
48 private Timer
49{
50 public:
51 //==============================================================================
52 enum StorageFormat
53 {
54 storeAsBinary,
55 storeAsCompressedBinary,
56 storeAsXML
57 };
58
59 //==============================================================================
61 struct JUCE_API Options
62 {
66 Options();
67
70 String applicationName;
71
80 String filenameSuffix;
81
85 String folderName;
86
105 String osxLibrarySubFolder;
106
110 bool commonToAllUsers;
111
116 bool ignoreCaseOfKeyNames;
117
119 bool doNotSave;
120
129 int millisecondsBeforeSaving;
130
135 StorageFormat storageFormat;
136
144 InterProcessLock* processLock;
145
163 File getDefaultFile() const;
164 };
165
166 //==============================================================================
171 explicit PropertiesFile (const Options& options);
172
177 PropertiesFile (const File& file,
178 const Options& options);
179
183 ~PropertiesFile() override;
184
185 //==============================================================================
190 bool isValidFile() const noexcept { return loadedOk; }
191
192 //==============================================================================
201 bool saveIfNeeded();
202
211 bool save();
212
217 bool needsToBeSaved() const;
218
222 void setNeedsToBeSaved (bool needsToBeSaved);
223
225 bool reload();
226
227 //==============================================================================
229 const File& getFile() const noexcept { return file; }
230
231
232 protected:
234 void propertyChanged() override;
235
236 private:
237 //==============================================================================
238 File file;
239 Options options;
240 bool loadedOk = false, needsWriting = false;
241
242 using ProcessScopedLock = const std::unique_ptr<InterProcessLock::ScopedLockType>;
243 InterProcessLock::ScopedLockType* createProcessLock() const;
244
245 void timerCallback() override;
246 bool saveAsXml();
247 bool saveAsBinary();
248 bool loadAsXml();
249 bool loadAsBinary();
250 bool loadAsBinary (InputStream&);
251 bool writeToStream (OutputStream&);
252
253 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PropertiesFile)
254};
255
256} // namespace juce
juce::ChangeBroadcaster
Definition: juce_ChangeBroadcaster.h:35
juce::File
Definition: juce_File.h:41
juce::InputStream
Definition: juce_InputStream.h:37
juce::InterProcessLock::ScopedLockType
Definition: juce_InterProcessLock.h:72
juce::InterProcessLock
Definition: juce_InterProcessLock.h:35
juce::OutputStream
Definition: juce_OutputStream.h:38
juce::PropertiesFile
Definition: juce_PropertiesFile.h:49
juce::PropertiesFile::getFile
const File & getFile() const noexcept
Definition: juce_PropertiesFile.h:229
juce::PropertiesFile::isValidFile
bool isValidFile() const noexcept
Definition: juce_PropertiesFile.h:190
juce::PropertySet
Definition: juce_PropertySet.h:39
juce::String
Definition: juce_String.h:39
juce::Timer
Definition: juce_Timer.h:52
juce::PropertiesFile::Options
Definition: juce_PropertiesFile.h:62
juce::PropertiesFile::Options::storageFormat
StorageFormat storageFormat
Definition: juce_PropertiesFile.h:135
juce::PropertiesFile::Options::processLock
InterProcessLock * processLock
Definition: juce_PropertiesFile.h:144
juce::PropertiesFile::Options::osxLibrarySubFolder
String osxLibrarySubFolder
Definition: juce_PropertiesFile.h:105
juce::PropertiesFile::Options::filenameSuffix
String filenameSuffix
Definition: juce_PropertiesFile.h:80
juce::PropertiesFile::Options::folderName
String folderName
Definition: juce_PropertiesFile.h:85
juce::PropertiesFile::Options::applicationName
String applicationName
Definition: juce_PropertiesFile.h:70
juce::PropertiesFile::Options::commonToAllUsers
bool commonToAllUsers
Definition: juce_PropertiesFile.h:110
juce::PropertiesFile::Options::doNotSave
bool doNotSave
Definition: juce_PropertiesFile.h:119
juce::PropertiesFile::Options::ignoreCaseOfKeyNames
bool ignoreCaseOfKeyNames
Definition: juce_PropertiesFile.h:116
juce::PropertiesFile::Options::millisecondsBeforeSaving
int millisecondsBeforeSaving
Definition: juce_PropertiesFile.h:129