Back to index

lightning-sunbird  0.9+nobinonly
nsPKIParamBlock.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is mozilla.org code.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications Corporation.
00020  * Portions created by the Initial Developer are Copyright (C) 1998
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *   Javier Delgadillo <javi@netscape.com>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either the GNU General Public License Version 2 or later (the "GPL"), or
00028  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 #include "nsPKIParamBlock.h"
00041 #include "nsIServiceManager.h"
00042 #include "nsIDialogParamBlock.h"
00043 #include "nsIArray.h"
00044 
00045 NS_IMPL_THREADSAFE_ISUPPORTS2(nsPKIParamBlock, nsIPKIParamBlock,
00046                                                nsIDialogParamBlock)
00047 
00048 nsPKIParamBlock::nsPKIParamBlock()
00049 {
00050 }
00051 
00052 nsresult
00053 nsPKIParamBlock::Init()
00054 {
00055   mDialogParamBlock = do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID);
00056   return (mDialogParamBlock == nsnull) ? NS_ERROR_OUT_OF_MEMORY : NS_OK;
00057 }
00058 
00059 nsPKIParamBlock::~nsPKIParamBlock()
00060 {
00061 }
00062 
00063 
00064 NS_IMETHODIMP 
00065 nsPKIParamBlock::SetNumberStrings( PRInt32 inNumStrings )
00066 {
00067   return mDialogParamBlock->SetNumberStrings(inNumStrings);
00068 }
00069 
00070 NS_IMETHODIMP 
00071 nsPKIParamBlock::SetInt(PRInt32 inIndex, PRInt32 inInt)
00072 {
00073   return mDialogParamBlock->SetInt(inIndex, inInt);
00074 }
00075 
00076 NS_IMETHODIMP 
00077 nsPKIParamBlock::GetInt(PRInt32 inIndex, PRInt32 *outInt)
00078 {
00079   return mDialogParamBlock->GetInt(inIndex, outInt);
00080 }
00081 
00082 
00083 NS_IMETHODIMP 
00084 nsPKIParamBlock::GetString(PRInt32 inIndex, PRUnichar **_retval)
00085 {
00086   return mDialogParamBlock->GetString(inIndex, _retval);
00087 }
00088 
00089 NS_IMETHODIMP 
00090 nsPKIParamBlock::SetString(PRInt32 inIndex, const PRUnichar *inString)
00091 {
00092   return mDialogParamBlock->SetString(inIndex, inString);
00093 }
00094 
00095 NS_IMETHODIMP
00096 nsPKIParamBlock::GetObjects(nsIMutableArray * *aObjects)
00097 {
00098   return mDialogParamBlock->GetObjects(aObjects);
00099 }
00100 
00101 NS_IMETHODIMP
00102 nsPKIParamBlock::SetObjects(nsIMutableArray * aObjects)
00103 {
00104   return mDialogParamBlock->SetObjects(aObjects);
00105 }
00106 
00107 
00108 
00109 /* void setISupportAtIndex (in PRInt32 index, in nsISupports object); */
00110 NS_IMETHODIMP 
00111 nsPKIParamBlock::SetISupportAtIndex(PRInt32 index, nsISupports *object)
00112 {
00113   if (!mSupports) {
00114     mSupports = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
00115     if (mSupports == nsnull) {
00116       return NS_ERROR_OUT_OF_MEMORY;
00117     }
00118   }
00119   return mSupports->InsertElementAt(object, index-1);
00120 }
00121 
00122 /* nsISupports getISupportAtIndex (in PRInt32 index); */
00123 NS_IMETHODIMP 
00124 nsPKIParamBlock::GetISupportAtIndex(PRInt32 index, nsISupports **_retval)
00125 {
00126   NS_ENSURE_ARG(_retval);
00127 
00128   *_retval = mSupports->ElementAt(index-1);
00129   return NS_OK;
00130 }
00131 
00132