LCOV - code coverage report
Current view: top level - toolkit/components/windowwatcher - nsDialogParamBlock.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 48 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 13 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       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 "nsDialogParamBlock.h"
       8             : #include "nsString.h"
       9             : #include "nsReadableUtils.h"
      10             : 
      11           0 : NS_IMPL_ISUPPORTS(nsDialogParamBlock, nsIDialogParamBlock)
      12             : 
      13           0 : nsDialogParamBlock::nsDialogParamBlock()
      14             :   : mNumStrings(0)
      15           0 :   , mString(nullptr)
      16             : {
      17           0 :   for (int32_t i = 0; i < kNumInts; i++) {
      18           0 :     mInt[i] = 0;
      19             :   }
      20           0 : }
      21             : 
      22           0 : nsDialogParamBlock::~nsDialogParamBlock()
      23             : {
      24           0 :   delete[] mString;
      25           0 : }
      26             : 
      27             : NS_IMETHODIMP
      28           0 : nsDialogParamBlock::SetNumberStrings(int32_t aNumStrings)
      29             : {
      30           0 :   if (mString) {
      31           0 :     return NS_ERROR_ALREADY_INITIALIZED;
      32             :   }
      33             : 
      34           0 :   mString = new nsString[aNumStrings];
      35           0 :   if (!mString) {
      36           0 :     return NS_ERROR_OUT_OF_MEMORY;
      37             :   }
      38           0 :   mNumStrings = aNumStrings;
      39           0 :   return NS_OK;
      40             : }
      41             : 
      42             : NS_IMETHODIMP
      43           0 : nsDialogParamBlock::GetInt(int32_t aIndex, int32_t* aResult)
      44             : {
      45           0 :   nsresult rv = InBounds(aIndex, kNumInts);
      46           0 :   if (rv == NS_OK) {
      47           0 :     *aResult = mInt[aIndex];
      48             :   }
      49           0 :   return rv;
      50             : }
      51             : 
      52             : NS_IMETHODIMP
      53           0 : nsDialogParamBlock::SetInt(int32_t aIndex, int32_t aInt)
      54             : {
      55           0 :   nsresult rv = InBounds(aIndex, kNumInts);
      56           0 :   if (rv == NS_OK) {
      57           0 :     mInt[aIndex] = aInt;
      58             :   }
      59           0 :   return rv;
      60             : }
      61             : 
      62             : NS_IMETHODIMP
      63           0 : nsDialogParamBlock::GetString(int32_t aIndex, char16_t** aResult)
      64             : {
      65           0 :   if (mNumStrings == 0) {
      66           0 :     SetNumberStrings(kNumStrings);
      67             :   }
      68           0 :   nsresult rv = InBounds(aIndex, mNumStrings);
      69           0 :   if (rv == NS_OK) {
      70           0 :     *aResult = ToNewUnicode(mString[aIndex]);
      71             :   }
      72           0 :   return rv;
      73             : }
      74             : 
      75             : NS_IMETHODIMP
      76           0 : nsDialogParamBlock::SetString(int32_t aIndex, const char16_t* aString)
      77             : {
      78           0 :   if (mNumStrings == 0) {
      79           0 :     SetNumberStrings(kNumStrings);
      80             :   }
      81           0 :   nsresult rv = InBounds(aIndex, mNumStrings);
      82           0 :   if (rv == NS_OK) {
      83           0 :     mString[aIndex] = aString;
      84             :   }
      85           0 :   return rv;
      86             : }
      87             : 
      88             : NS_IMETHODIMP
      89           0 : nsDialogParamBlock::GetObjects(nsIMutableArray** aObjects)
      90             : {
      91           0 :   NS_ENSURE_ARG_POINTER(aObjects);
      92           0 :   NS_IF_ADDREF(*aObjects = mObjects);
      93           0 :   return NS_OK;
      94             : }
      95             : 
      96             : NS_IMETHODIMP
      97           0 : nsDialogParamBlock::SetObjects(nsIMutableArray* aObjects)
      98             : {
      99           0 :   mObjects = aObjects;
     100           0 :   return NS_OK;
     101             : }

Generated by: LCOV version 1.13