1 /*
2  * UserPrefs.hpp
3  *
4  * Copyright (C) 2021 by RStudio, PBC
5  *
6  * Unless you have received this program directly from RStudio pursuant
7  * to the terms of a commercial license agreement with RStudio, then
8  * this program is licensed to you under the terms of version 3 of the
9  * GNU Affero General Public License. This program is distributed WITHOUT
10  * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
11  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
12  * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
13  *
14  */
15 
16 #ifndef SESSION_USER_PREFS_HPP
17 #define SESSION_USER_PREFS_HPP
18 
19 #define kUserPrefsFile "rstudio-prefs.json"
20 #define kUserPrefsSchemaFile "user-prefs-schema.json"
21 
22 #define kUserPrefsDefaultLayer  "default"
23 #define kUserPrefsComputedLayer "computed"
24 #define kUserPrefsSystemLayer   "system"
25 #define kUserPrefsUserLayer     "user"
26 #define kUserPrefsProjectLayer  "project"
27 
28 #include "UserPrefValuesNative.hpp"
29 
30 #include <shared_core/json/Json.hpp>
31 
32 namespace rstudio {
33    namespace core {
34       class Error;
35    }
36 }
37 
38 namespace rstudio {
39 namespace session {
40 namespace prefs {
41 
42 enum PrefLayers
43 {
44    PREF_LAYER_MIN      = 0,
45 
46    PREF_LAYER_DEFAULT  = PREF_LAYER_MIN,
47    PREF_LAYER_COMPUTED = 1,
48    PREF_LAYER_SYSTEM   = 2,
49    PREF_LAYER_USER     = 3,
50    PREF_LAYER_PROJECT  = 4,
51 
52    PREF_LAYER_MAX      = PREF_LAYER_PROJECT
53 };
54 
55 UserPrefValuesNative& userPrefs();
56 
57 core::json::Array allPrefLayers();
58 
59 core::Error initializePrefs();
60 
61 core::Error initializeSessionPrefs();
62 
63 core::Error initializeProjectPrefs();
64 
65 } // namespace prefs
66 } // namespace session
67 } // namespace rstudio
68 
69 #endif
70