michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsTemplateMatch.h" michael@0: #include "nsTemplateRule.h" michael@0: michael@0: #ifdef NEED_CPP_UNUSED_IMPLEMENTATIONS michael@0: nsTemplateMatch::nsTemplateMatch(const nsTemplateMatch& aMatch) {} michael@0: void nsTemplateMatch::operator=(const nsTemplateMatch& aMatch) {} michael@0: #endif michael@0: michael@0: // static michael@0: void michael@0: nsTemplateMatch::Destroy(nsTemplateMatch*& aMatch, bool aRemoveResult) michael@0: { michael@0: if (aRemoveResult && aMatch->mResult) michael@0: aMatch->mResult->HasBeenRemoved(); michael@0: ::delete aMatch; michael@0: aMatch = nullptr; michael@0: } michael@0: michael@0: nsresult michael@0: nsTemplateMatch::RuleMatched(nsTemplateQuerySet* aQuerySet, michael@0: nsTemplateRule* aRule, michael@0: int16_t aRuleIndex, michael@0: nsIXULTemplateResult* aResult) michael@0: { michael@0: // assign the rule index, used to indicate that a match is active, and michael@0: // so the tree builder can get the right action body to generate michael@0: mRuleIndex = aRuleIndex; michael@0: michael@0: nsCOMPtr rulenode; michael@0: aRule->GetRuleNode(getter_AddRefs(rulenode)); michael@0: if (rulenode) michael@0: return aResult->RuleMatched(aQuerySet->mCompiledQuery, rulenode); michael@0: michael@0: return NS_OK; michael@0: }