/src/mozilla-central/dom/xslt/xpath/txSingleNodeContext.h
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 | | #ifndef __TX_XPATH_SINGLENODE_CONTEXT |
7 | | #define __TX_XPATH_SINGLENODE_CONTEXT |
8 | | |
9 | | #include "mozilla/Attributes.h" |
10 | | #include "txIXPathContext.h" |
11 | | |
12 | | class txSingleNodeContext : public txIEvalContext |
13 | | { |
14 | | public: |
15 | | txSingleNodeContext(const txXPathNode& aContextNode, |
16 | | txIMatchContext* aContext) |
17 | | : mNode(aContextNode), |
18 | | mInner(aContext) |
19 | 0 | { |
20 | 0 | NS_ASSERTION(aContext, "txIMatchContext must be given"); |
21 | 0 | } |
22 | | |
23 | | nsresult getVariable(int32_t aNamespace, nsAtom* aLName, |
24 | | txAExprResult*& aResult) override |
25 | 0 | { |
26 | 0 | NS_ASSERTION(mInner, "mInner is null!!!"); |
27 | 0 | return mInner->getVariable(aNamespace, aLName, aResult); |
28 | 0 | } |
29 | | |
30 | | nsresult isStripSpaceAllowed(const txXPathNode& aNode, |
31 | | bool& aAllowed) override |
32 | 0 | { |
33 | 0 | NS_ASSERTION(mInner, "mInner is null!!!"); |
34 | 0 | return mInner->isStripSpaceAllowed(aNode, aAllowed); |
35 | 0 | } |
36 | | |
37 | | void* getPrivateContext() override |
38 | 0 | { |
39 | 0 | NS_ASSERTION(mInner, "mInner is null!!!"); |
40 | 0 | return mInner->getPrivateContext(); |
41 | 0 | } |
42 | | |
43 | | txResultRecycler* recycler() override |
44 | 0 | { |
45 | 0 | NS_ASSERTION(mInner, "mInner is null!!!"); |
46 | 0 | return mInner->recycler(); |
47 | 0 | } |
48 | | |
49 | | void receiveError(const nsAString& aMsg, nsresult aRes) override |
50 | 0 | { |
51 | 0 | NS_ASSERTION(mInner, "mInner is null!!!"); |
52 | | #ifdef DEBUG |
53 | | nsAutoString error(NS_LITERAL_STRING("forwarded error: ")); |
54 | | error.Append(aMsg); |
55 | | mInner->receiveError(error, aRes); |
56 | | #else |
57 | | mInner->receiveError(aMsg, aRes); |
58 | 0 | #endif |
59 | 0 | } |
60 | | |
61 | | const txXPathNode& getContextNode() override |
62 | 0 | { |
63 | 0 | return mNode; |
64 | 0 | } |
65 | | |
66 | | uint32_t size() override |
67 | 0 | { |
68 | 0 | return 1; |
69 | 0 | } |
70 | | |
71 | | uint32_t position() override |
72 | 0 | { |
73 | 0 | return 1; |
74 | 0 | } |
75 | | |
76 | | private: |
77 | | const txXPathNode& mNode; |
78 | | txIMatchContext* mInner; |
79 | | }; |
80 | | |
81 | | #endif // __TX_XPATH_SINGLENODE_CONTEXT |