modules/libpref/public/nsIRelativeFilePref.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #include "nsISupports.idl"
     7 interface nsIFile;
     9 /**
    10  * The nsIRelativeFilePref interface is a wrapper for an nsIFile and
    11  * and a directory service key. When used as a pref value, it stores a
    12  * relative path to the file from the location pointed to by the directory
    13  * service key. The path has the same syntax across all platforms.
    14  *
    15  * @see nsIPrefBranch::getComplexValue
    16  * @see nsIPrefBranch::setComplexValue
    17  * 
    18  */
    20 [scriptable, uuid(2f977d4e-5485-11d4-87e2-0010a4e75ef2)]
    21 interface nsIRelativeFilePref : nsISupports
    22 {
    23   /**
    24    * file
    25    *
    26    * The file whose location is stored or retrieved.
    27    */
    28   attribute nsIFile file;
    30   /**
    31    * relativeToKey
    32    *
    33    * A directory service key for the directory
    34    * from which the file path is relative.
    35    */
    36   attribute ACString relativeToKey;
    38 };
    40 %{C++
    42 #define NS_RELATIVEFILEPREF_CID                        \
    43   { /* {2f977d4f-5485-11d4-87e2-0010a4e75ef2} */       \
    44     0x2f977d4f,                                        \
    45     0x5485,                                            \
    46     0x11d4,                                            \
    47     { 0x87, 0xe2, 0x00, 0x10, 0xa4, 0xe7, 0x5e, 0xf2 } \
    48   }
    50 #define NS_RELATIVEFILEPREF_CONTRACTID "@mozilla.org/pref-relativefile;1"
    52 #include "nsComponentManagerUtils.h"
    54 inline nsresult
    55 NS_NewRelativeFilePref(nsIFile* aFile, const nsACString& relativeToKey, nsIRelativeFilePref** result)
    56 {
    57     nsresult rv;
    58     nsCOMPtr<nsIRelativeFilePref> local(do_CreateInstance(NS_RELATIVEFILEPREF_CONTRACTID, &rv));
    59     if (NS_FAILED(rv)) return rv;
    61     (void)local->SetFile(aFile);
    62     (void)local->SetRelativeToKey(relativeToKey);
    64     *result = local;
    65     NS_ADDREF(*result);
    66     return NS_OK;
    67 }
    69 %}

mercurial