LCOV - code coverage report
Current view: top level - dom/xul/templates - nsXULTemplateResultStorage.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 57 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 15 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 "nsIServiceManager.h"
       7             : #include "nsRDFCID.h"
       8             : #include "nsIRDFService.h"
       9             : #include "nsString.h"
      10             : #include "nsXULTemplateResultStorage.h"
      11             : 
      12           0 : NS_IMPL_ISUPPORTS(nsXULTemplateResultStorage, nsIXULTemplateResult)
      13             : 
      14           0 : nsXULTemplateResultStorage::nsXULTemplateResultStorage(nsXULTemplateResultSetStorage* aResultSet)
      15             : {
      16             :     static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
      17           0 :     nsCOMPtr<nsIRDFService> rdfService = do_GetService(kRDFServiceCID);
      18           0 :     rdfService->GetAnonymousResource(getter_AddRefs(mNode));
      19           0 :     mResultSet = aResultSet;
      20           0 :     if (aResultSet) {
      21           0 :         mResultSet->FillColumnValues(mValues);
      22             :     }
      23           0 : }
      24             : 
      25           0 : nsXULTemplateResultStorage::~nsXULTemplateResultStorage()
      26             : {
      27           0 : }
      28             : 
      29             : NS_IMETHODIMP
      30           0 : nsXULTemplateResultStorage::GetIsContainer(bool* aIsContainer)
      31             : {
      32           0 :     *aIsContainer = false;
      33           0 :     return NS_OK;
      34             : }
      35             : 
      36             : NS_IMETHODIMP
      37           0 : nsXULTemplateResultStorage::GetIsEmpty(bool* aIsEmpty)
      38             : {
      39           0 :     *aIsEmpty = true;
      40           0 :     return NS_OK;
      41             : }
      42             : 
      43             : NS_IMETHODIMP
      44           0 : nsXULTemplateResultStorage::GetMayProcessChildren(bool* aMayProcessChildren)
      45             : {
      46           0 :     *aMayProcessChildren = false;
      47           0 :     return NS_OK;
      48             : }
      49             : 
      50             : NS_IMETHODIMP
      51           0 : nsXULTemplateResultStorage::GetId(nsAString& aId)
      52             : {
      53           0 :     const char* uri = nullptr;
      54           0 :     mNode->GetValueConst(&uri);
      55             : 
      56           0 :     aId.Assign(NS_ConvertUTF8toUTF16(uri));
      57             : 
      58           0 :     return NS_OK;
      59             : }
      60             : 
      61             : NS_IMETHODIMP
      62           0 : nsXULTemplateResultStorage::GetResource(nsIRDFResource** aResource)
      63             : {
      64           0 :     *aResource = mNode;
      65           0 :     NS_IF_ADDREF(*aResource);
      66           0 :     return NS_OK;
      67             : }
      68             : 
      69             : NS_IMETHODIMP
      70           0 : nsXULTemplateResultStorage::GetType(nsAString& aType)
      71             : {
      72           0 :     aType.Truncate();
      73           0 :     return NS_OK;
      74             : }
      75             : 
      76             : 
      77             : NS_IMETHODIMP
      78           0 : nsXULTemplateResultStorage::GetBindingFor(nsIAtom* aVar, nsAString& aValue)
      79             : {
      80           0 :     NS_ENSURE_ARG_POINTER(aVar);
      81             : 
      82           0 :     aValue.Truncate();
      83           0 :     if (!mResultSet) {
      84           0 :         return NS_OK;
      85             :     }
      86             : 
      87           0 :     int32_t idx = mResultSet->GetColumnIndex(aVar);
      88           0 :     if (idx < 0) {
      89           0 :         return NS_OK;
      90             :     }
      91             : 
      92           0 :     nsIVariant * value = mValues[idx];
      93           0 :     if (value) {
      94           0 :         value->GetAsAString(aValue);
      95             :     }
      96           0 :     return NS_OK;
      97             : }
      98             : 
      99             : NS_IMETHODIMP
     100           0 : nsXULTemplateResultStorage::GetBindingObjectFor(nsIAtom* aVar, nsISupports** aValue)
     101             : {
     102           0 :     NS_ENSURE_ARG_POINTER(aVar);
     103             : 
     104           0 :     if (mResultSet) {
     105           0 :         int32_t idx = mResultSet->GetColumnIndex(aVar);
     106           0 :         if (idx >= 0) {
     107           0 :             *aValue = mValues[idx];
     108           0 :             NS_IF_ADDREF(*aValue);
     109           0 :             return NS_OK;
     110             :         }
     111             :     }
     112           0 :     *aValue = nullptr;
     113           0 :     return NS_OK;
     114             : }
     115             : 
     116             : NS_IMETHODIMP
     117           0 : nsXULTemplateResultStorage::RuleMatched(nsISupports* aQuery, nsIDOMNode* aRuleNode)
     118             : {
     119           0 :     return NS_OK;
     120             : }
     121             : 
     122             : NS_IMETHODIMP
     123           0 : nsXULTemplateResultStorage::HasBeenRemoved()
     124             : {
     125           0 :     return NS_OK;
     126             : }

Generated by: LCOV version 1.13