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