LCOV - code coverage report
Current view: top level - dom/xslt/xpath - txNodeSetAdaptor.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 35 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 11 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /* This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : #include "txNodeSetAdaptor.h"
       7             : #include "txXPathTreeWalker.h"
       8             : 
       9           0 : txNodeSetAdaptor::txNodeSetAdaptor()
      10             :     : txXPathObjectAdaptor(),
      11           0 :       mWritable(true)
      12             : {
      13           0 : }
      14             : 
      15           0 : txNodeSetAdaptor::txNodeSetAdaptor(txNodeSet *aNodeSet)
      16             :     : txXPathObjectAdaptor(aNodeSet),
      17           0 :       mWritable(false)
      18             : {
      19           0 : }
      20             : 
      21           0 : NS_IMPL_ISUPPORTS_INHERITED(txNodeSetAdaptor, txXPathObjectAdaptor, txINodeSet)
      22             : 
      23             : nsresult
      24           0 : txNodeSetAdaptor::Init()
      25             : {
      26           0 :     if (!mValue) {
      27           0 :         mValue = new txNodeSet(nullptr);
      28             :     }
      29           0 :     return NS_OK;
      30             : }
      31             : 
      32             : NS_IMETHODIMP
      33           0 : txNodeSetAdaptor::Item(uint32_t aIndex, nsIDOMNode **aResult)
      34             : {
      35           0 :     *aResult = nullptr;
      36             : 
      37           0 :     if (aIndex > (uint32_t)NodeSet()->size()) {
      38           0 :         return NS_ERROR_ILLEGAL_VALUE;
      39             :     }
      40             : 
      41           0 :     return txXPathNativeNode::getNode(NodeSet()->get(aIndex), aResult);
      42             : }
      43             : 
      44             : NS_IMETHODIMP
      45           0 : txNodeSetAdaptor::ItemAsNumber(uint32_t aIndex, double *aResult)
      46             : {
      47           0 :     if (aIndex > (uint32_t)NodeSet()->size()) {
      48           0 :         return NS_ERROR_ILLEGAL_VALUE;
      49             :     }
      50             : 
      51           0 :     nsAutoString result;
      52           0 :     txXPathNodeUtils::appendNodeValue(NodeSet()->get(aIndex), result);
      53             : 
      54           0 :     *aResult = txDouble::toDouble(result);
      55             : 
      56           0 :     return NS_OK;
      57             : }
      58             : 
      59             : NS_IMETHODIMP
      60           0 : txNodeSetAdaptor::ItemAsString(uint32_t aIndex, nsAString &aResult)
      61             : {
      62           0 :     if (aIndex > (uint32_t)NodeSet()->size()) {
      63           0 :         return NS_ERROR_ILLEGAL_VALUE;
      64             :     }
      65             : 
      66           0 :     txXPathNodeUtils::appendNodeValue(NodeSet()->get(aIndex), aResult);
      67             : 
      68           0 :     return NS_OK;
      69             : }
      70             : 
      71             : NS_IMETHODIMP
      72           0 : txNodeSetAdaptor::GetLength(uint32_t *aLength)
      73             : {
      74           0 :     *aLength = (uint32_t)NodeSet()->size();
      75             : 
      76           0 :     return NS_OK;
      77             : }
      78             : 
      79             : NS_IMETHODIMP
      80           0 : txNodeSetAdaptor::Add(nsIDOMNode *aNode)
      81             : {
      82           0 :     NS_ENSURE_TRUE(mWritable, NS_ERROR_FAILURE);
      83             : 
      84             :     nsAutoPtr<txXPathNode> node(txXPathNativeNode::createXPathNode(aNode,
      85           0 :                                                                    true));
      86             : 
      87           0 :     return node ? NodeSet()->add(*node) : NS_ERROR_OUT_OF_MEMORY;
      88             : }

Generated by: LCOV version 1.13