1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/xslt/xpath/txStringResult.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,56 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +/** 1.10 + * StringResult 1.11 + * Represents a String as a Result of evaluating an Expr 1.12 +**/ 1.13 +#include "txExprResult.h" 1.14 + 1.15 +/** 1.16 + * Default Constructor 1.17 +**/ 1.18 +StringResult::StringResult(txResultRecycler* aRecycler) 1.19 + : txAExprResult(aRecycler) 1.20 +{ 1.21 +} 1.22 + 1.23 +/** 1.24 + * Creates a new StringResult with the value of the given String parameter 1.25 + * @param str the String to use for initialization of this StringResult's value 1.26 +**/ 1.27 +StringResult::StringResult(const nsAString& aValue, txResultRecycler* aRecycler) 1.28 + : txAExprResult(aRecycler), mValue(aValue) 1.29 +{ 1.30 +} 1.31 + 1.32 +/* 1.33 + * Virtual Methods from ExprResult 1.34 +*/ 1.35 + 1.36 +short StringResult::getResultType() { 1.37 + return txAExprResult::STRING; 1.38 +} //-- getResultType 1.39 + 1.40 +void 1.41 +StringResult::stringValue(nsString& aResult) 1.42 +{ 1.43 + aResult.Append(mValue); 1.44 +} 1.45 + 1.46 +const nsString* 1.47 +StringResult::stringValuePointer() 1.48 +{ 1.49 + return &mValue; 1.50 +} 1.51 + 1.52 +bool StringResult::booleanValue() { 1.53 + return !mValue.IsEmpty(); 1.54 +} //-- booleanValue 1.55 + 1.56 +double StringResult::numberValue() { 1.57 + return txDouble::toDouble(mValue); 1.58 +} //-- numberValue 1.59 +