security/manager/pki/src/nsPKIParamBlock.cpp

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:fda44f17c88d
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 #include "nsPKIParamBlock.h"
8 #include "nsIServiceManager.h"
9 #include "nsIDialogParamBlock.h"
10 #include "nsIMutableArray.h"
11
12 NS_IMPL_ISUPPORTS(nsPKIParamBlock, nsIPKIParamBlock, nsIDialogParamBlock)
13
14 nsPKIParamBlock::nsPKIParamBlock()
15 {
16 }
17
18 nsresult
19 nsPKIParamBlock::Init()
20 {
21 mDialogParamBlock = do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID);
22 return !mDialogParamBlock ? NS_ERROR_OUT_OF_MEMORY : NS_OK;
23 }
24
25 nsPKIParamBlock::~nsPKIParamBlock()
26 {
27 }
28
29
30 NS_IMETHODIMP
31 nsPKIParamBlock::SetNumberStrings( int32_t inNumStrings )
32 {
33 return mDialogParamBlock->SetNumberStrings(inNumStrings);
34 }
35
36 NS_IMETHODIMP
37 nsPKIParamBlock::SetInt(int32_t inIndex, int32_t inInt)
38 {
39 return mDialogParamBlock->SetInt(inIndex, inInt);
40 }
41
42 NS_IMETHODIMP
43 nsPKIParamBlock::GetInt(int32_t inIndex, int32_t *outInt)
44 {
45 return mDialogParamBlock->GetInt(inIndex, outInt);
46 }
47
48
49 NS_IMETHODIMP
50 nsPKIParamBlock::GetString(int32_t inIndex, char16_t **_retval)
51 {
52 return mDialogParamBlock->GetString(inIndex, _retval);
53 }
54
55 NS_IMETHODIMP
56 nsPKIParamBlock::SetString(int32_t inIndex, const char16_t *inString)
57 {
58 return mDialogParamBlock->SetString(inIndex, inString);
59 }
60
61 NS_IMETHODIMP
62 nsPKIParamBlock::GetObjects(nsIMutableArray * *aObjects)
63 {
64 return mDialogParamBlock->GetObjects(aObjects);
65 }
66
67 NS_IMETHODIMP
68 nsPKIParamBlock::SetObjects(nsIMutableArray * aObjects)
69 {
70 return mDialogParamBlock->SetObjects(aObjects);
71 }
72
73
74
75 /* void setISupportAtIndex (in int32_t index, in nsISupports object); */
76 NS_IMETHODIMP
77 nsPKIParamBlock::SetISupportAtIndex(int32_t index, nsISupports *object)
78 {
79 if (!mSupports) {
80 mSupports = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
81 if (!mSupports) {
82 return NS_ERROR_OUT_OF_MEMORY;
83 }
84 }
85 // Ignore any InsertElementAt error, because this function always did that
86 mSupports->InsertElementAt(object, index-1);
87 return NS_OK;
88 }
89
90 /* nsISupports getISupportAtIndex (in int32_t index); */
91 NS_IMETHODIMP
92 nsPKIParamBlock::GetISupportAtIndex(int32_t index, nsISupports **_retval)
93 {
94 NS_ENSURE_ARG(_retval);
95
96 return mSupports->GetElementAt(index - 1, _retval);
97 }
98
99

mercurial