Skip to content

Commit a34497d

Browse files
committed
PropertiesFile: Add immutable fluent interface to PropertiesFile::Options
1 parent 79dfa1d commit a34497d

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

modules/juce_data_structures/app_properties/juce_PropertiesFile.h

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,88 @@ class JUCE_API PropertiesFile : public PropertySet,
7373
*/
7474
Options();
7575

76+
/** Returns a copy of these options with the provided application name.
77+
This sets the @ref applicationName member.
78+
*/
79+
[[nodiscard]] Options withApplicationName (const String& newApplicationName) const
80+
{
81+
return withMember (*this, &Options::applicationName, newApplicationName);
82+
}
83+
84+
/** Returns a copy of these options with the provided suffix for the properties file.
85+
This sets the @ref filenameSuffix member.
86+
*/
87+
[[nodiscard]] Options withFilenameSuffix (const String& newFilenameSuffix) const
88+
{
89+
return withMember (*this, &Options::filenameSuffix, newFilenameSuffix);
90+
}
91+
92+
/** Returns a copy of these options with the provided subfolder name.
93+
This sets the @ref folderName member.
94+
*/
95+
[[nodiscard]] Options withFolderName (const String& newFolderName) const
96+
{
97+
return withMember (*this, &Options::folderName, newFolderName);
98+
}
99+
100+
/** Returns a copy of these options with the provided Library subfolder for MacOS.
101+
This sets the @ref osxLibrarySubFolder member.
102+
*/
103+
[[nodiscard]] Options withOsxLibrarySubFolder (const String& newOsxLibrarySubFolder) const
104+
{
105+
return withMember (*this, &Options::osxLibrarySubFolder, newOsxLibrarySubFolder);
106+
}
107+
108+
/** Returns a copy of these options with the provided "commonToAllUsers" flag.
109+
This sets the @ref commonToAllUsers member.
110+
*/
111+
[[nodiscard]] Options withCommonToAllUsers (bool newCommonToAllUsersValue) const
112+
{
113+
return withMember (*this, &Options::commonToAllUsers, newCommonToAllUsersValue);
114+
}
115+
116+
/** Returns a copy of these options with the provided case sensitivity flag for key names.
117+
This sets the @ref ignoreCaseOfKeyNames member.
118+
*/
119+
[[nodiscard]] Options withIgnoreCaseOfKeyNames (bool newIgnoreCaseOfKeyNamesValue) const
120+
{
121+
return withMember (*this, &Options::ignoreCaseOfKeyNames, newIgnoreCaseOfKeyNamesValue);
122+
}
123+
124+
/** Returns a copy of these options with the provided "doNotSave" flag.
125+
This sets the @ref doNotSave member.
126+
*/
127+
[[nodiscard]] Options withDoNotSave (bool newDoNotSaveValue) const
128+
{
129+
return withMember (*this, &Options::doNotSave, newDoNotSaveValue);
130+
}
131+
132+
/** Returns a copy of these options with the provided wait time before saving.
133+
This sets the @ref millisecondsBeforeSaving member.
134+
*/
135+
[[nodiscard]] Options withMillisecondsBeforeSaving (int newMillisecondsBeforeSaving) const
136+
{
137+
return withMember (*this, &Options::millisecondsBeforeSaving, newMillisecondsBeforeSaving);
138+
}
139+
140+
/** Returns a copy of these options with the provided storage format.
141+
This sets the @ref storageFormat member.
142+
@see StorageFormat
143+
*/
144+
[[nodiscard]] Options withStorageFormat (StorageFormat newStorageFormat) const
145+
{
146+
return withMember (*this, &Options::storageFormat, newStorageFormat);
147+
}
148+
149+
/** Returns a copy of these options with the provided process lock.
150+
This sets the @ref processLock member.
151+
@see InterProcessLock
152+
*/
153+
[[nodiscard]] Options withProcessLock (InterProcessLock* newProcessLock) const
154+
{
155+
return withMember (*this, &Options::processLock, newProcessLock);
156+
}
157+
76158
/** The name of your application - this is used to help generate the path and filename
77159
at which the properties file will be stored. */
78160
String applicationName;

0 commit comments

Comments
 (0)