/src/mozilla-central/dom/xslt/xpath/txStringResult.cpp
Line | Count | Source (jump to first uncovered line) |
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 | | StringResult::StringResult(txResultRecycler* aRecycler) |
16 | | : txAExprResult(aRecycler) |
17 | 0 | { |
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 | | StringResult::StringResult(const nsAString& aValue, txResultRecycler* aRecycler) |
25 | | : txAExprResult(aRecycler), mValue(aValue) |
26 | 0 | { |
27 | 0 | } |
28 | | |
29 | | /* |
30 | | * Virtual Methods from ExprResult |
31 | | */ |
32 | | |
33 | 0 | short StringResult::getResultType() { |
34 | 0 | return txAExprResult::STRING; |
35 | 0 | } //-- getResultType |
36 | | |
37 | | void |
38 | | StringResult::stringValue(nsString& aResult) |
39 | 0 | { |
40 | 0 | aResult.Append(mValue); |
41 | 0 | } |
42 | | |
43 | | const nsString* |
44 | | StringResult::stringValuePointer() |
45 | 0 | { |
46 | 0 | return &mValue; |
47 | 0 | } |
48 | | |
49 | 0 | bool StringResult::booleanValue() { |
50 | 0 | return !mValue.IsEmpty(); |
51 | 0 | } //-- booleanValue |
52 | | |
53 | 0 | double StringResult::numberValue() { |
54 | 0 | return txDouble::toDouble(mValue); |
55 | 0 | } //-- numberValue |
56 | | |