OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * DO NOT EDIT. THIS FILE IS GENERATED FROM c:/builds/tinderbox/XR-Mozilla1.8.0
-Release/WINNT_5.2_Depend/mozilla/modules/libpref/public/nsIPrefService.idl |
| 3 */ |
| 4 |
| 5 #ifndef __gen_nsIPrefService_h__ |
| 6 #define __gen_nsIPrefService_h__ |
| 7 |
| 8 |
| 9 #ifndef __gen_nsISupports_h__ |
| 10 #include "nsISupports.h" |
| 11 #endif |
| 12 |
| 13 #ifndef __gen_nsIPrefBranch_h__ |
| 14 #include "nsIPrefBranch.h" |
| 15 #endif |
| 16 |
| 17 /* For IDL files that don't want to include root IDL files. */ |
| 18 #ifndef NS_NO_VTABLE |
| 19 #define NS_NO_VTABLE |
| 20 #endif |
| 21 class nsIFile; /* forward declaration */ |
| 22 |
| 23 |
| 24 /* starting interface: nsIPrefService */ |
| 25 #define NS_IPREFSERVICE_IID_STR "decb9cc7-c08f-4ea5-be91-a8fc637ce2d2" |
| 26 |
| 27 #define NS_IPREFSERVICE_IID \ |
| 28 {0xdecb9cc7, 0xc08f, 0x4ea5, \ |
| 29 { 0xbe, 0x91, 0xa8, 0xfc, 0x63, 0x7c, 0xe2, 0xd2 }} |
| 30 |
| 31 /** |
| 32 * The nsIPrefService interface is the main entry point into the back end |
| 33 * preferences management library. The preference service is directly |
| 34 * responsible for the management of the preferences files and also facilitates |
| 35 * access to the preference branch object which allows the direct manipulation |
| 36 * of the preferences themselves. |
| 37 * |
| 38 * @see nsIPrefBranch |
| 39 * |
| 40 * @status FROZEN |
| 41 */ |
| 42 class NS_NO_VTABLE nsIPrefService : public nsISupports { |
| 43 public: |
| 44 |
| 45 NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPREFSERVICE_IID) |
| 46 |
| 47 /** |
| 48 * Called to read in the preferences specified in a user preference file. |
| 49 * |
| 50 * @param aFile The file to be read. |
| 51 * |
| 52 * @note |
| 53 * If nsnull is passed in for the aFile parameter the default preferences |
| 54 * file(s) [prefs.js, user.js] will be read and processed. |
| 55 * |
| 56 * @return NS_OK File was read and processed. |
| 57 * @return Other File failed to read or contained invalid data. |
| 58 * |
| 59 * @see savePrefFile |
| 60 * @see nsIFile |
| 61 */ |
| 62 /* void readUserPrefs (in nsIFile aFile); */ |
| 63 NS_IMETHOD ReadUserPrefs(nsIFile *aFile) = 0; |
| 64 |
| 65 /** |
| 66 * Called to completely flush and re-initialize the preferences system. |
| 67 * |
| 68 * @return NS_OK The preference service was re-initialized correctly. |
| 69 * @return Other The preference service failed to restart correctly. |
| 70 */ |
| 71 /* void resetPrefs (); */ |
| 72 NS_IMETHOD ResetPrefs(void) = 0; |
| 73 |
| 74 /** |
| 75 * Called to reset all preferences with user set values back to the |
| 76 * application default values. |
| 77 * |
| 78 * @return NS_OK Always. |
| 79 */ |
| 80 /* void resetUserPrefs (); */ |
| 81 NS_IMETHOD ResetUserPrefs(void) = 0; |
| 82 |
| 83 /** |
| 84 * Called to write current preferences state to a file. |
| 85 * |
| 86 * @param aFile The file to be written. |
| 87 * |
| 88 * @note |
| 89 * If nsnull is passed in for the aFile parameter the preference data is |
| 90 * written out to the current preferences file (usually prefs.js.) |
| 91 * |
| 92 * @return NS_OK File was written. |
| 93 * @return Other File failed to write. |
| 94 * |
| 95 * @see readUserPrefs |
| 96 * @see nsIFile |
| 97 */ |
| 98 /* void savePrefFile (in nsIFile aFile); */ |
| 99 NS_IMETHOD SavePrefFile(nsIFile *aFile) = 0; |
| 100 |
| 101 /** |
| 102 * Call to get a Preferences "Branch" which accesses user preference data. |
| 103 * Using a Set method on this object will always create or set a user |
| 104 * preference value. When using a Get method a user set value will be |
| 105 * returned if one exists, otherwise a default value will be returned. |
| 106 * |
| 107 * @param aPrefRoot The preference "root" on which to base this "branch". |
| 108 * For example, if the root "browser.startup." is used, the |
| 109 * branch will be able to easily access the preferences |
| 110 * "browser.startup.page", "browser.startup.homepage", or |
| 111 * "browser.startup.homepage_override" by simply requesting |
| 112 * "page", "homepage", or "homepage_override". nsnull or "" |
| 113 * may be used to access to the entire preference "tree". |
| 114 * |
| 115 * @return nsIPrefBranch The object representing the requested branch. |
| 116 * |
| 117 * @see getDefaultBranch |
| 118 */ |
| 119 /* nsIPrefBranch getBranch (in string aPrefRoot); */ |
| 120 NS_IMETHOD GetBranch(const char *aPrefRoot, nsIPrefBranch **_retval) = 0; |
| 121 |
| 122 /** |
| 123 * Call to get a Preferences "Branch" which accesses only the default |
| 124 * preference data. Using a Set method on this object will always create or |
| 125 * set a default preference value. When using a Get method a default value |
| 126 * will always be returned. |
| 127 * |
| 128 * @param aPrefRoot The preference "root" on which to base this "branch". |
| 129 * For example, if the root "browser.startup." is used, the |
| 130 * branch will be able to easily access the preferences |
| 131 * "browser.startup.page", "browser.startup.homepage", or |
| 132 * "browser.startup.homepage_override" by simply requesting |
| 133 * "page", "homepage", or "homepage_override". nsnull or "" |
| 134 * may be used to access to the entire preference "tree". |
| 135 * |
| 136 * @note |
| 137 * Few consumers will want to create default branch objects. Many of the |
| 138 * branch methods do nothing on a default branch because the operations only |
| 139 * make sense when applied to user set preferences. |
| 140 * |
| 141 * @return nsIPrefBranch The object representing the requested default branch. |
| 142 * |
| 143 * @see getBranch |
| 144 */ |
| 145 /* nsIPrefBranch getDefaultBranch (in string aPrefRoot); */ |
| 146 NS_IMETHOD GetDefaultBranch(const char *aPrefRoot, nsIPrefBranch **_retval) =
0; |
| 147 |
| 148 }; |
| 149 |
| 150 /* Use this macro when declaring classes that implement this interface. */ |
| 151 #define NS_DECL_NSIPREFSERVICE \ |
| 152 NS_IMETHOD ReadUserPrefs(nsIFile *aFile); \ |
| 153 NS_IMETHOD ResetPrefs(void); \ |
| 154 NS_IMETHOD ResetUserPrefs(void); \ |
| 155 NS_IMETHOD SavePrefFile(nsIFile *aFile); \ |
| 156 NS_IMETHOD GetBranch(const char *aPrefRoot, nsIPrefBranch **_retval); \ |
| 157 NS_IMETHOD GetDefaultBranch(const char *aPrefRoot, nsIPrefBranch **_retval); |
| 158 |
| 159 /* Use this macro to declare functions that forward the behavior of this interfa
ce to another object. */ |
| 160 #define NS_FORWARD_NSIPREFSERVICE(_to) \ |
| 161 NS_IMETHOD ReadUserPrefs(nsIFile *aFile) { return _to ReadUserPrefs(aFile); }
\ |
| 162 NS_IMETHOD ResetPrefs(void) { return _to ResetPrefs(); } \ |
| 163 NS_IMETHOD ResetUserPrefs(void) { return _to ResetUserPrefs(); } \ |
| 164 NS_IMETHOD SavePrefFile(nsIFile *aFile) { return _to SavePrefFile(aFile); } \ |
| 165 NS_IMETHOD GetBranch(const char *aPrefRoot, nsIPrefBranch **_retval) { return
_to GetBranch(aPrefRoot, _retval); } \ |
| 166 NS_IMETHOD GetDefaultBranch(const char *aPrefRoot, nsIPrefBranch **_retval) {
return _to GetDefaultBranch(aPrefRoot, _retval); } |
| 167 |
| 168 /* Use this macro to declare functions that forward the behavior of this interfa
ce to another object in a safe way. */ |
| 169 #define NS_FORWARD_SAFE_NSIPREFSERVICE(_to) \ |
| 170 NS_IMETHOD ReadUserPrefs(nsIFile *aFile) { return !_to ? NS_ERROR_NULL_POINTER
: _to->ReadUserPrefs(aFile); } \ |
| 171 NS_IMETHOD ResetPrefs(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Reset
Prefs(); } \ |
| 172 NS_IMETHOD ResetUserPrefs(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->R
esetUserPrefs(); } \ |
| 173 NS_IMETHOD SavePrefFile(nsIFile *aFile) { return !_to ? NS_ERROR_NULL_POINTER
: _to->SavePrefFile(aFile); } \ |
| 174 NS_IMETHOD GetBranch(const char *aPrefRoot, nsIPrefBranch **_retval) { return
!_to ? NS_ERROR_NULL_POINTER : _to->GetBranch(aPrefRoot, _retval); } \ |
| 175 NS_IMETHOD GetDefaultBranch(const char *aPrefRoot, nsIPrefBranch **_retval) {
return !_to ? NS_ERROR_NULL_POINTER : _to->GetDefaultBranch(aPrefRoot, _retval);
} |
| 176 |
| 177 #if 0 |
| 178 /* Use the code below as a template for the implementation class for this interf
ace. */ |
| 179 |
| 180 /* Header file */ |
| 181 class nsPrefService : public nsIPrefService |
| 182 { |
| 183 public: |
| 184 NS_DECL_ISUPPORTS |
| 185 NS_DECL_NSIPREFSERVICE |
| 186 |
| 187 nsPrefService(); |
| 188 |
| 189 private: |
| 190 ~nsPrefService(); |
| 191 |
| 192 protected: |
| 193 /* additional members */ |
| 194 }; |
| 195 |
| 196 /* Implementation file */ |
| 197 NS_IMPL_ISUPPORTS1(nsPrefService, nsIPrefService) |
| 198 |
| 199 nsPrefService::nsPrefService() |
| 200 { |
| 201 /* member initializers and constructor code */ |
| 202 } |
| 203 |
| 204 nsPrefService::~nsPrefService() |
| 205 { |
| 206 /* destructor code */ |
| 207 } |
| 208 |
| 209 /* void readUserPrefs (in nsIFile aFile); */ |
| 210 NS_IMETHODIMP nsPrefService::ReadUserPrefs(nsIFile *aFile) |
| 211 { |
| 212 return NS_ERROR_NOT_IMPLEMENTED; |
| 213 } |
| 214 |
| 215 /* void resetPrefs (); */ |
| 216 NS_IMETHODIMP nsPrefService::ResetPrefs() |
| 217 { |
| 218 return NS_ERROR_NOT_IMPLEMENTED; |
| 219 } |
| 220 |
| 221 /* void resetUserPrefs (); */ |
| 222 NS_IMETHODIMP nsPrefService::ResetUserPrefs() |
| 223 { |
| 224 return NS_ERROR_NOT_IMPLEMENTED; |
| 225 } |
| 226 |
| 227 /* void savePrefFile (in nsIFile aFile); */ |
| 228 NS_IMETHODIMP nsPrefService::SavePrefFile(nsIFile *aFile) |
| 229 { |
| 230 return NS_ERROR_NOT_IMPLEMENTED; |
| 231 } |
| 232 |
| 233 /* nsIPrefBranch getBranch (in string aPrefRoot); */ |
| 234 NS_IMETHODIMP nsPrefService::GetBranch(const char *aPrefRoot, nsIPrefBranch **_r
etval) |
| 235 { |
| 236 return NS_ERROR_NOT_IMPLEMENTED; |
| 237 } |
| 238 |
| 239 /* nsIPrefBranch getDefaultBranch (in string aPrefRoot); */ |
| 240 NS_IMETHODIMP nsPrefService::GetDefaultBranch(const char *aPrefRoot, nsIPrefBran
ch **_retval) |
| 241 { |
| 242 return NS_ERROR_NOT_IMPLEMENTED; |
| 243 } |
| 244 |
| 245 /* End of implementation class template. */ |
| 246 #endif |
| 247 |
| 248 #define NS_PREFSERVICE_CID \ |
| 249 { /* {1cd91b88-1dd2-11b2-92e1-ed22ed298000} */ \ |
| 250 0x1cd91b88, \ |
| 251 0x1dd2, \ |
| 252 0x11b2, \ |
| 253 { 0x92, 0xe1, 0xed, 0x22, 0xed, 0x29, 0x80, 0x00 } \ |
| 254 } |
| 255 #define NS_PREFSERVICE_CONTRACTID "@mozilla.org/preferences-service;1" |
| 256 #define NS_PREFSERVICE_CLASSNAME "Preferences Server" |
| 257 /** |
| 258 * Notification sent before reading the default user preferences files. |
| 259 */ |
| 260 #define NS_PREFSERVICE_READ_TOPIC_ID "prefservice:before-read-userprefs" |
| 261 /** |
| 262 * Notification sent when resetPrefs has been called, but before the actual |
| 263 * reset process occurs. |
| 264 */ |
| 265 #define NS_PREFSERVICE_RESET_TOPIC_ID "prefservice:before-reset" |
| 266 |
| 267 #endif /* __gen_nsIPrefService_h__ */ |
OLD | NEW |