nsIPrefService.h 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. /*
  2. * DO NOT EDIT. THIS FILE IS GENERATED FROM c:/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 nsIPrefService : public nsISupports {
  34. public:
  35. NS_DEFINE_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_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_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_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_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_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_IMETHOD GetDefaultBranch(const char *aPrefRoot, nsIPrefBranch **_retval) = 0;
  131. };
  132. /* Use this macro when declaring classes that implement this interface. */
  133. #define NS_DECL_NSIPREFSERVICE \
  134. NS_IMETHOD ReadUserPrefs(nsIFile *aFile); \
  135. NS_IMETHOD ResetPrefs(void); \
  136. NS_IMETHOD ResetUserPrefs(void); \
  137. NS_IMETHOD SavePrefFile(nsIFile *aFile); \
  138. NS_IMETHOD GetBranch(const char *aPrefRoot, nsIPrefBranch **_retval); \
  139. NS_IMETHOD GetDefaultBranch(const char *aPrefRoot, nsIPrefBranch **_retval);
  140. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  141. #define NS_FORWARD_NSIPREFSERVICE(_to) \
  142. NS_IMETHOD ReadUserPrefs(nsIFile *aFile) { return _to ReadUserPrefs(aFile); } \
  143. NS_IMETHOD ResetPrefs(void) { return _to ResetPrefs(); } \
  144. NS_IMETHOD ResetUserPrefs(void) { return _to ResetUserPrefs(); } \
  145. NS_IMETHOD SavePrefFile(nsIFile *aFile) { return _to SavePrefFile(aFile); } \
  146. NS_IMETHOD GetBranch(const char *aPrefRoot, nsIPrefBranch **_retval) { return _to GetBranch(aPrefRoot, _retval); } \
  147. NS_IMETHOD GetDefaultBranch(const char *aPrefRoot, nsIPrefBranch **_retval) { return _to GetDefaultBranch(aPrefRoot, _retval); }
  148. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  149. #define NS_FORWARD_SAFE_NSIPREFSERVICE(_to) \
  150. NS_IMETHOD ReadUserPrefs(nsIFile *aFile) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReadUserPrefs(aFile); } \
  151. NS_IMETHOD ResetPrefs(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->ResetPrefs(); } \
  152. NS_IMETHOD ResetUserPrefs(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->ResetUserPrefs(); } \
  153. NS_IMETHOD SavePrefFile(nsIFile *aFile) { return !_to ? NS_ERROR_NULL_POINTER : _to->SavePrefFile(aFile); } \
  154. NS_IMETHOD GetBranch(const char *aPrefRoot, nsIPrefBranch **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetBranch(aPrefRoot, _retval); } \
  155. NS_IMETHOD GetDefaultBranch(const char *aPrefRoot, nsIPrefBranch **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDefaultBranch(aPrefRoot, _retval); }
  156. #if 0
  157. /* Use the code below as a template for the implementation class for this interface. */
  158. /* Header file */
  159. class nsPrefService : public nsIPrefService
  160. {
  161. public:
  162. NS_DECL_ISUPPORTS
  163. NS_DECL_NSIPREFSERVICE
  164. nsPrefService();
  165. private:
  166. ~nsPrefService();
  167. protected:
  168. /* additional members */
  169. };
  170. /* Implementation file */
  171. NS_IMPL_ISUPPORTS1(nsPrefService, nsIPrefService)
  172. nsPrefService::nsPrefService()
  173. {
  174. /* member initializers and constructor code */
  175. }
  176. nsPrefService::~nsPrefService()
  177. {
  178. /* destructor code */
  179. }
  180. /* void readUserPrefs (in nsIFile aFile); */
  181. NS_IMETHODIMP nsPrefService::ReadUserPrefs(nsIFile *aFile)
  182. {
  183. return NS_ERROR_NOT_IMPLEMENTED;
  184. }
  185. /* void resetPrefs (); */
  186. NS_IMETHODIMP nsPrefService::ResetPrefs()
  187. {
  188. return NS_ERROR_NOT_IMPLEMENTED;
  189. }
  190. /* void resetUserPrefs (); */
  191. NS_IMETHODIMP nsPrefService::ResetUserPrefs()
  192. {
  193. return NS_ERROR_NOT_IMPLEMENTED;
  194. }
  195. /* void savePrefFile (in nsIFile aFile); */
  196. NS_IMETHODIMP nsPrefService::SavePrefFile(nsIFile *aFile)
  197. {
  198. return NS_ERROR_NOT_IMPLEMENTED;
  199. }
  200. /* nsIPrefBranch getBranch (in string aPrefRoot); */
  201. NS_IMETHODIMP nsPrefService::GetBranch(const char *aPrefRoot, nsIPrefBranch **_retval)
  202. {
  203. return NS_ERROR_NOT_IMPLEMENTED;
  204. }
  205. /* nsIPrefBranch getDefaultBranch (in string aPrefRoot); */
  206. NS_IMETHODIMP nsPrefService::GetDefaultBranch(const char *aPrefRoot, nsIPrefBranch **_retval)
  207. {
  208. return NS_ERROR_NOT_IMPLEMENTED;
  209. }
  210. /* End of implementation class template. */
  211. #endif
  212. #define NS_PREFSERVICE_CID \
  213. { /* {1cd91b88-1dd2-11b2-92e1-ed22ed298000} */ \
  214. 0x1cd91b88, \
  215. 0x1dd2, \
  216. 0x11b2, \
  217. { 0x92, 0xe1, 0xed, 0x22, 0xed, 0x29, 0x80, 0x00 } \
  218. }
  219. #define NS_PREFSERVICE_CONTRACTID "@mozilla.org/preferences-service;1"
  220. #define NS_PREFSERVICE_CLASSNAME "Preferences Server"
  221. /**
  222. * Notification sent before reading the default user preferences files.
  223. */
  224. #define NS_PREFSERVICE_READ_TOPIC_ID "prefservice:before-read-userprefs"
  225. /**
  226. * Notification sent when resetPrefs has been called, but before the actual
  227. * reset process occurs.
  228. */
  229. #define NS_PREFSERVICE_RESET_TOPIC_ID "prefservice:before-reset"
  230. #endif /* __gen_nsIPrefService_h__ */