xpcom/base/nsIUUIDGenerator.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xpcom/base/nsIUUIDGenerator.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,39 @@
     1.4 +/* -*- Mode: C++; tab-width: 50; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsISupports.idl"
    1.10 +
    1.11 +[ptr] native nsNonConstIDPtr(nsID);
    1.12 +
    1.13 +/**
    1.14 + * nsIUUIDGenerator is implemented by a service that can generate
    1.15 + * universally unique identifiers, ideally using any platform-native
    1.16 + * method for generating UUIDs.
    1.17 + */
    1.18 +[scriptable, uuid(138ad1b2-c694-41cc-b201-333ce936d8b8)]
    1.19 +interface nsIUUIDGenerator : nsISupports
    1.20 +{
    1.21 +  /**
    1.22 +   * Obtains a new UUID using appropriate platform-specific methods to
    1.23 +   * obtain a nsID that can be considered to be globally unique.
    1.24 +   *
    1.25 +   * @returns an nsID filled in with a new UUID.
    1.26 +   *
    1.27 +   * @throws NS_ERROR_FAILURE if a UUID cannot be generated (e.g. if
    1.28 +   * an underlying source of randomness is not available)
    1.29 +   */
    1.30 +  nsIDPtr generateUUID();
    1.31 +
    1.32 +  /**
    1.33 +   * Obtain a new UUID like the generateUUID method, but place it in
    1.34 +   * the provided nsID pointer instead of allocating a new nsID.
    1.35 +   *
    1.36 +   * @param id an existing nsID pointer where the UUID will be stored.
    1.37 +   *
    1.38 +   * @throws NS_ERROR_FAILURE if a UUID cannot be generated (e.g. if
    1.39 +   * an underlying source of randomness is not available)
    1.40 +   */
    1.41 +  [noscript] void generateUUIDInPlace(in nsNonConstIDPtr id);
    1.42 +};

mercurial