michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsPKIParamBlock.h" michael@0: #include "nsIServiceManager.h" michael@0: #include "nsIDialogParamBlock.h" michael@0: #include "nsIMutableArray.h" michael@0: michael@0: NS_IMPL_ISUPPORTS(nsPKIParamBlock, nsIPKIParamBlock, nsIDialogParamBlock) michael@0: michael@0: nsPKIParamBlock::nsPKIParamBlock() michael@0: { michael@0: } michael@0: michael@0: nsresult michael@0: nsPKIParamBlock::Init() michael@0: { michael@0: mDialogParamBlock = do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID); michael@0: return !mDialogParamBlock ? NS_ERROR_OUT_OF_MEMORY : NS_OK; michael@0: } michael@0: michael@0: nsPKIParamBlock::~nsPKIParamBlock() michael@0: { michael@0: } michael@0: michael@0: michael@0: NS_IMETHODIMP michael@0: nsPKIParamBlock::SetNumberStrings( int32_t inNumStrings ) michael@0: { michael@0: return mDialogParamBlock->SetNumberStrings(inNumStrings); michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: nsPKIParamBlock::SetInt(int32_t inIndex, int32_t inInt) michael@0: { michael@0: return mDialogParamBlock->SetInt(inIndex, inInt); michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: nsPKIParamBlock::GetInt(int32_t inIndex, int32_t *outInt) michael@0: { michael@0: return mDialogParamBlock->GetInt(inIndex, outInt); michael@0: } michael@0: michael@0: michael@0: NS_IMETHODIMP michael@0: nsPKIParamBlock::GetString(int32_t inIndex, char16_t **_retval) michael@0: { michael@0: return mDialogParamBlock->GetString(inIndex, _retval); michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: nsPKIParamBlock::SetString(int32_t inIndex, const char16_t *inString) michael@0: { michael@0: return mDialogParamBlock->SetString(inIndex, inString); michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: nsPKIParamBlock::GetObjects(nsIMutableArray * *aObjects) michael@0: { michael@0: return mDialogParamBlock->GetObjects(aObjects); michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: nsPKIParamBlock::SetObjects(nsIMutableArray * aObjects) michael@0: { michael@0: return mDialogParamBlock->SetObjects(aObjects); michael@0: } michael@0: michael@0: michael@0: michael@0: /* void setISupportAtIndex (in int32_t index, in nsISupports object); */ michael@0: NS_IMETHODIMP michael@0: nsPKIParamBlock::SetISupportAtIndex(int32_t index, nsISupports *object) michael@0: { michael@0: if (!mSupports) { michael@0: mSupports = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID); michael@0: if (!mSupports) { michael@0: return NS_ERROR_OUT_OF_MEMORY; michael@0: } michael@0: } michael@0: // Ignore any InsertElementAt error, because this function always did that michael@0: mSupports->InsertElementAt(object, index-1); michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* nsISupports getISupportAtIndex (in int32_t index); */ michael@0: NS_IMETHODIMP michael@0: nsPKIParamBlock::GetISupportAtIndex(int32_t index, nsISupports **_retval) michael@0: { michael@0: NS_ENSURE_ARG(_retval); michael@0: michael@0: return mSupports->GetElementAt(index - 1, _retval); michael@0: } michael@0: michael@0: