1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
---|
2 | /* ***** BEGIN LICENSE BLOCK *****
|
---|
3 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
---|
4 | *
|
---|
5 | * The contents of this file are subject to the Mozilla Public License Version
|
---|
6 | * 1.1 (the "License"); you may not use this file except in compliance with
|
---|
7 | * the License. You may obtain a copy of the License at
|
---|
8 | * http://www.mozilla.org/MPL/
|
---|
9 | *
|
---|
10 | * Software distributed under the License is distributed on an "AS IS" basis,
|
---|
11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
---|
12 | * for the specific language governing rights and limitations under the
|
---|
13 | * License.
|
---|
14 | *
|
---|
15 | * The Original Code is mozilla.org code.
|
---|
16 | *
|
---|
17 | * The Initial Developer of the Original Code is
|
---|
18 | * Netscape Communications Corporation.
|
---|
19 | * Portions created by the Initial Developer are Copyright (C) 1998
|
---|
20 | * the Initial Developer. All Rights Reserved.
|
---|
21 | *
|
---|
22 | * Contributor(s):
|
---|
23 | *
|
---|
24 | * Alternatively, the contents of this file may be used under the terms of
|
---|
25 | * either of the GNU General Public License Version 2 or later (the "GPL"),
|
---|
26 | * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
---|
27 | * in which case the provisions of the GPL or the LGPL are applicable instead
|
---|
28 | * of those above. If you wish to allow use of your version of this file only
|
---|
29 | * under the terms of either the GPL or the LGPL, and not to allow others to
|
---|
30 | * use your version of this file under the terms of the MPL, indicate your
|
---|
31 | * decision by deleting the provisions above and replace them with the notice
|
---|
32 | * and other provisions required by the GPL or the LGPL. If you do not delete
|
---|
33 | * the provisions above, a recipient may use your version of this file under
|
---|
34 | * the terms of any one of the MPL, the GPL or the LGPL.
|
---|
35 | *
|
---|
36 | * ***** END LICENSE BLOCK ***** */
|
---|
37 |
|
---|
38 | #include "nsISupports.idl"
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * nsIErrorService: This is an interim service that allows nsresult codes to be mapped to
|
---|
42 | * string bundles that can be used to look up error messages. String bundle keys can also
|
---|
43 | * be mapped.
|
---|
44 | *
|
---|
45 | * This service will eventually get replaced by extending xpidl to allow errors to be defined.
|
---|
46 | * (http://bugzilla.mozilla.org/show_bug.cgi?id=13423).
|
---|
47 | */
|
---|
48 | [scriptable, uuid(e72f94b2-5f85-11d4-9877-00c04fa0cf4a)]
|
---|
49 | interface nsIErrorService : nsISupports
|
---|
50 | {
|
---|
51 | /**
|
---|
52 | * Registers a string bundle URL for an error module. Error modules are obtained from
|
---|
53 | * nsresult code with NS_ERROR_GET_MODULE.
|
---|
54 | */
|
---|
55 | void registerErrorStringBundle(in short errorModule, in string stringBundleURL);
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * Registers a string bundle URL for an error module.
|
---|
59 | */
|
---|
60 | void unregisterErrorStringBundle(in short errorModule);
|
---|
61 |
|
---|
62 | /**
|
---|
63 | * Retrieves a string bundle URL for an error module.
|
---|
64 | */
|
---|
65 | string getErrorStringBundle(in short errorModule);
|
---|
66 |
|
---|
67 | /**
|
---|
68 | * Registers a key in a string bundle for an nsresult error code. Only the code portion
|
---|
69 | * of the nsresult is used (obtained with NS_ERROR_GET_CODE) in this registration. The
|
---|
70 | * string bundle key is used to look up internationalized messages in the string bundle.
|
---|
71 | */
|
---|
72 | void registerErrorStringBundleKey(in nsresult error, in string stringBundleKey);
|
---|
73 |
|
---|
74 | /**
|
---|
75 | * Unregisters a key in a string bundle for an nsresult error code.
|
---|
76 | */
|
---|
77 | void unregisterErrorStringBundleKey(in nsresult error);
|
---|
78 |
|
---|
79 | /**
|
---|
80 | * Retrieves a key in a string bundle for an nsresult error code. If no key is registered
|
---|
81 | * for the specified nsresult's code (obtained with NS_ERROR_GET_CODE), then the stringified
|
---|
82 | * version of the nsresult code is returned.
|
---|
83 | */
|
---|
84 | string getErrorStringBundleKey(in nsresult error);
|
---|
85 | };
|
---|
86 |
|
---|
87 | %{C++
|
---|
88 |
|
---|
89 | // The global nsIErrorService:
|
---|
90 | #define NS_ERRORSERVICE_NAME "Error Service"
|
---|
91 | #define NS_ERRORSERVICE_CONTRACTID "@mozilla.org/xpcom/error-service;1"
|
---|
92 | #define NS_ERRORSERVICE_CID \
|
---|
93 | { /* 744afd5e-5f8c-11d4-9877-00c04fa0cf4a */ \
|
---|
94 | 0x744afd5e, \
|
---|
95 | 0x5f8c, \
|
---|
96 | 0x11d4, \
|
---|
97 | {0x98, 0x77, 0x00, 0xc0, 0x4f, 0xa0, 0xcf, 0x4a} \
|
---|
98 | }
|
---|
99 |
|
---|
100 | %}
|
---|