openshot-audio  0.1.7
juce_PropertiesFile.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission is granted to use this software under the terms of either:
8  a) the GPL v2 (or any later version)
9  b) the Affero GPL v3
10 
11  Details of these licenses can be found at: www.gnu.org/licenses
12 
13  JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17  ------------------------------------------------------------------------------
18 
19  To release a closed-source product which uses JUCE, commercial licenses are
20  available: visit www.juce.com for more information.
21 
22  ==============================================================================
23 */
24 
25 #ifndef JUCE_PROPERTIESFILE_H_INCLUDED
26 #define JUCE_PROPERTIESFILE_H_INCLUDED
27 
28 
29 //==============================================================================
44  public ChangeBroadcaster,
45  private Timer
46 {
47 public:
48  //==============================================================================
50  {
53  storeAsXML
54  };
55 
56  //==============================================================================
58  {
62  Options();
63 
67 
73 
78 
98 
103 
109 
111  bool doNotSave;
112 
122 
128 
137 
155  File getDefaultFile() const;
156  };
157 
158  //==============================================================================
163  explicit PropertiesFile (const Options& options);
164 
169  PropertiesFile (const File& file,
170  const Options& options);
171 
175  ~PropertiesFile();
176 
177  //==============================================================================
182  bool isValidFile() const noexcept { return loadedOk; }
183 
184  //==============================================================================
193  bool saveIfNeeded();
194 
203  bool save();
204 
209  bool needsToBeSaved() const;
210 
214  void setNeedsToBeSaved (bool needsToBeSaved);
215 
217  bool reload();
218 
219  //==============================================================================
221  const File& getFile() const noexcept { return file; }
222 
223 
224 protected:
226  void propertyChanged() override;
227 
228 private:
229  //==============================================================================
230  File file;
231  Options options;
232  bool loadedOk, needsWriting;
233 
234  typedef const ScopedPointer<InterProcessLock::ScopedLockType> ProcessScopedLock;
235  InterProcessLock::ScopedLockType* createProcessLock() const;
236 
237  void timerCallback() override;
238  bool saveAsXml();
239  bool saveAsBinary();
240  bool loadAsXml();
241  bool loadAsBinary();
242  bool loadAsBinary (InputStream&);
243 
245 };
246 
247 #endif // JUCE_PROPERTIESFILE_H_INCLUDED
PropertiesFile::Options::applicationName
String applicationName
Definition: juce_PropertiesFile.h:66
PropertiesFile::storeAsBinary
@ storeAsBinary
Definition: juce_PropertiesFile.h:51
ChangeBroadcaster
Definition: juce_ChangeBroadcaster.h:35
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition: juce_PlatformDefs.h:198
InputStream
Definition: juce_InputStream.h:41
String
Definition: juce_String.h:43
PropertiesFile::Options::doNotSave
bool doNotSave
Definition: juce_PropertiesFile.h:111
JUCE_API
#define JUCE_API
Definition: juce_StandardHeader.h:139
ScopedPointer< InterProcessLock::ScopedLockType >
PropertiesFile::Options
Definition: juce_PropertiesFile.h:57
noexcept
#define noexcept
Definition: juce_CompilerSupport.h:141
Timer
Definition: juce_Timer.h:52
ValueTreeSynchroniserHelpers::propertyChanged
@ propertyChanged
Definition: juce_ValueTreeSynchroniser.cpp:29
File
Definition: juce_File.h:45
PropertiesFile::Options::osxLibrarySubFolder
String osxLibrarySubFolder
Definition: juce_PropertiesFile.h:97
InterProcessLock::ScopedLockType
Definition: juce_InterProcessLock.h:76
PropertiesFile::Options::processLock
InterProcessLock * processLock
Definition: juce_PropertiesFile.h:136
PropertiesFile
Definition: juce_PropertiesFile.h:43
PropertiesFile::Options::storageFormat
StorageFormat storageFormat
Definition: juce_PropertiesFile.h:127
PropertiesFile::Options::ignoreCaseOfKeyNames
bool ignoreCaseOfKeyNames
Definition: juce_PropertiesFile.h:108
PropertiesFile::storeAsCompressedBinary
@ storeAsCompressedBinary
Definition: juce_PropertiesFile.h:52
PropertySet
Definition: juce_PropertySet.h:43
PropertiesFile::Options::commonToAllUsers
bool commonToAllUsers
Definition: juce_PropertiesFile.h:102
PropertiesFile::getFile
const File & getFile() const noexcept
Definition: juce_PropertiesFile.h:221
InterProcessLock
Definition: juce_InterProcessLock.h:39
PropertiesFile::isValidFile
bool isValidFile() const noexcept
Definition: juce_PropertiesFile.h:182
PropertiesFile::StorageFormat
StorageFormat
Definition: juce_PropertiesFile.h:49
PropertiesFile::Options::filenameSuffix
String filenameSuffix
Definition: juce_PropertiesFile.h:72
PropertiesFile::Options::folderName
String folderName
Definition: juce_PropertiesFile.h:77
PropertiesFile::Options::millisecondsBeforeSaving
int millisecondsBeforeSaving
Definition: juce_PropertiesFile.h:121