security/manager/pki/src/nsPKIParamBlock.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/manager/pki/src/nsPKIParamBlock.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,99 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + *
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#include "nsPKIParamBlock.h"
    1.11 +#include "nsIServiceManager.h"
    1.12 +#include "nsIDialogParamBlock.h"
    1.13 +#include "nsIMutableArray.h"
    1.14 +
    1.15 +NS_IMPL_ISUPPORTS(nsPKIParamBlock, nsIPKIParamBlock, nsIDialogParamBlock)
    1.16 +
    1.17 +nsPKIParamBlock::nsPKIParamBlock()
    1.18 +{
    1.19 +}
    1.20 +
    1.21 +nsresult
    1.22 +nsPKIParamBlock::Init()
    1.23 +{
    1.24 +  mDialogParamBlock = do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID);
    1.25 +  return !mDialogParamBlock ? NS_ERROR_OUT_OF_MEMORY : NS_OK;
    1.26 +}
    1.27 +
    1.28 +nsPKIParamBlock::~nsPKIParamBlock()
    1.29 +{
    1.30 +}
    1.31 +
    1.32 +
    1.33 +NS_IMETHODIMP 
    1.34 +nsPKIParamBlock::SetNumberStrings( int32_t inNumStrings )
    1.35 +{
    1.36 +  return mDialogParamBlock->SetNumberStrings(inNumStrings);
    1.37 +}
    1.38 +
    1.39 +NS_IMETHODIMP 
    1.40 +nsPKIParamBlock::SetInt(int32_t inIndex, int32_t inInt)
    1.41 +{
    1.42 +  return mDialogParamBlock->SetInt(inIndex, inInt);
    1.43 +}
    1.44 +
    1.45 +NS_IMETHODIMP 
    1.46 +nsPKIParamBlock::GetInt(int32_t inIndex, int32_t *outInt)
    1.47 +{
    1.48 +  return mDialogParamBlock->GetInt(inIndex, outInt);
    1.49 +}
    1.50 +
    1.51 +
    1.52 +NS_IMETHODIMP 
    1.53 +nsPKIParamBlock::GetString(int32_t inIndex, char16_t **_retval)
    1.54 +{
    1.55 +  return mDialogParamBlock->GetString(inIndex, _retval);
    1.56 +}
    1.57 +
    1.58 +NS_IMETHODIMP 
    1.59 +nsPKIParamBlock::SetString(int32_t inIndex, const char16_t *inString)
    1.60 +{
    1.61 +  return mDialogParamBlock->SetString(inIndex, inString);
    1.62 +}
    1.63 +
    1.64 +NS_IMETHODIMP
    1.65 +nsPKIParamBlock::GetObjects(nsIMutableArray * *aObjects)
    1.66 +{
    1.67 +  return mDialogParamBlock->GetObjects(aObjects);
    1.68 +}
    1.69 +
    1.70 +NS_IMETHODIMP
    1.71 +nsPKIParamBlock::SetObjects(nsIMutableArray * aObjects)
    1.72 +{
    1.73 +  return mDialogParamBlock->SetObjects(aObjects);
    1.74 +}
    1.75 +
    1.76 +
    1.77 +
    1.78 +/* void setISupportAtIndex (in int32_t index, in nsISupports object); */
    1.79 +NS_IMETHODIMP 
    1.80 +nsPKIParamBlock::SetISupportAtIndex(int32_t index, nsISupports *object)
    1.81 +{
    1.82 +  if (!mSupports) {
    1.83 +    mSupports = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
    1.84 +    if (!mSupports) {
    1.85 +      return NS_ERROR_OUT_OF_MEMORY;
    1.86 +    }
    1.87 +  }
    1.88 +  // Ignore any InsertElementAt error, because this function always did that
    1.89 +  mSupports->InsertElementAt(object, index-1);
    1.90 +  return NS_OK;
    1.91 +}
    1.92 +
    1.93 +/* nsISupports getISupportAtIndex (in int32_t index); */
    1.94 +NS_IMETHODIMP 
    1.95 +nsPKIParamBlock::GetISupportAtIndex(int32_t index, nsISupports **_retval)
    1.96 +{
    1.97 +  NS_ENSURE_ARG(_retval);
    1.98 +
    1.99 +  return mSupports->GetElementAt(index - 1, _retval);
   1.100 +}
   1.101 +
   1.102 +

mercurial