diff options
author | Jörg Barfurth <jb@openoffice.org> | 2002-03-28 07:14:40 +0000 |
---|---|---|
committer | Jörg Barfurth <jb@openoffice.org> | 2002-03-28 07:14:40 +0000 |
commit | 806a6dd82c3d015417e35d2b55f055c8a428aa10 (patch) | |
tree | 1bb1136d70ee87ca14c7ddb89882b7b7191cff7f /configmgr/source/treemgr | |
parent | 1a74c0b85d34d51349b1483f075206a3b6aeb7f2 (diff) |
#91896# Complete transition to sharable data structures; remove non-sharable versions of algorithms
Diffstat (limited to 'configmgr/source/treemgr')
-rw-r--r-- | configmgr/source/treemgr/directview.cxx | 18 | ||||
-rw-r--r-- | configmgr/source/treemgr/nodeimpl.cxx | 9 | ||||
-rw-r--r-- | configmgr/source/treemgr/treeimpl.cxx | 76 | ||||
-rw-r--r-- | configmgr/source/treemgr/viewstrategy.cxx | 22 |
4 files changed, 14 insertions, 111 deletions
diff --git a/configmgr/source/treemgr/directview.cxx b/configmgr/source/treemgr/directview.cxx index 48ce08e6156d..b9db255b0b5f 100644 --- a/configmgr/source/treemgr/directview.cxx +++ b/configmgr/source/treemgr/directview.cxx @@ -2,9 +2,9 @@ * * $RCSfile: directview.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: jb $ $Date: 2002-02-11 14:55:53 $ + * last change: $Author: jb $ $Date: 2002-03-28 08:14:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -84,25 +84,11 @@ void DirectViewStrategy::implMarkNondefault(SetNode const& _aSetNode) OSL_ASSERT(aSetAccess.isValid()); -// ----------------------------------------------------------------------------- -#ifdef NON_SHARABLE_DATA -// ----------------------------------------------------------------------------- - ISubtree* pTree = this->getDataForUpdate(aSetAccess); - - OSL_ASSERT(pTree); - - pTree->markAsDefault(false); -// ----------------------------------------------------------------------------- -#else // SHARABLE_DATA -// ----------------------------------------------------------------------------- sharable::SetNode* pNode = this->getDataForUpdate(aSetAccess); OSL_ASSERT(pNode); pNode->info.markAsDefault(false); -// ----------------------------------------------------------------------------- -#endif // SHARABLE_DATA -// ----------------------------------------------------------------------------- } //----------------------------------------------------------------------------- diff --git a/configmgr/source/treemgr/nodeimpl.cxx b/configmgr/source/treemgr/nodeimpl.cxx index c83e7f1bac0e..c77aaa3226b1 100644 --- a/configmgr/source/treemgr/nodeimpl.cxx +++ b/configmgr/source/treemgr/nodeimpl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: nodeimpl.cxx,v $ * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * - * last change: $Author: jb $ $Date: 2002-02-11 13:47:56 $ + * last change: $Author: jb $ $Date: 2002-03-28 08:14:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -154,12 +154,7 @@ bool GroupNodeImpl::areValueDefaultsAvailable(data::Accessor const& _aAccessor) { data::GroupNodeAccess aGroupAccess = getDataAccess(_aAccessor); -#ifdef NON_SHARABLE_DATA - return aGroupAccess.data().getDefaultsLevel() != 0 || - aGroupAccess.isDefault(); -#else // SHARABLE_DATA return aGroupAccess.data().hasDefaultsAvailable(); -#endif } //----------------------------------------------------------------------------- diff --git a/configmgr/source/treemgr/treeimpl.cxx b/configmgr/source/treemgr/treeimpl.cxx index e4ddcdf3c3a9..fe5204185d83 100644 --- a/configmgr/source/treemgr/treeimpl.cxx +++ b/configmgr/source/treemgr/treeimpl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: treeimpl.cxx,v $ * - * $Revision: 1.21 $ + * $Revision: 1.22 $ * - * last change: $Author: jb $ $Date: 2002-02-11 13:47:56 $ + * last change: $Author: jb $ $Date: 2002-03-28 08:14:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -921,77 +921,6 @@ void ElementTreeImpl::rebuild(rtl::Reference<view::ViewStrategy> const & _xStrat /// transfer ownership to the given set // ----------------------------------------------------------------------------- -#ifdef NON_SHARABLE_DATA -// ----------------------------------------------------------------------------- -void ElementTreeImpl::attachTo(data::SetNodeAccess const & aOwningSet, Name const& aElementName) -{ - OSL_ENSURE(m_aOwnData.is(),"ERROR: Cannot add a non-owned node to a subtree"); - - if (m_aOwnData.is()) - { - OSL_ENSURE(this->getSimpleRootName() == aElementName,"ElementTree: Attaching with unexpected element name"); - m_aOwnData.setName(aElementName); - - INode * pOldNode = m_aOwnData.getTreeData(); - OSL_ASSERT(pOldNode); - - // copy over to the new segment - std::auto_ptr<INode> aNewNode(pOldNode->clone()); - - TreeImpl* pOwningTree = this->getContextTree(); - OSL_ENSURE(pOwningTree, "Element Tree Context must be set before attaching data"); - OSL_ENSURE( getUpdatableSegment(*pOwningTree) != NULL, "Cannot attach directly to new tree - no update access available"); - - rtl::Reference<view::ViewStrategy> xNewBehavior = pOwningTree->getViewBehavior(); - - ISubtree * pOwningNodeData = xNewBehavior->getDataForUpdate(aOwningSet); - OSL_ASSERT(pOwningNodeData); - - INode * pNewNode = pOwningNodeData->addChild(aNewNode); - - data::TreeAccessor aNewAccessor(aOwningSet.accessor(),pNewNode); - - this->rebuild(xNewBehavior,aNewAccessor,m_aOwnData.getAccessor()); - - m_aOwnData.clearData(); - OSL_ASSERT(!m_aOwnData.is()); - } -} -//----------------------------------------------------------------------------- - -/// tranfer ownership from the given set -void ElementTreeImpl::detachFrom(data::SetNodeAccess const & aOwningSet, Name const& aElementName) -{ - OSL_ENSURE(!m_aOwnData.is(),"ERROR: Cannot detach a already owned node from a subtree"); - if (!m_aOwnData.is()) - { - OSL_ENSURE(this->getSimpleRootName() == aElementName,"ElementTree: Detaching with unexpected element name"); - - TreeImpl* pOwningTree = this->getContextTree(); - OSL_ENSURE(pOwningTree, "Element Tree Context must still be set when detaching data"); - OSL_ENSURE( getUpdatableSegment(*pOwningTree) != NULL, "Cannot detach directly from old tree - no update access available"); - - rtl::Reference<view::ViewStrategy> xOldBehavior = pOwningTree->getViewBehavior(); - - ISubtree * pOwningNodeData = xOldBehavior->getDataForUpdate(aOwningSet); - OSL_ASSERT(pOwningNodeData); - - std::auto_ptr<INode> aOldNode = pOwningNodeData->removeChild(aElementName.toString()); - OSL_ENSURE(aOldNode.get(),"ERROR: Detached node not found in the given subtree"); - - // copy over to the new segment - std::auto_ptr<INode> aNewNode(aOldNode->clone()); - - data::TreeSegment aNewSegment = data::TreeSegment::createNew(aNewNode); - - this->takeTreeAndRebuild( aNewSegment, aOwningSet.accessor() ); - - OSL_ENSURE(m_aOwnData.is(),"ERROR: Could not create own data segment for detached node"); - } -} -//----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -#else // SHARABLE_DATA // ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- void ElementTreeImpl::attachTo(data::SetNodeAccess const & aOwningSet, Name const& aElementName) @@ -1067,7 +996,6 @@ void ElementTreeImpl::detachFrom(data::SetNodeAccess const & aOwningSet, Name co } //----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- -#endif // SHARABLE_DATA // ----------------------------------------------------------------------------- /// transfer ownership from the given owner diff --git a/configmgr/source/treemgr/viewstrategy.cxx b/configmgr/source/treemgr/viewstrategy.cxx index 65923919ec52..ee316b0fe406 100644 --- a/configmgr/source/treemgr/viewstrategy.cxx +++ b/configmgr/source/treemgr/viewstrategy.cxx @@ -2,9 +2,9 @@ * * $RCSfile: viewstrategy.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: hr $ $Date: 2002-02-19 13:20:52 $ + * last change: $Author: jb $ $Date: 2002-03-28 08:14:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -182,12 +182,10 @@ namespace configmgr data::SetNodeAddress::DataType * ViewStrategy::getDataForUpdate(data::SetNodeAccess const & _aNode) { typedef data::SetNodeAddress::DataType DataType; -#ifdef NON_SHARABLE_DATA - DataType * pResult = static_cast<DataType *>(implAccessForUpdate(_aNode)); -#else // SHARABLE_DATA + sharable::Node * pNode = implAccessForUpdate(_aNode); DataType * pResult = pNode ? pNode->setData() : 0; -#endif // SHARABLE_DATA + OSL_ASSERT(!pResult || &_aNode.data() == pResult); return pResult; } @@ -195,12 +193,10 @@ namespace configmgr data::GroupNodeAddress::DataType * ViewStrategy::getDataForUpdate(data::GroupNodeAccess const & _aNode) { typedef data::GroupNodeAddress::DataType DataType; -#ifdef NON_SHARABLE_DATA - DataType * pResult = static_cast<DataType *>(implAccessForUpdate(_aNode)); -#else // SHARABLE_DATA + sharable::Node * pNode = implAccessForUpdate(_aNode); DataType * pResult = pNode ? pNode->groupData() : 0; -#endif // SHARABLE_DATA + OSL_ASSERT(!pResult || &_aNode.data() == pResult); return pResult; } @@ -208,12 +204,10 @@ namespace configmgr data::ValueNodeAddress::DataType * ViewStrategy::getDataForUpdate(data::ValueNodeAccess const & _aNode) { typedef data::ValueNodeAddress::DataType DataType; -#ifdef NON_SHARABLE_DATA - DataType * pResult = static_cast<DataType *>(implAccessForUpdate(_aNode)); -#else // SHARABLE_DATA + sharable::Node * pNode = implAccessForUpdate(_aNode); DataType * pResult = pNode ? pNode->valueData() : 0; -#endif // SHARABLE_DATA + OSL_ASSERT(!pResult || &_aNode.data() == pResult); return pResult; } |