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: /** michael@0: * StringResult michael@0: * Represents a String as a Result of evaluating an Expr michael@0: **/ michael@0: #include "txExprResult.h" michael@0: michael@0: /** michael@0: * Default Constructor michael@0: **/ michael@0: StringResult::StringResult(txResultRecycler* aRecycler) michael@0: : txAExprResult(aRecycler) michael@0: { michael@0: } michael@0: michael@0: /** michael@0: * Creates a new StringResult with the value of the given String parameter michael@0: * @param str the String to use for initialization of this StringResult's value michael@0: **/ michael@0: StringResult::StringResult(const nsAString& aValue, txResultRecycler* aRecycler) michael@0: : txAExprResult(aRecycler), mValue(aValue) michael@0: { michael@0: } michael@0: michael@0: /* michael@0: * Virtual Methods from ExprResult michael@0: */ michael@0: michael@0: short StringResult::getResultType() { michael@0: return txAExprResult::STRING; michael@0: } //-- getResultType michael@0: michael@0: void michael@0: StringResult::stringValue(nsString& aResult) michael@0: { michael@0: aResult.Append(mValue); michael@0: } michael@0: michael@0: const nsString* michael@0: StringResult::stringValuePointer() michael@0: { michael@0: return &mValue; michael@0: } michael@0: michael@0: bool StringResult::booleanValue() { michael@0: return !mValue.IsEmpty(); michael@0: } //-- booleanValue michael@0: michael@0: double StringResult::numberValue() { michael@0: return txDouble::toDouble(mValue); michael@0: } //-- numberValue michael@0: