1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840
// // DO NOT EDIT. THIS FILE IS GENERATED FROM ../../../dist/idl/nsIPrefBranch.idl // /// `interface nsIPrefBranch : nsISupports` /// /// ```text /// /** /// * The nsIPrefBranch interface is used to manipulate the preferences data. This /// * object may be obtained from the preferences service (nsIPrefService) and /// * used to get and set default and/or user preferences across the application. /// * /// * This object is created with a "root" value which describes the base point in /// * the preferences "tree" from which this "branch" stems. Preferences are /// * accessed off of this root by using just the final portion of the preference. /// * For example, if this object is created with the root "browser.startup.", /// * the preferences "browser.startup.page", "browser.startup.homepage", /// * and "browser.startup.homepage_override" can be accessed by simply passing /// * "page", "homepage", or "homepage_override" to the various Get/Set methods. /// * /// * @see nsIPrefService /// */ /// ``` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct nsIPrefBranch { vtable: *const nsIPrefBranchVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for nsIPrefBranch. unsafe impl XpCom for nsIPrefBranch { const IID: nsIID = nsID(0x55d25e49, 0x793f, 0x4727, [0xa6, 0x9f, 0xde, 0x8b, 0x15, 0xf4, 0xb9, 0x85]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for nsIPrefBranch { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from nsIPrefBranch. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait nsIPrefBranchCoerce { /// Cheaply cast a value of this type from a `nsIPrefBranch`. fn coerce_from(v: &nsIPrefBranch) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl nsIPrefBranchCoerce for nsIPrefBranch { #[inline] fn coerce_from(v: &nsIPrefBranch) -> &Self { v } } impl nsIPrefBranch { /// Cast this `nsIPrefBranch` to one of its base interfaces. #[inline] pub fn coerce<T: nsIPrefBranchCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for nsIPrefBranch { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> nsIPrefBranchCoerce for T { #[inline] fn coerce_from(v: &nsIPrefBranch) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every nsIPrefBranch // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct nsIPrefBranchVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* readonly attribute ACString root; */ pub GetRoot: unsafe extern "system" fn (this: *const nsIPrefBranch, aRoot: &mut ::nsstring::nsACString) -> nsresult, /* long getPrefType (in string aPrefName); */ pub GetPrefType: unsafe extern "system" fn (this: *const nsIPrefBranch, aPrefName: *const libc::c_char, _retval: *mut libc::int32_t) -> nsresult, /* [binaryname(GetBoolPrefWithDefault),optional_argc] boolean getBoolPref (in string aPrefName, [optional] in boolean aDefaultValue); */ /// Unable to generate binding because `optional_argc is unsupported` pub GetBoolPrefWithDefault: *const ::libc::c_void, /* [binaryname(GetBoolPref),noscript] boolean getBoolPrefXPCOM (in string aPrefName); */ pub GetBoolPref: unsafe extern "system" fn (this: *const nsIPrefBranch, aPrefName: *const libc::c_char, _retval: *mut bool) -> nsresult, /* void setBoolPref (in string aPrefName, in boolean aValue); */ pub SetBoolPref: unsafe extern "system" fn (this: *const nsIPrefBranch, aPrefName: *const libc::c_char, aValue: bool) -> nsresult, /* [binaryname(GetFloatPrefWithDefault),optional_argc] float getFloatPref (in string aPrefName, [optional] in float aDefaultValue); */ /// Unable to generate binding because `optional_argc is unsupported` pub GetFloatPrefWithDefault: *const ::libc::c_void, /* [binaryname(GetFloatPref),noscript] float getFloatPrefXPCOM (in string aPrefName); */ pub GetFloatPref: unsafe extern "system" fn (this: *const nsIPrefBranch, aPrefName: *const libc::c_char, _retval: *mut libc::c_float) -> nsresult, /* [binaryname(GetCharPrefWithDefault),optional_argc] ACString getCharPref (in string aPrefName, [optional] in ACString aDefaultValue); */ /// Unable to generate binding because `optional_argc is unsupported` pub GetCharPrefWithDefault: *const ::libc::c_void, /* [binaryname(GetCharPref),noscript] ACString getCharPrefXPCOM (in string aPrefName); */ pub GetCharPref: unsafe extern "system" fn (this: *const nsIPrefBranch, aPrefName: *const libc::c_char, _retval: &mut ::nsstring::nsACString) -> nsresult, /* void setCharPref (in string aPrefName, in ACString aValue); */ pub SetCharPref: unsafe extern "system" fn (this: *const nsIPrefBranch, aPrefName: *const libc::c_char, aValue: &::nsstring::nsACString) -> nsresult, /* [optional_argc] AUTF8String getStringPref (in string aPrefName, [optional] in AUTF8String aDefaultValue); */ /// Unable to generate binding because `optional_argc is unsupported` pub GetStringPref: *const ::libc::c_void, /* void setStringPref (in string aPrefName, in AUTF8String aValue); */ pub SetStringPref: unsafe extern "system" fn (this: *const nsIPrefBranch, aPrefName: *const libc::c_char, aValue: &::nsstring::nsACString) -> nsresult, /* [binaryname(GetIntPrefWithDefault),optional_argc] long getIntPref (in string aPrefName, [optional] in long aDefaultValue); */ /// Unable to generate binding because `optional_argc is unsupported` pub GetIntPrefWithDefault: *const ::libc::c_void, /* [binaryname(GetIntPref),noscript] long getIntPrefXPCOM (in string aPrefName); */ pub GetIntPref: unsafe extern "system" fn (this: *const nsIPrefBranch, aPrefName: *const libc::c_char, _retval: *mut libc::int32_t) -> nsresult, /* void setIntPref (in string aPrefName, in long aValue); */ pub SetIntPref: unsafe extern "system" fn (this: *const nsIPrefBranch, aPrefName: *const libc::c_char, aValue: libc::int32_t) -> nsresult, /* void getComplexValue (in string aPrefName, in nsIIDRef aType, [iid_is (aType), retval] out nsQIResult aValue); */ pub GetComplexValue: unsafe extern "system" fn (this: *const nsIPrefBranch, aPrefName: *const libc::c_char, aType: &nsIID, aValue: *mut *mut libc::c_void) -> nsresult, /* void setComplexValue (in string aPrefName, in nsIIDRef aType, in nsISupports aValue); */ pub SetComplexValue: unsafe extern "system" fn (this: *const nsIPrefBranch, aPrefName: *const libc::c_char, aType: &nsIID, aValue: *const nsISupports) -> nsresult, /* void clearUserPref (in string aPrefName); */ pub ClearUserPref: unsafe extern "system" fn (this: *const nsIPrefBranch, aPrefName: *const libc::c_char) -> nsresult, /* void lockPref (in string aPrefName); */ pub LockPref: unsafe extern "system" fn (this: *const nsIPrefBranch, aPrefName: *const libc::c_char) -> nsresult, /* boolean prefHasUserValue (in string aPrefName); */ pub PrefHasUserValue: unsafe extern "system" fn (this: *const nsIPrefBranch, aPrefName: *const libc::c_char, _retval: *mut bool) -> nsresult, /* boolean prefIsLocked (in string aPrefName); */ pub PrefIsLocked: unsafe extern "system" fn (this: *const nsIPrefBranch, aPrefName: *const libc::c_char, _retval: *mut bool) -> nsresult, /* void unlockPref (in string aPrefName); */ pub UnlockPref: unsafe extern "system" fn (this: *const nsIPrefBranch, aPrefName: *const libc::c_char) -> nsresult, /* void deleteBranch (in string aStartingAt); */ pub DeleteBranch: unsafe extern "system" fn (this: *const nsIPrefBranch, aStartingAt: *const libc::c_char) -> nsresult, /* void getChildList (in string aStartingAt, [optional] out unsigned long aCount, [array, size_is (aCount), retval] out string aChildArray); */ pub GetChildList: unsafe extern "system" fn (this: *const nsIPrefBranch, aStartingAt: *const libc::c_char, aCount: *mut libc::uint32_t, aChildArray: *mut *mut *const libc::c_char) -> nsresult, /* void resetBranch (in string aStartingAt); */ pub ResetBranch: unsafe extern "system" fn (this: *const nsIPrefBranch, aStartingAt: *const libc::c_char) -> nsresult, /* void addObserver (in string aDomain, in nsIObserver aObserver, [optional] in boolean aHoldWeak); */ pub AddObserver: unsafe extern "system" fn (this: *const nsIPrefBranch, aDomain: *const libc::c_char, aObserver: *const nsIObserver, aHoldWeak: bool) -> nsresult, /* void removeObserver (in string aDomain, in nsIObserver aObserver); */ pub RemoveObserver: unsafe extern "system" fn (this: *const nsIPrefBranch, aDomain: *const libc::c_char, aObserver: *const nsIObserver) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl nsIPrefBranch { /// ```text /// /** /// * Values describing the basic preference types. /// * /// * @see getPrefType /// */ /// ``` /// pub const PREF_INVALID: i64 = 0; pub const PREF_STRING: i64 = 32; pub const PREF_INT: i64 = 64; pub const PREF_BOOL: i64 = 128; /// ```text /// /** /// * Called to get the root on which this branch is based, such as /// * "browser.startup." /// */ /// ``` /// /// `readonly attribute ACString root;` #[inline] pub unsafe fn GetRoot(&self, aRoot: &mut ::nsstring::nsACString) -> nsresult { ((*self.vtable).GetRoot)(self, aRoot) } /// ```text /// /** /// * Called to determine the type of a specific preference. /// * /// * @param aPrefName The preference to get the type of. /// * /// * @return long A value representing the type of the preference. This /// * value will be PREF_STRING, PREF_INT, or PREF_BOOL. /// */ /// ``` /// /// `long getPrefType (in string aPrefName);` #[inline] pub unsafe fn GetPrefType(&self, aPrefName: *const libc::c_char, _retval: *mut libc::int32_t) -> nsresult { ((*self.vtable).GetPrefType)(self, aPrefName, _retval) } /// ```text /// /** /// * Called to get the state of an individual boolean preference. /// * /// * @param aPrefName The boolean preference to get the state of. /// * @param aDefaultValue The value to return if the preference is not set. /// * /// * @return boolean The value of the requested boolean preference. /// * /// * @see setBoolPref /// */ /// ``` /// /// `[binaryname(GetBoolPrefWithDefault),optional_argc] boolean getBoolPref (in string aPrefName, [optional] in boolean aDefaultValue);` const _GetBoolPrefWithDefault: () = (); /// `[binaryname(GetBoolPref),noscript] boolean getBoolPrefXPCOM (in string aPrefName);` #[inline] pub unsafe fn GetBoolPref(&self, aPrefName: *const libc::c_char, _retval: *mut bool) -> nsresult { ((*self.vtable).GetBoolPref)(self, aPrefName, _retval) } /// ```text /// /** /// * Called to set the state of an individual boolean preference. /// * /// * @param aPrefName The boolean preference to set the state of. /// * @param aValue The boolean value to set the preference to. /// * /// * @throws Error if setting failed or the preference has a default /// value of a type other than boolean. /// * /// * @see getBoolPref /// */ /// ``` /// /// `void setBoolPref (in string aPrefName, in boolean aValue);` #[inline] pub unsafe fn SetBoolPref(&self, aPrefName: *const libc::c_char, aValue: bool) -> nsresult { ((*self.vtable).SetBoolPref)(self, aPrefName, aValue) } /// ```text /// /** /// * Called to get the state of an individual floating-point preference. /// * "Floating point" preferences are really string preferences that /// * are converted to floating point numbers. /// * /// * @param aPrefName The floating point preference to get the state of. /// * @param aDefaultValue The value to return if the preference is not set. /// * /// * @return float The value of the requested floating point preference. /// * /// * @see setCharPref /// */ /// ``` /// /// `[binaryname(GetFloatPrefWithDefault),optional_argc] float getFloatPref (in string aPrefName, [optional] in float aDefaultValue);` const _GetFloatPrefWithDefault: () = (); /// `[binaryname(GetFloatPref),noscript] float getFloatPrefXPCOM (in string aPrefName);` #[inline] pub unsafe fn GetFloatPref(&self, aPrefName: *const libc::c_char, _retval: *mut libc::c_float) -> nsresult { ((*self.vtable).GetFloatPref)(self, aPrefName, _retval) } /// ```text /// /** /// * Called to get the state of an individual ascii string preference. /// * /// * @param aPrefName The string preference to retrieve. /// * @param aDefaultValue The string to return if the preference is not set. /// * /// * @return ACString The value of the requested string preference. /// * /// * @see setCharPref /// */ /// ``` /// /// `[binaryname(GetCharPrefWithDefault),optional_argc] ACString getCharPref (in string aPrefName, [optional] in ACString aDefaultValue);` const _GetCharPrefWithDefault: () = (); /// `[binaryname(GetCharPref),noscript] ACString getCharPrefXPCOM (in string aPrefName);` #[inline] pub unsafe fn GetCharPref(&self, aPrefName: *const libc::c_char, _retval: &mut ::nsstring::nsACString) -> nsresult { ((*self.vtable).GetCharPref)(self, aPrefName, _retval) } /// ```text /// /** /// * Called to set the state of an individual ascii string preference. /// * /// * @param aPrefName The string preference to set. /// * @param aValue The string value to set the preference to. /// * /// * @throws Error if setting failed or the preference has a default /// value of a type other than string. /// * /// * @see getCharPref /// */ /// ``` /// /// `void setCharPref (in string aPrefName, in ACString aValue);` #[inline] pub unsafe fn SetCharPref(&self, aPrefName: *const libc::c_char, aValue: &::nsstring::nsACString) -> nsresult { ((*self.vtable).SetCharPref)(self, aPrefName, aValue) } /// ```text /// /** /// * Called to get the state of an individual unicode string preference. /// * /// * @param aPrefName The string preference to retrieve. /// * @param aDefaultValue The string to return if the preference is not set. /// * /// * @return AUTF8String The value of the requested string preference. /// * /// * @see setStringPref /// */ /// ``` /// /// `[optional_argc] AUTF8String getStringPref (in string aPrefName, [optional] in AUTF8String aDefaultValue);` const _GetStringPref: () = (); /// ```text /// /** /// * Called to set the state of an individual unicode string preference. /// * /// * @param aPrefName The string preference to set. /// * @param aValue The string value to set the preference to. /// * /// * @throws Error if setting failed or the preference has a default /// value of a type other than string. /// * /// * @see getStringPref /// */ /// ``` /// /// `void setStringPref (in string aPrefName, in AUTF8String aValue);` #[inline] pub unsafe fn SetStringPref(&self, aPrefName: *const libc::c_char, aValue: &::nsstring::nsACString) -> nsresult { ((*self.vtable).SetStringPref)(self, aPrefName, aValue) } /// ```text /// /** /// * Called to get the state of an individual integer preference. /// * /// * @param aPrefName The integer preference to get the value of. /// * @param aDefaultValue The value to return if the preference is not set. /// * /// * @return long The value of the requested integer preference. /// * /// * @see setIntPref /// */ /// ``` /// /// `[binaryname(GetIntPrefWithDefault),optional_argc] long getIntPref (in string aPrefName, [optional] in long aDefaultValue);` const _GetIntPrefWithDefault: () = (); /// `[binaryname(GetIntPref),noscript] long getIntPrefXPCOM (in string aPrefName);` #[inline] pub unsafe fn GetIntPref(&self, aPrefName: *const libc::c_char, _retval: *mut libc::int32_t) -> nsresult { ((*self.vtable).GetIntPref)(self, aPrefName, _retval) } /// ```text /// /** /// * Called to set the state of an individual integer preference. /// * /// * @param aPrefName The integer preference to set the value of. /// * @param aValue The integer value to set the preference to. /// * /// * @throws Error if setting failed or the preference has a default /// value of a type other than integer. /// * /// * @see getIntPref /// */ /// ``` /// /// `void setIntPref (in string aPrefName, in long aValue);` #[inline] pub unsafe fn SetIntPref(&self, aPrefName: *const libc::c_char, aValue: libc::int32_t) -> nsresult { ((*self.vtable).SetIntPref)(self, aPrefName, aValue) } /// ```text /// /** /// * Called to get the state of an individual complex preference. A complex /// * preference is a preference which represents an XPCOM object that can not /// * be easily represented using a standard boolean, integer or string value. /// * /// * @param aPrefName The complex preference to get the value of. /// * @param aType The XPCOM interface that this complex preference /// * represents. Interfaces currently supported are: /// * - nsIFile /// * - nsIPrefLocalizedString (Localized UniChar) /// * @param aValue The XPCOM object into which to the complex preference /// * value should be retrieved. /// * /// * @throws Error The value does not exist or is the wrong type. /// * /// * @see setComplexValue /// */ /// ``` /// /// `void getComplexValue (in string aPrefName, in nsIIDRef aType, [iid_is (aType), retval] out nsQIResult aValue);` #[inline] pub unsafe fn GetComplexValue(&self, aPrefName: *const libc::c_char, aType: &nsIID, aValue: *mut *mut libc::c_void) -> nsresult { ((*self.vtable).GetComplexValue)(self, aPrefName, aType, aValue) } /// ```text /// /** /// * Called to set the state of an individual complex preference. A complex /// * preference is a preference which represents an XPCOM object that can not /// * be easily represented using a standard boolean, integer or string value. /// * /// * @param aPrefName The complex preference to set the value of. /// * @param aType The XPCOM interface that this complex preference /// * represents. Interfaces currently supported are: /// * - nsIFile /// * - nsISupportsString (UniChar) /// * (deprecated; see setStringPref) /// * - nsIPrefLocalizedString (Localized UniChar) /// * @param aValue The XPCOM object from which to set the complex preference /// * value. /// * /// * @throws Error if setting failed or the value is the wrong type. /// * /// * @see getComplexValue /// */ /// ``` /// /// `void setComplexValue (in string aPrefName, in nsIIDRef aType, in nsISupports aValue);` #[inline] pub unsafe fn SetComplexValue(&self, aPrefName: *const libc::c_char, aType: &nsIID, aValue: *const nsISupports) -> nsresult { ((*self.vtable).SetComplexValue)(self, aPrefName, aType, aValue) } /// ```text /// /** /// * Called to clear a user set value from a specific preference. This will, in /// * effect, reset the value to the default value. If no default value exists /// * the preference will cease to exist. /// * /// * @param aPrefName The preference to be cleared. /// * /// * @note /// * This method does nothing if this object is a default branch. /// */ /// ``` /// /// `void clearUserPref (in string aPrefName);` #[inline] pub unsafe fn ClearUserPref(&self, aPrefName: *const libc::c_char) -> nsresult { ((*self.vtable).ClearUserPref)(self, aPrefName) } /// ```text /// /** /// * Called to lock a specific preference. Locking a preference will cause the /// * preference service to always return the default value regardless of /// * whether there is a user set value or not. /// * /// * @param aPrefName The preference to be locked. /// * /// * @note /// * This method can be called on either a default or user branch but, in /// * effect, always operates on the default branch. /// * /// * @throws Error The preference does not exist or an error occurred. /// * /// * @see unlockPref /// */ /// ``` /// /// `void lockPref (in string aPrefName);` #[inline] pub unsafe fn LockPref(&self, aPrefName: *const libc::c_char) -> nsresult { ((*self.vtable).LockPref)(self, aPrefName) } /// ```text /// /** /// * Called to check if a specific preference has a user value associated to /// * it. /// * /// * @param aPrefName The preference to be tested. /// * /// * @note /// * This method can be called on either a default or user branch but, in /// * effect, always operates on the user branch. /// * /// * @note /// * If a preference was manually set to a value that equals the default value, /// * then the preference no longer has a user set value, i.e. it is /// * considered reset to its default value. /// * In particular, this method will return false for such a preference and /// * the preference will not be saved to a file by nsIPrefService.savePrefFile. /// * /// * @return boolean true The preference has a user set value. /// * false The preference only has a default value. /// */ /// ``` /// /// `boolean prefHasUserValue (in string aPrefName);` #[inline] pub unsafe fn PrefHasUserValue(&self, aPrefName: *const libc::c_char, _retval: *mut bool) -> nsresult { ((*self.vtable).PrefHasUserValue)(self, aPrefName, _retval) } /// ```text /// /** /// * Called to check if a specific preference is locked. If a preference is /// * locked calling its Get method will always return the default value. /// * /// * @param aPrefName The preference to be tested. /// * /// * @note /// * This method can be called on either a default or user branch but, in /// * effect, always operates on the default branch. /// * /// * @return boolean true The preference is locked. /// * false The preference is not locked. /// * /// * @see lockPref /// * @see unlockPref /// */ /// ``` /// /// `boolean prefIsLocked (in string aPrefName);` #[inline] pub unsafe fn PrefIsLocked(&self, aPrefName: *const libc::c_char, _retval: *mut bool) -> nsresult { ((*self.vtable).PrefIsLocked)(self, aPrefName, _retval) } /// ```text /// /** /// * Called to unlock a specific preference. Unlocking a previously locked /// * preference allows the preference service to once again return the user set /// * value of the preference. /// * /// * @param aPrefName The preference to be unlocked. /// * /// * @note /// * This method can be called on either a default or user branch but, in /// * effect, always operates on the default branch. /// * /// * @throws Error The preference does not exist or an error occurred. /// * /// * @see lockPref /// */ /// ``` /// /// `void unlockPref (in string aPrefName);` #[inline] pub unsafe fn UnlockPref(&self, aPrefName: *const libc::c_char) -> nsresult { ((*self.vtable).UnlockPref)(self, aPrefName) } /// ```text /// /** /// * Called to remove all of the preferences referenced by this branch. /// * /// * @param aStartingAt The point on the branch at which to start the deleting /// * preferences. Pass in "" to remove all preferences /// * referenced by this branch. /// * /// * @note /// * This method can be called on either a default or user branch but, in /// * effect, always operates on both. /// * /// * @throws Error The preference(s) do not exist or an error occurred. /// */ /// ``` /// /// `void deleteBranch (in string aStartingAt);` #[inline] pub unsafe fn DeleteBranch(&self, aStartingAt: *const libc::c_char) -> nsresult { ((*self.vtable).DeleteBranch)(self, aStartingAt) } /// ```text /// /** /// * Returns an array of strings representing the child preferences of the /// * root of this branch. /// * /// * @param aStartingAt The point on the branch at which to start enumerating /// * the child preferences. Pass in "" to enumerate all /// * preferences referenced by this branch. /// * @param aCount Receives the number of elements in the array. /// * @param aChildArray Receives the array of child preferences. /// * /// * @note /// * This method can be called on either a default or user branch but, in /// * effect, always operates on both. /// * /// * @throws Error The preference(s) do not exist or an error occurred. /// */ /// ``` /// /// `void getChildList (in string aStartingAt, [optional] out unsigned long aCount, [array, size_is (aCount), retval] out string aChildArray);` #[inline] pub unsafe fn GetChildList(&self, aStartingAt: *const libc::c_char, aCount: *mut libc::uint32_t, aChildArray: *mut *mut *const libc::c_char) -> nsresult { ((*self.vtable).GetChildList)(self, aStartingAt, aCount, aChildArray) } /// ```text /// /** /// * Called to reset all of the preferences referenced by this branch to their /// * default values. /// * /// * @param aStartingAt The point on the branch at which to start the resetting /// * preferences to their default values. Pass in "" to /// * reset all preferences referenced by this branch. /// * /// * @note /// * This method can be called on either a default or user branch but, in /// * effect, always operates on the user branch. /// * /// * @throws Error The preference(s) do not exist or an error occurred. /// */ /// ``` /// /// `void resetBranch (in string aStartingAt);` #[inline] pub unsafe fn ResetBranch(&self, aStartingAt: *const libc::c_char) -> nsresult { ((*self.vtable).ResetBranch)(self, aStartingAt) } /// ```text /// /** /// * Add a preference change observer. On preference changes, the following /// * arguments will be passed to the nsIObserver.observe() method: /// * aSubject - The nsIPrefBranch object (this) /// * aTopic - The string defined by NS_PREFBRANCH_PREFCHANGE_TOPIC_ID /// * aData - The name of the preference which has changed, relative to /// * the |root| of the aSubject branch. /// * /// * aSubject.get*Pref(aData) will get the new value of the modified /// * preference. For example, if your observer is registered with /// * addObserver("bar.", ...) on a branch with root "foo.", modifying /// * the preference "foo.bar.baz" will trigger the observer, and aData /// * parameter will be "bar.baz". /// * /// * @param aDomain The preference on which to listen for changes. This can /// * be the name of an entire branch to observe. /// * e.g. Holding the "root" prefbranch and calling /// * addObserver("foo.bar.", ...) will observe changes to /// * foo.bar.baz and foo.bar.bzip /// * @param aObserver The object to be notified if the preference changes. /// * @param aHoldWeak true Hold a weak reference to |aObserver|. The object /// * must implement the nsISupportsWeakReference /// * interface or this will fail. /// * false Hold a strong reference to |aObserver|. /// * /// * @note /// * Registering as a preference observer can open an object to potential /// * cyclical references which will cause memory leaks. These cycles generally /// * occur because an object both registers itself as an observer (causing the /// * branch to hold a reference to the observer) and holds a reference to the /// * branch object for the purpose of getting/setting preference values. There /// * are 3 approaches which have been implemented in an attempt to avoid these /// * situations. /// * 1) The nsPrefBranch object supports nsISupportsWeakReference. Any consumer /// * may hold a weak reference to it instead of a strong one. /// * 2) The nsPrefBranch object listens for xpcom-shutdown and frees all of the /// * objects currently in its observer list. This ensures that long lived /// * objects (services for example) will be freed correctly. /// * 3) The observer can request to be held as a weak reference when it is /// * registered. This insures that shorter lived objects (say one tied to an /// * open window) will not fall into the cyclical reference trap. /// * /// * @note /// * The list of registered observers may be changed during the dispatch of /// * nsPref:changed notification. However, the observers are not guaranteed /// * to be notified in any particular order, so you can't be sure whether the /// * added/removed observer will be called during the notification when it /// * is added/removed. /// * /// * @note /// * It is possible to change preferences during the notification. /// * /// * @note /// * It is not safe to change observers during this callback in Gecko /// * releases before 1.9. If you want a safe way to remove a pref observer, /// * please use an nsITimer. /// * /// * @see nsIObserver /// * @see removeObserver /// */ /// ``` /// /// `void addObserver (in string aDomain, in nsIObserver aObserver, [optional] in boolean aHoldWeak);` #[inline] pub unsafe fn AddObserver(&self, aDomain: *const libc::c_char, aObserver: *const nsIObserver, aHoldWeak: bool) -> nsresult { ((*self.vtable).AddObserver)(self, aDomain, aObserver, aHoldWeak) } /// ```text /// /** /// * Remove a preference change observer. /// * /// * @param aDomain The preference which is being observed for changes. /// * @param aObserver An observer previously registered with addObserver(). /// * /// * @note /// * Note that you must call removeObserver() on the same nsIPrefBranch /// * instance on which you called addObserver() in order to remove aObserver; /// * otherwise, the observer will not be removed. /// * /// * @see nsIObserver /// * @see addObserver /// */ /// ``` /// /// `void removeObserver (in string aDomain, in nsIObserver aObserver);` #[inline] pub unsafe fn RemoveObserver(&self, aDomain: *const libc::c_char, aObserver: *const nsIObserver) -> nsresult { ((*self.vtable).RemoveObserver)(self, aDomain, aObserver) } }