PageRenderTime 134ms CodeModel.GetById 81ms app.highlight 5ms RepoModel.GetById 45ms app.codeStats 0ms

/gecko_api/include/nsIPrefService.h

http://firefox-mac-pdf.googlecode.com/
C++ Header | 275 lines | 104 code | 38 blank | 133 comment | 0 complexity | 8eca25a5f51f627cafefff164e0764b4 MD5 | raw file
  1/*
  2 * DO NOT EDIT.  THIS FILE IS GENERATED FROM /builds/tinderbox/XR-Trunk/Darwin_8.8.4_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
 21class 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 */
 42class NS_NO_VTABLE NS_SCRIPTABLE nsIPrefService : public nsISupports {
 43 public: 
 44
 45  NS_DECLARE_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_SCRIPTABLE 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_SCRIPTABLE 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_SCRIPTABLE 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_SCRIPTABLE 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_SCRIPTABLE 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_SCRIPTABLE NS_IMETHOD GetDefaultBranch(const char *aPrefRoot, nsIPrefBranch **_retval) = 0;
147
148};
149
150  NS_DEFINE_STATIC_IID_ACCESSOR(nsIPrefService, NS_IPREFSERVICE_IID)
151
152/* Use this macro when declaring classes that implement this interface. */
153#define NS_DECL_NSIPREFSERVICE \
154  NS_SCRIPTABLE NS_IMETHOD ReadUserPrefs(nsIFile *aFile); \
155  NS_SCRIPTABLE NS_IMETHOD ResetPrefs(void); \
156  NS_SCRIPTABLE NS_IMETHOD ResetUserPrefs(void); \
157  NS_SCRIPTABLE NS_IMETHOD SavePrefFile(nsIFile *aFile); \
158  NS_SCRIPTABLE NS_IMETHOD GetBranch(const char *aPrefRoot, nsIPrefBranch **_retval); \
159  NS_SCRIPTABLE NS_IMETHOD GetDefaultBranch(const char *aPrefRoot, nsIPrefBranch **_retval); 
160
161/* Use this macro to declare functions that forward the behavior of this interface to another object. */
162#define NS_FORWARD_NSIPREFSERVICE(_to) \
163  NS_SCRIPTABLE NS_IMETHOD ReadUserPrefs(nsIFile *aFile) { return _to ReadUserPrefs(aFile); } \
164  NS_SCRIPTABLE NS_IMETHOD ResetPrefs(void) { return _to ResetPrefs(); } \
165  NS_SCRIPTABLE NS_IMETHOD ResetUserPrefs(void) { return _to ResetUserPrefs(); } \
166  NS_SCRIPTABLE NS_IMETHOD SavePrefFile(nsIFile *aFile) { return _to SavePrefFile(aFile); } \
167  NS_SCRIPTABLE NS_IMETHOD GetBranch(const char *aPrefRoot, nsIPrefBranch **_retval) { return _to GetBranch(aPrefRoot, _retval); } \
168  NS_SCRIPTABLE NS_IMETHOD GetDefaultBranch(const char *aPrefRoot, nsIPrefBranch **_retval) { return _to GetDefaultBranch(aPrefRoot, _retval); } 
169
170/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
171#define NS_FORWARD_SAFE_NSIPREFSERVICE(_to) \
172  NS_SCRIPTABLE NS_IMETHOD ReadUserPrefs(nsIFile *aFile) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReadUserPrefs(aFile); } \
173  NS_SCRIPTABLE NS_IMETHOD ResetPrefs(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->ResetPrefs(); } \
174  NS_SCRIPTABLE NS_IMETHOD ResetUserPrefs(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->ResetUserPrefs(); } \
175  NS_SCRIPTABLE NS_IMETHOD SavePrefFile(nsIFile *aFile) { return !_to ? NS_ERROR_NULL_POINTER : _to->SavePrefFile(aFile); } \
176  NS_SCRIPTABLE NS_IMETHOD GetBranch(const char *aPrefRoot, nsIPrefBranch **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetBranch(aPrefRoot, _retval); } \
177  NS_SCRIPTABLE NS_IMETHOD GetDefaultBranch(const char *aPrefRoot, nsIPrefBranch **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDefaultBranch(aPrefRoot, _retval); } 
178
179#if 0
180/* Use the code below as a template for the implementation class for this interface. */
181
182/* Header file */
183class nsPrefService : public nsIPrefService
184{
185public:
186  NS_DECL_ISUPPORTS
187  NS_DECL_NSIPREFSERVICE
188
189  nsPrefService();
190
191private:
192  ~nsPrefService();
193
194protected:
195  /* additional members */
196};
197
198/* Implementation file */
199NS_IMPL_ISUPPORTS1(nsPrefService, nsIPrefService)
200
201nsPrefService::nsPrefService()
202{
203  /* member initializers and constructor code */
204}
205
206nsPrefService::~nsPrefService()
207{
208  /* destructor code */
209}
210
211/* void readUserPrefs (in nsIFile aFile); */
212NS_IMETHODIMP nsPrefService::ReadUserPrefs(nsIFile *aFile)
213{
214    return NS_ERROR_NOT_IMPLEMENTED;
215}
216
217/* void resetPrefs (); */
218NS_IMETHODIMP nsPrefService::ResetPrefs()
219{
220    return NS_ERROR_NOT_IMPLEMENTED;
221}
222
223/* void resetUserPrefs (); */
224NS_IMETHODIMP nsPrefService::ResetUserPrefs()
225{
226    return NS_ERROR_NOT_IMPLEMENTED;
227}
228
229/* void savePrefFile (in nsIFile aFile); */
230NS_IMETHODIMP nsPrefService::SavePrefFile(nsIFile *aFile)
231{
232    return NS_ERROR_NOT_IMPLEMENTED;
233}
234
235/* nsIPrefBranch getBranch (in string aPrefRoot); */
236NS_IMETHODIMP nsPrefService::GetBranch(const char *aPrefRoot, nsIPrefBranch **_retval)
237{
238    return NS_ERROR_NOT_IMPLEMENTED;
239}
240
241/* nsIPrefBranch getDefaultBranch (in string aPrefRoot); */
242NS_IMETHODIMP nsPrefService::GetDefaultBranch(const char *aPrefRoot, nsIPrefBranch **_retval)
243{
244    return NS_ERROR_NOT_IMPLEMENTED;
245}
246
247/* End of implementation class template. */
248#endif
249
250#define NS_PREFSERVICE_CID                             \
251  { /* {1cd91b88-1dd2-11b2-92e1-ed22ed298000} */       \
252    0x1cd91b88,                                        \
253    0x1dd2,                                            \
254    0x11b2,                                            \
255    { 0x92, 0xe1, 0xed, 0x22, 0xed, 0x29, 0x80, 0x00 } \
256  }
257#define NS_PREFSERVICE_CONTRACTID "@mozilla.org/preferences-service;1"
258#define NS_PREFSERVICE_CLASSNAME "Preferences Server"
259/**
260 * Notification sent before reading the default user preferences files.
261 */
262#define NS_PREFSERVICE_READ_TOPIC_ID "prefservice:before-read-userprefs"
263/**
264 * Notification sent when resetPrefs has been called, but before the actual
265 * reset process occurs.
266 */
267#define NS_PREFSERVICE_RESET_TOPIC_ID "prefservice:before-reset"
268/**
269 * Notification sent when after reading app-provided default
270 * preferences, but before user profile override defaults or extension
271 * defaults are loaded.
272 */
273#define NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID "prefservice:after-app-defaults"
274
275#endif /* __gen_nsIPrefService_h__ */