tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_PropertyStorage.h
Go to the documentation of this file.
1 /*
2 ,--. ,--. ,--. ,--.
3 ,-' '-.,--.--.,--,--.,---.| |,-.,-' '-.`--' ,---. ,--,--, Copyright 2024
4 '-. .-'| .--' ,-. | .--'| /'-. .-',--.| .-. || \ Tracktion Software
5 | | | | \ '-' \ `--.| \ \ | | | |' '-' '| || | Corporation
6 `---' `--' `--`--'`---'`--'`--' `---' `--' `---' `--''--' www.tracktion.com
7
8 Tracktion Engine uses a GPL/commercial licence - see LICENCE.md for details.
9*/
10
11namespace tracktion { inline namespace engine
12{
13
19{
20public:
21 //==============================================================================
22 PropertyStorage (juce::String appName_) : appName (appName_) {}
23 virtual ~PropertyStorage() {}
24
25 static juce::StringRef settingToString (SettingID);
26
27 //==============================================================================
28 virtual juce::File getAppCacheFolder();
29 virtual juce::File getAppPrefsFolder();
30
31 virtual void flushSettingsToDisk() {}
32
33 //==============================================================================
34 virtual void removeProperty (SettingID);
35
36 virtual juce::var getProperty (SettingID setting, const juce::var& defaultValue = {});
37 virtual void setProperty (SettingID setting, const juce::var& value);
38
39 virtual std::unique_ptr<juce::XmlElement> getXmlProperty (SettingID setting);
40 virtual void setXmlProperty (SettingID setting, const juce::XmlElement&);
41
42 //==============================================================================
43 virtual void removePropertyItem (SettingID setting, juce::StringRef item);
44
45 virtual juce::var getPropertyItem (SettingID setting, juce::StringRef item, const juce::var& defaultValue = {});
46 virtual void setPropertyItem (SettingID setting, juce::StringRef item, const juce::var& value);
47
48 virtual std::unique_ptr<juce::XmlElement> getXmlPropertyItem (SettingID setting, juce::StringRef item);
49 virtual void setXmlPropertyItem (SettingID setting, juce::StringRef item, const juce::XmlElement&);
50
51 //==============================================================================
52 virtual juce::File getDefaultLoadSaveDirectory (juce::StringRef label);
53 virtual void setDefaultLoadSaveDirectory (juce::StringRef label, const juce::File& newPath);
54
55 virtual juce::File getDefaultLoadSaveDirectory (ProjectItem::Category);
56
57 //==============================================================================
58 virtual juce::String getUserName();
59 virtual juce::String getApplicationName() { return appName; }
60 virtual juce::String getApplicationVersion() { return "Unknown"; }
61
62 //==============================================================================
63 // If you are using the default implementation of PropertyStorage, it uses a
64 // PropertiesFile to store its state. This accessor method lets you use it in
65 // case you need it for things like a juce::PluginListComponent.
66 virtual juce::PropertiesFile& getPropertiesFile();
67
68private:
69 juce::String appName;
70
72};
73
74}} // namespace tracktion { inline namespace engine
Create a subclass of PropertyStorage to customize how settings are saved and recalled.
SettingID
A list of settings the engine will get and set.