PageRenderTime 26ms CodeModel.GetById 12ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

/security/manager/pki/src/nsPKIParamBlock.cpp

http://github.com/zpao/v8monkey
C++ | 132 lines | 71 code | 21 blank | 40 comment | 4 complexity | a89ca7ef4e1d4f9e0908e2415cea418d MD5 | raw file
  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
 45NS_IMPL_THREADSAFE_ISUPPORTS2(nsPKIParamBlock, nsIPKIParamBlock,
 46                                               nsIDialogParamBlock)
 47
 48nsPKIParamBlock::nsPKIParamBlock()
 49{
 50}
 51
 52nsresult
 53nsPKIParamBlock::Init()
 54{
 55  mDialogParamBlock = do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID);
 56  return (mDialogParamBlock == nsnull) ? NS_ERROR_OUT_OF_MEMORY : NS_OK;
 57}
 58
 59nsPKIParamBlock::~nsPKIParamBlock()
 60{
 61}
 62
 63
 64NS_IMETHODIMP 
 65nsPKIParamBlock::SetNumberStrings( PRInt32 inNumStrings )
 66{
 67  return mDialogParamBlock->SetNumberStrings(inNumStrings);
 68}
 69
 70NS_IMETHODIMP 
 71nsPKIParamBlock::SetInt(PRInt32 inIndex, PRInt32 inInt)
 72{
 73  return mDialogParamBlock->SetInt(inIndex, inInt);
 74}
 75
 76NS_IMETHODIMP 
 77nsPKIParamBlock::GetInt(PRInt32 inIndex, PRInt32 *outInt)
 78{
 79  return mDialogParamBlock->GetInt(inIndex, outInt);
 80}
 81
 82
 83NS_IMETHODIMP 
 84nsPKIParamBlock::GetString(PRInt32 inIndex, PRUnichar **_retval)
 85{
 86  return mDialogParamBlock->GetString(inIndex, _retval);
 87}
 88
 89NS_IMETHODIMP 
 90nsPKIParamBlock::SetString(PRInt32 inIndex, const PRUnichar *inString)
 91{
 92  return mDialogParamBlock->SetString(inIndex, inString);
 93}
 94
 95NS_IMETHODIMP
 96nsPKIParamBlock::GetObjects(nsIMutableArray * *aObjects)
 97{
 98  return mDialogParamBlock->GetObjects(aObjects);
 99}
100
101NS_IMETHODIMP
102nsPKIParamBlock::SetObjects(nsIMutableArray * aObjects)
103{
104  return mDialogParamBlock->SetObjects(aObjects);
105}
106
107
108
109/* void setISupportAtIndex (in PRInt32 index, in nsISupports object); */
110NS_IMETHODIMP 
111nsPKIParamBlock::SetISupportAtIndex(PRInt32 index, nsISupports *object)
112{
113  if (!mSupports) {
114    mSupports = do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID);
115    if (mSupports == nsnull) {
116      return NS_ERROR_OUT_OF_MEMORY;
117    }
118  }
119  return mSupports->InsertElementAt(object, index-1);
120}
121
122/* nsISupports getISupportAtIndex (in PRInt32 index); */
123NS_IMETHODIMP 
124nsPKIParamBlock::GetISupportAtIndex(PRInt32 index, nsISupports **_retval)
125{
126  NS_ENSURE_ARG(_retval);
127
128  *_retval = mSupports->ElementAt(index-1);
129  return NS_OK;
130}
131
132