diff options
author | Rüdiger Timm <rt@openoffice.org> | 2008-06-16 13:08:13 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2008-06-16 13:08:13 +0000 |
commit | fb65417ddd60e87cdf6a74dac9444298ef445933 (patch) | |
tree | 8870388e3aac2ccbef570c943be35c81180a83fb /configmgr | |
parent | 98667b9e2603eb8987ff1e916096d03cf977bca1 (diff) |
INTEGRATION: CWS sb88 (1.32.10); FILE MERGED
2008/06/03 15:29:54 sb 1.32.10.1: #i89553 applied patch by cmc
Diffstat (limited to 'configmgr')
-rw-r--r-- | configmgr/source/treemgr/noderef.cxx | 97 | ||||
-rw-r--r-- | configmgr/source/treemgr/treeimpl.cxx | 33 |
2 files changed, 8 insertions, 122 deletions
diff --git a/configmgr/source/treemgr/noderef.cxx b/configmgr/source/treemgr/noderef.cxx index eb8ae4d51d68..858a1a82b2aa 100644 --- a/configmgr/source/treemgr/noderef.cxx +++ b/configmgr/source/treemgr/noderef.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: noderef.cxx,v $ - * $Revision: 1.32 $ + * $Revision: 1.33 $ * * This file is part of OpenOffice.org. * @@ -104,18 +104,6 @@ ValueRef TreeImplHelper::makeValue(Name const& aName, NodeOffset nParentOffset) } //----------------------------------------------------------------------------- -AnyNodeRef TreeImplHelper::makeAnyNode(NodeOffset nOffset, TreeDepth nDepth) -{ - return AnyNodeRef(nOffset, nDepth); -} -//----------------------------------------------------------------------------- - -AnyNodeRef TreeImplHelper::makeAnyNode(Name const& aName, NodeOffset nParentOffset) -{ - return AnyNodeRef(aName,nParentOffset); -} -//----------------------------------------------------------------------------- - TreeImpl* TreeImplHelper::impl(TreeRef const& aRef) { return aRef.get(); @@ -574,7 +562,7 @@ UnoType Tree::getUnoType(ValueRef const& aValue) const //----------------------------------------------------------------------------- // class AnyNodeRef //----------------------------------------------------------------------------- - +#if OSL_DEBUG_LEVEL > 0 bool AnyNodeRef::checkValidState() const { if (m_nUsedPos == 0) return false; @@ -587,6 +575,7 @@ bool AnyNodeRef::checkValidState() const return true; } +#endif //----------------------------------------------------------------------------- AnyNodeRef::AnyNodeRef() @@ -697,30 +686,6 @@ node::Attributes Tree::getAttributes(AnyNodeRef const& aNode) const } //----------------------------------------------------------------------------- -Name Tree::getName(AnyNodeRef const& aNode) const -{ - OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires valid tree" ); - OSL_PRECOND( !aNode.isValid() || isValidNode(aNode), "ERROR: Configuration: NodeRef does not match tree" ); - - if (isEmpty() || !aNode.isValid()) return Name(); - - if (aNode.isNode()) - return m_ref->getSimpleNodeName(aNode.m_nUsedPos); - - else - return aNode.m_sNodeName; -} -//----------------------------------------------------------------------------- - -NodeVisitor::Result Tree::visit(AnyNodeRef const& aNode, NodeVisitor& aVisitor) const -{ - OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires valid tree" ); - OSL_PRECOND( !aNode.isValid() || isValidNode(aNode), "ERROR: Configuration: NodeRef does not match tree" ); - - return aNode.isNode() ? visit(aNode.toNode(),aVisitor) : visit(aNode.toValue(),aVisitor); -} - - //----------------------------------------------------------------------------- // class TreeRef //----------------------------------------------------------------------------- @@ -838,7 +803,7 @@ bool Tree::isValidNode(NodeRef const& aNode) const return m_ref.isValidNode(aNode); } //----------------------------------------------------------------------------- - +#if OSL_DEBUG_LEVEL > 0 bool Tree::isValidNode(AnyNodeRef const& aNode) const { OSL_PRECOND(!isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree"); @@ -855,6 +820,7 @@ bool Tree::isValidNode(AnyNodeRef const& aNode) const return true; } +#endif //----------------------------------------------------------------------------- bool Tree::hasChildren(NodeRef const& aNode) const @@ -1042,21 +1008,6 @@ NodeRef Tree::getParent(NodeRef const& aNode) const } //----------------------------------------------------------------------------- -NodeRef Tree::getParent(AnyNodeRef const& aNode) const -{ - OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree"); - OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: NodeRef does not match Tree"); - OSL_ASSERT( getView().makeNode(getRootNode()).getParent().is() == false ); - - view::Node aParent = getView().makeNode(aNode.m_nUsedPos); - - if (aNode.m_sNodeName.isEmpty() && aNode.isValid()) - aParent = aParent.getParent(); - - return TreeImplHelper::makeNode(*m_ref, aParent.get_offset()); -} -//----------------------------------------------------------------------------- - UnoAny Tree::getNodeValue(ValueRef const& aNode) const { OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: Value operation requires a valid Value Ref"); @@ -1491,20 +1442,6 @@ SubNodeID::SubNodeID() } //----------------------------------------------------------------------------- -SubNodeID::SubNodeID(Tree const& rTree, ValueRef const& rNode) -: m_sNodeName(rTree.getName(rNode)) -, m_aParentID(rTree,rTree.getParent(rNode)) -{ -} -//----------------------------------------------------------------------------- - -SubNodeID::SubNodeID(Tree const& rTree, NodeRef const& rParentNode, Name const& aName) -: m_sNodeName(aName) -, m_aParentID(rTree,rParentNode) -{ -} -//----------------------------------------------------------------------------- - SubNodeID::SubNodeID(TreeRef const& rTree, NodeRef const& rParentNode, Name const& aName) : m_sNodeName(aName) , m_aParentID(rTree,rParentNode) @@ -1519,14 +1456,6 @@ SubNodeID::SubNodeID(NodeID const& rParentNodeID, Name const& aName) } //----------------------------------------------------------------------------- -bool SubNodeID::isEmpty() const -{ - OSL_ENSURE( m_aParentID.isEmpty() || - (m_aParentID.isValidNode() && !m_sNodeName.isEmpty()),"Invalid subnode ID"); - return m_aParentID.isEmpty(); -} -//----------------------------------------------------------------------------- - bool SubNodeID::isValidNode() const { if (!m_aParentID.isValidNode()) return false; @@ -1671,12 +1600,6 @@ RelativePath validateAndReducePath(OUString const& _sPath, Tree const& aTree, No } //----------------------------------------------------------------------------- -bool hasChildOrElement(Tree const& aTree, NodeRef const& aNode) -{ - return aTree.getView().isSetNode(aNode) ? aTree.hasElements(aNode) : aTree.hasChildren(aNode); -} -//----------------------------------------------------------------------------- - bool hasChildOrElement(Tree const& aTree, NodeRef const& aNode, Name const& aName) { return aTree.getView().isSetNode(aNode) ? aTree.hasElement(aNode,aName) : aTree.hasChild(aNode,aName); @@ -1954,20 +1877,13 @@ NodeID findNodeFromIndex(TreeRef const& aTree, NodeOffset nIndex) } //----------------------------------------------------------------------------- -bool isSimpleValue(Tree const& aTree, AnyNodeRef const& aNode) -{ - OSL_PRECOND( !aNode.isValid() || !aTree.isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree"); - OSL_PRECOND( !aNode.isValid() || aTree.isValidNode(aNode), "WARNING: Configuration: NodeRef does not match Tree"); - return aNode.isValid() && (!aNode.isNode() || aTree.getView().isValueNode(aNode.toNode())); -} -//----------------------------------------------------------------------------- static inline bool isRootNode(Tree const& aTree, NodeRef const& aNode) { return TreeImplHelper::offset(aNode) == TreeImplHelper::impl(aTree)->root_(); } //----------------------------------------------------------------------------- - +#if OSL_DEBUG_LEVEL > 1 bool isSimpleValueElement(Tree const& aTree, NodeRef const& aNode) { OSL_PRECOND( !aNode.isValid() || !aTree.isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree"); @@ -1982,6 +1898,7 @@ bool isSimpleValueElement(Tree const& aTree, NodeRef const& aNode) return aNode.isValid() && isRootNode(aTree,aNode) && aView.isValueNode(aNode); } +#endif //----------------------------------------------------------------------------- bool isStructuralNode(Tree const& aTree, NodeRef const& aNode) diff --git a/configmgr/source/treemgr/treeimpl.cxx b/configmgr/source/treemgr/treeimpl.cxx index 8ce789248c5b..8eacc012c3ea 100644 --- a/configmgr/source/treemgr/treeimpl.cxx +++ b/configmgr/source/treemgr/treeimpl.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: treeimpl.cxx,v $ - * $Revision: 1.32 $ + * $Revision: 1.33 $ * * This file is part of OpenOffice.org. * @@ -567,12 +567,6 @@ NodeOffset TreeImpl::firstChild_ (NodeOffset nParent) const } //----------------------------------------------------------------------------- -NodeOffset TreeImpl::nextSibling_(NodeOffset nNode) const -{ - return findNextChild_(parent_(nNode),nNode); -} -//----------------------------------------------------------------------------- - NodeOffset TreeImpl::findNextChild_(NodeOffset nParent, NodeOffset nStartAfter) const { OSL_ASSERT(isValidNode(nParent)); @@ -617,29 +611,12 @@ ElementTreeImpl * TreeImpl::asElementTree() } //----------------------------------------------------------------------------- -RootTreeImpl * TreeImpl::asRootTree() -{ - RootTreeImpl const* const pResult = doCastToRootTree(); - TreeImpl const* const pTest = pResult; - if (pTest== this) - return const_cast<RootTreeImpl *>(pResult); - else - return 0; -} -//----------------------------------------------------------------------------- - ElementTreeImpl const* TreeImpl::asElementTree() const { return doCastToElementTree(); } //----------------------------------------------------------------------------- -RootTreeImpl const* TreeImpl::asRootTree() const -{ - return doCastToRootTree(); -} -//----------------------------------------------------------------------------- - RootTreeImpl const* ElementTreeImpl::doCastToRootTree() const { return 0; @@ -894,14 +871,6 @@ void ElementTreeImpl::takeTreeAndRebuild(data::TreeSegment const & _aDataSegment } //----------------------------------------------------------------------------- -/// transfer ownership to the given owner -data::TreeSegment ElementTreeImpl::getOwnedTree() const -{ - OSL_ENSURE(m_aOwnData.is(),"ERROR: Cannot provide segment for a non-owned node"); - return m_aOwnData; -} -//----------------------------------------------------------------------------- - /// release ownership data::TreeSegment ElementTreeImpl::releaseOwnedTree() { |