LCOV - code coverage report
Current view: top level - dom/xul/templates - nsXULTemplateResultSetRDF.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 39 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 5 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 "nsXULTemplateResultSetRDF.h"
       7             : #include "nsXULTemplateQueryProcessorRDF.h"
       8             : 
       9           0 : NS_IMPL_ISUPPORTS(nsXULTemplateResultSetRDF, nsISimpleEnumerator)
      10             : 
      11             : NS_IMETHODIMP
      12           0 : nsXULTemplateResultSetRDF::HasMoreElements(bool *aResult)
      13             : {
      14           0 :     *aResult = true;
      15             : 
      16           0 :     nsCOMPtr<nsIRDFNode> node;
      17             : 
      18           0 :     if (! mInstantiations || ! mQuery) {
      19           0 :         *aResult = false;
      20           0 :         return NS_OK;
      21             :     }
      22             : 
      23           0 :     if (mCheckedNext) {
      24           0 :         if (!mCurrent || mCurrent == &(mInstantiations->mHead))
      25           0 :             *aResult = false;
      26           0 :         return NS_OK;
      27             :     }
      28             : 
      29           0 :     mCheckedNext = true;
      30             : 
      31           0 :     do {
      32           0 :         if (mCurrent) {
      33           0 :             mCurrent = mCurrent->mNext;
      34           0 :             if (mCurrent == &(mInstantiations->mHead)) {
      35           0 :                 *aResult = false;
      36           0 :                 return NS_OK;
      37             :             }
      38             :         }
      39             :         else {
      40           0 :             *aResult = ! mInstantiations->Empty();
      41           0 :             if (*aResult)
      42           0 :                 mCurrent = mInstantiations->mHead.mNext;
      43             :         }
      44             : 
      45             :         // get the value of the member variable. If it is not set, skip
      46             :         // the result and move on to the next result
      47           0 :         if (mCurrent) {
      48           0 :             mCurrent->mInstantiation.mAssignments.
      49           0 :                 GetAssignmentFor(mQuery->mMemberVariable, getter_AddRefs(node));
      50             :         }
      51             : 
      52             :         // only resources may be used as results
      53           0 :         mResource = do_QueryInterface(node);
      54           0 :     } while (! mResource);
      55             : 
      56           0 :     return NS_OK;
      57             : }
      58             : 
      59             : NS_IMETHODIMP
      60           0 : nsXULTemplateResultSetRDF::GetNext(nsISupports **aResult)
      61             : {
      62           0 :     if (!aResult)
      63           0 :         return NS_ERROR_NULL_POINTER;
      64             : 
      65           0 :     if (!mCurrent || !mCheckedNext)
      66           0 :         return NS_ERROR_FAILURE;
      67             : 
      68             :     RefPtr<nsXULTemplateResultRDF> nextresult =
      69           0 :         new nsXULTemplateResultRDF(mQuery, mCurrent->mInstantiation, mResource);
      70           0 :     if (!nextresult)
      71           0 :         return NS_ERROR_OUT_OF_MEMORY;
      72             : 
      73             :     // add the supporting memory elements to the processor's map. These are
      74             :     // used to remove the results when an assertion is removed from the graph
      75           0 :     mProcessor->AddMemoryElements(mCurrent->mInstantiation, nextresult);
      76             : 
      77           0 :     mCheckedNext = false;
      78             : 
      79           0 :     nextresult.forget(aResult);
      80             : 
      81           0 :     return NS_OK;
      82             : }

Generated by: LCOV version 1.13