1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 #if !defined(EXECUTIONCONTEXT_HEADER_GUARD_1357924680) 19 #define EXECUTIONCONTEXT_HEADER_GUARD_1357924680 20 21 22 23 // Base include file. Must be first. 24 #include <xalanc/PlatformSupport/PlatformSupportDefinitions.hpp> 25 26 27 28 #include <xalanc/Include/XalanMemoryManagement.hpp> 29 30 31 32 #include "xalanc/PlatformSupport/ProblemListenerBase.hpp" 33 34 35 36 namespace XERCES_CPP_NAMESPACE 37 { 38 class Locator; 39 } 40 41 42 43 namespace XALAN_CPP_NAMESPACE { 44 45 46 47 typedef xercesc::Locator LocatorType; 48 49 50 51 class XalanDOMString; 52 class XalanNode; 53 class XalanText; 54 55 56 57 // 58 // An abstract class which provides support for execution. 59 // 60 class XALAN_PLATFORMSUPPORT_EXPORT ExecutionContext : public ProblemListenerBase 61 { 62 public: 63 64 ExecutionContext(MemoryManager& theMemoryManager); 65 66 virtual 67 ~ExecutionContext(); 68 69 70 // These interfaces are inherited from ProblemListenerBase 71 virtual void 72 problem( 73 eSource source, 74 eClassification classification, 75 const XalanDOMString& msg, 76 const Locator* locator, 77 const XalanNode* sourceNode) = 0; 78 79 virtual void 80 problem( 81 eSource source, 82 eClassification classification, 83 const XalanDOMString& msg, 84 const XalanNode* sourceNode) = 0; 85 86 bool hasPreserveOrStripSpaceConditions() const87 hasPreserveOrStripSpaceConditions() const 88 { 89 return m_hasPreserveOrStripConditions; 90 } 91 92 /** 93 * Determine if a text node should be stripped from the source tree, 94 * as if it weren't there. 95 * 96 * @param textNode text node from the source tree 97 * @return true if the text node should be stripped 98 */ 99 virtual bool 100 shouldStripSourceNode(const XalanText& node) = 0; 101 102 MemoryManager& getMemoryManager() const103 getMemoryManager() const 104 { 105 return m_memoryManager; 106 } 107 108 MemoryManager& getExceptionMemoryManager() const109 getExceptionMemoryManager() const 110 { 111 return XalanMemoryManager::getExceptionMemoryManager(m_memoryManager); 112 } 113 114 protected: 115 116 MemoryManager& m_memoryManager; 117 118 bool m_hasPreserveOrStripConditions; 119 }; 120 121 122 123 } 124 125 126 127 #endif // EXECUTIONCONTEXT_HEADER_GUARD_1357924680 128