1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 : *
3 : * ***** BEGIN LICENSE BLOCK *****
4 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 : *
6 : * The contents of this file are subject to the Mozilla Public License Version
7 : * 1.1 (the "License"); you may not use this file except in compliance with
8 : * the License. You may obtain a copy of the License at
9 : * http://www.mozilla.org/MPL/
10 : *
11 : * Software distributed under the License is distributed on an "AS IS" basis,
12 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 : * for the specific language governing rights and limitations under the
14 : * License.
15 : *
16 : * The Original Code is mozilla.org code.
17 : *
18 : * The Initial Developer of the Original Code is
19 : * Netscape Communications Corporation.
20 : * Portions created by the Initial Developer are Copyright (C) 1998
21 : * the Initial Developer. All Rights Reserved.
22 : *
23 : * Contributor(s):
24 : * Javier Delgadillo <javi@netscape.com>
25 : *
26 : * Alternatively, the contents of this file may be used under the terms of
27 : * either the GNU General Public License Version 2 or later (the "GPL"), or
28 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 : * in which case the provisions of the GPL or the LGPL are applicable instead
30 : * of those above. If you wish to allow use of your version of this file only
31 : * under the terms of either the GPL or the LGPL, and not to allow others to
32 : * use your version of this file under the terms of the MPL, indicate your
33 : * decision by deleting the provisions above and replace them with the notice
34 : * and other provisions required by the GPL or the LGPL. If you do not delete
35 : * the provisions above, a recipient may use your version of this file under
36 : * the terms of any one of the MPL, the GPL or the LGPL.
37 : *
38 : * ***** END LICENSE BLOCK ***** */
39 :
40 : #include "nsPKIParamBlock.h"
41 : #include "nsIServiceManager.h"
42 : #include "nsIDialogParamBlock.h"
43 : #include "nsIMutableArray.h"
44 :
45 0 : NS_IMPL_THREADSAFE_ISUPPORTS2(nsPKIParamBlock, nsIPKIParamBlock,
46 : nsIDialogParamBlock)
47 :
48 0 : nsPKIParamBlock::nsPKIParamBlock()
49 : {
50 0 : }
51 :
52 : nsresult
53 0 : nsPKIParamBlock::Init()
54 : {
55 0 : mDialogParamBlock = do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID);
56 0 : return (mDialogParamBlock == nsnull) ? NS_ERROR_OUT_OF_MEMORY : NS_OK;
57 : }
58 :
59 0 : nsPKIParamBlock::~nsPKIParamBlock()
60 : {
61 0 : }
62 :
63 :
64 : NS_IMETHODIMP
65 0 : nsPKIParamBlock::SetNumberStrings( PRInt32 inNumStrings )
66 : {
67 0 : return mDialogParamBlock->SetNumberStrings(inNumStrings);
68 : }
69 :
70 : NS_IMETHODIMP
71 0 : nsPKIParamBlock::SetInt(PRInt32 inIndex, PRInt32 inInt)
72 : {
73 0 : return mDialogParamBlock->SetInt(inIndex, inInt);
74 : }
75 :
76 : NS_IMETHODIMP
77 0 : nsPKIParamBlock::GetInt(PRInt32 inIndex, PRInt32 *outInt)
78 : {
79 0 : return mDialogParamBlock->GetInt(inIndex, outInt);
80 : }
81 :
82 :
83 : NS_IMETHODIMP
84 0 : nsPKIParamBlock::GetString(PRInt32 inIndex, PRUnichar **_retval)
85 : {
86 0 : return mDialogParamBlock->GetString(inIndex, _retval);
87 : }
88 :
89 : NS_IMETHODIMP
90 0 : nsPKIParamBlock::SetString(PRInt32 inIndex, const PRUnichar *inString)
91 : {
92 0 : return mDialogParamBlock->SetString(inIndex, inString);
93 : }
94 :
95 : NS_IMETHODIMP
96 0 : nsPKIParamBlock::GetObjects(nsIMutableArray * *aObjects)
97 : {
98 0 : return mDialogParamBlock->GetObjects(aObjects);
99 : }
100 :
101 : NS_IMETHODIMP
102 0 : nsPKIParamBlock::SetObjects(nsIMutableArray * aObjects)
103 : {
104 0 : return mDialogParamBlock->SetObjects(aObjects);
105 : }
106 :
107 :
108 :
109 : /* void setISupportAtIndex (in PRInt32 index, in nsISupports object); */
110 : NS_IMETHODIMP
111 0 : nsPKIParamBlock::SetISupportAtIndex(PRInt32 index, nsISupports *object)
112 : {
113 0 : if (!mSupports) {
114 0 : mSupports = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
115 0 : if (mSupports == nsnull) {
116 0 : return NS_ERROR_OUT_OF_MEMORY;
117 : }
118 : }
119 0 : return mSupports->InsertElementAt(object, index-1);
120 : }
121 :
122 : /* nsISupports getISupportAtIndex (in PRInt32 index); */
123 : NS_IMETHODIMP
124 0 : nsPKIParamBlock::GetISupportAtIndex(PRInt32 index, nsISupports **_retval)
125 : {
126 0 : NS_ENSURE_ARG(_retval);
127 :
128 0 : *_retval = mSupports->ElementAt(index-1);
129 0 : return NS_OK;
130 : }
131 :
132 :
|