OpenShot Audio Library | OpenShotAudio 0.3.2
Loading...
Searching...
No Matches
juce::PropertiesFile::Options Struct Reference

#include <juce_PropertiesFile.h>

Public Member Functions

 Options ()
 
File getDefaultFile () const
 

Public Attributes

String applicationName
 
String filenameSuffix
 
String folderName
 
String osxLibrarySubFolder
 
bool commonToAllUsers
 
bool ignoreCaseOfKeyNames
 
bool doNotSave
 
int millisecondsBeforeSaving
 
StorageFormat storageFormat
 
InterProcessLockprocessLock
 

Detailed Description

Structure describing properties file options

Definition at line 61 of file juce_PropertiesFile.h.

Constructor & Destructor Documentation

◆ Options()

juce::PropertiesFile::Options::Options ( )

Creates an empty Options structure. You'll need to fill-in the data members appropriately before using this structure.

Definition at line 42 of file juce_PropertiesFile.cpp.

Member Function Documentation

◆ getDefaultFile()

File juce::PropertiesFile::Options::getDefaultFile ( ) const

This can be called to suggest a file that should be used, based on the values in this structure.

So on a Mac, this will return a file called: ~/Library/[osxLibrarySubFolder]/[folderName]/[applicationName].[filenameSuffix]

On Windows it'll return something like: C:\Documents and Settings\username\Application Data\[folderName]\[applicationName].[filenameSuffix]

On Linux it'll return ~/[folderName]/[applicationName].[filenameSuffix]

If the folderName variable is empty, it'll use the app name for this (or omit the folder name on the Mac).

The paths will also vary depending on whether commonToAllUsers is true.

Definition at line 52 of file juce_PropertiesFile.cpp.

Member Data Documentation

◆ applicationName

String juce::PropertiesFile::Options::applicationName

The name of your application - this is used to help generate the path and filename at which the properties file will be stored.

Definition at line 70 of file juce_PropertiesFile.h.

◆ commonToAllUsers

bool juce::PropertiesFile::Options::commonToAllUsers

If true, the file will be created in a location that's shared between users. The default constructor initialises this value to false.

Definition at line 110 of file juce_PropertiesFile.h.

◆ doNotSave

bool juce::PropertiesFile::Options::doNotSave

If set to true, this prevents the file from being written to disk.

Definition at line 119 of file juce_PropertiesFile.h.

Referenced by juce::PropertiesFile::save().

◆ filenameSuffix

String juce::PropertiesFile::Options::filenameSuffix

The suffix to use for your properties file. It doesn't really matter what this is - you may want to use ".settings" or ".properties" or something. If the suffix includes the prefixing dot (for example ".settings") then the suffix of applicationName will be replaced with your suffix ("MyApp.exe" -> "MyApp.settings"). If your filenameSuffix does NOT include the dot, then the suffix will be appended to the applicationName ("MyApp.exe" -> "MyApp.exe.settings").

Definition at line 80 of file juce_PropertiesFile.h.

◆ folderName

String juce::PropertiesFile::Options::folderName

The name of a subfolder in which you'd like your properties file to live. See the getDefaultFile() method for more details about how this is used.

Definition at line 85 of file juce_PropertiesFile.h.

◆ ignoreCaseOfKeyNames

bool juce::PropertiesFile::Options::ignoreCaseOfKeyNames

If true, this means that property names are matched in a case-insensitive manner. See the PropertySet constructor for more info. The default constructor initialises this value to false.

Definition at line 116 of file juce_PropertiesFile.h.

◆ millisecondsBeforeSaving

int juce::PropertiesFile::Options::millisecondsBeforeSaving

If this is zero or greater, then after a value is changed, the object will wait for this amount of time and then save the file. If this zero, the file will be written to disk immediately on being changed (which might be slow, as it'll re-write synchronously each time a value-change method is called). If it is less than zero, the file won't be saved until save() or saveIfNeeded() are explicitly called. The default constructor sets this to a reasonable value of a few seconds, so you only need to change it if you need a special case.

Definition at line 129 of file juce_PropertiesFile.h.

Referenced by juce::PropertiesFile::propertyChanged().

◆ osxLibrarySubFolder

String juce::PropertiesFile::Options::osxLibrarySubFolder

If you're using properties files on a Mac, you must set this value - failure to do so will cause a runtime assertion.

The PropertiesFile class always used to put its settings files in "Library/Preferences", but Apple have changed their advice, and now stipulate that settings should go in "Library/Application Support".

Because older apps would be broken by a silent change in this class's behaviour, you must now explicitly set the osxLibrarySubFolder value to indicate which path you want to use.

In newer apps, you should always set this to "Application Support" or "Application Support/YourSubFolderName".

If your app needs to load settings files that were created by older versions of juce and you want to maintain backwards-compatibility, then you can set this to "Preferences". But.. for better Apple-compliance, the recommended approach would be to write some code that finds your old settings files in ~/Library/Preferences, moves them to ~/Library/Application Support, and then uses the new path.

Definition at line 105 of file juce_PropertiesFile.h.

◆ processLock

InterProcessLock* juce::PropertiesFile::Options::processLock

An optional InterprocessLock object that will be used to prevent multiple threads or processes from writing to the file at the same time. The PropertiesFile will keep a pointer to this object but will not take ownership of it - the caller is responsible for making sure that the lock doesn't get deleted before the PropertiesFile has been deleted. The default constructor initialises this value to nullptr, so you don't need to touch it unless you want to use a lock.

Definition at line 144 of file juce_PropertiesFile.h.

◆ storageFormat

StorageFormat juce::PropertiesFile::Options::storageFormat

Specifies whether the file should be written as XML, binary, etc. The default constructor sets this to storeAsXML, so you only need to set it explicitly if you want to use a different format.

Definition at line 135 of file juce_PropertiesFile.h.

Referenced by juce::PropertiesFile::save().


The documentation for this struct was generated from the following files: