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 : /**
7 : * StringResult
8 : * Represents a String as a Result of evaluating an Expr
9 : **/
10 : #include "txExprResult.h"
11 :
12 : /**
13 : * Default Constructor
14 : **/
15 0 : StringResult::StringResult(txResultRecycler* aRecycler)
16 0 : : txAExprResult(aRecycler)
17 : {
18 0 : }
19 :
20 : /**
21 : * Creates a new StringResult with the value of the given String parameter
22 : * @param str the String to use for initialization of this StringResult's value
23 : **/
24 0 : StringResult::StringResult(const nsAString& aValue, txResultRecycler* aRecycler)
25 0 : : txAExprResult(aRecycler), mValue(aValue)
26 : {
27 0 : }
28 :
29 : /*
30 : * Virtual Methods from ExprResult
31 : */
32 :
33 0 : short StringResult::getResultType() {
34 0 : return txAExprResult::STRING;
35 : } //-- getResultType
36 :
37 : void
38 0 : StringResult::stringValue(nsString& aResult)
39 : {
40 0 : aResult.Append(mValue);
41 0 : }
42 :
43 : const nsString*
44 0 : StringResult::stringValuePointer()
45 : {
46 0 : return &mValue;
47 : }
48 :
49 0 : bool StringResult::booleanValue() {
50 0 : return !mValue.IsEmpty();
51 : } //-- booleanValue
52 :
53 0 : double StringResult::numberValue() {
54 0 : return txDouble::toDouble(mValue);
55 : } //-- numberValue
56 :
|