diff options
author | Jörg Barfurth <jb@openoffice.org> | 2001-02-13 16:16:59 +0000 |
---|---|---|
committer | Jörg Barfurth <jb@openoffice.org> | 2001-02-13 16:16:59 +0000 |
commit | 79e0c346e1cf5b9f6b6dc10d69128ac5cf767eb4 (patch) | |
tree | c082fb2f663f3b6e7472a7fda6d3f7557b6c5a6b /configmgr | |
parent | cf10bdcf3448436cbb8e0a012cf8c5e27f34b896 (diff) |
Changes from external notifications are now wrapped as NodeChangeInformation (instead of a full NodeChange)
Diffstat (limited to 'configmgr')
-rw-r--r-- | configmgr/source/api2/apitreeimplobj.cxx | 50 | ||||
-rw-r--r-- | configmgr/source/api2/apitreeimplobj.hxx | 6 | ||||
-rw-r--r-- | configmgr/source/inc/roottree.hxx | 10 | ||||
-rw-r--r-- | configmgr/source/treemgr/roottree.cxx | 12 | ||||
-rw-r--r-- | configmgr/source/treemgr/treeimpl.cxx | 12 | ||||
-rw-r--r-- | configmgr/source/treemgr/treeimpl.hxx | 21 |
6 files changed, 57 insertions, 54 deletions
diff --git a/configmgr/source/api2/apitreeimplobj.cxx b/configmgr/source/api2/apitreeimplobj.cxx index 97fad24ed102..53153815e464 100644 --- a/configmgr/source/api2/apitreeimplobj.cxx +++ b/configmgr/source/api2/apitreeimplobj.cxx @@ -2,9 +2,9 @@ * * $RCSfile: apitreeimplobj.cxx,v $ * - * $Revision: 1.23 $ + * $Revision: 1.24 $ * - * last change: $Author: jb $ $Date: 2000-12-13 13:50:36 $ + * last change: $Author: jb $ $Date: 2001-02-13 17:13:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,7 +65,7 @@ #include "notifierimpl.hxx" #include "apifactory.hxx" #include "apitreeaccess.hxx" -#include "nodechange.hxx" +//#include "nodechange.hxx" #include "nodechangeinfo.hxx" #include "broadcaster.hxx" #include "roottree.hxx" @@ -636,12 +636,13 @@ void ApiRootTreeImpl::disposing(IConfigBroadcaster* pSource) // --------------------------------------------------------------------------------------------------- static -void disposeOneRemovedNode(configuration::NodeChange const& , configuration::NodeChangeInfo const& aRemoveInfo, Factory& aFactory) +void disposeOneRemovedNode(configuration::NodeChangeInformation const& aRemoveInfo, Factory& aFactory) { - OSL_ENSURE(aRemoveInfo.oldElement.isValid(), "Cannot dispose removed/replaced element: No tree object available"); - if (aRemoveInfo.oldElement.isValid()) + OSL_ENSURE(aRemoveInfo.change.element.oldValue.isValid(), "Cannot dispose removed/replaced element: No tree object available"); + OSL_ENSURE(aRemoveInfo.change.element.isDataChange(), "ERROR: Dispose removed/replaced element: Element did not really change !"); + if (aRemoveInfo.change.element.oldValue.isValid()) { - configuration::ElementTree aElementTree( aRemoveInfo.oldElement.getBodyPtr() ); + configuration::ElementTree aElementTree( aRemoveInfo.change.element.oldValue.getBodyPtr() ); SetElement* pSetElement = aFactory.findSetElement(aElementTree ); if (pSetElement) @@ -657,28 +658,25 @@ void disposeOneRemovedNode(configuration::NodeChange const& , configuration::Nod // --------------------------------------------------------------------------------------------------- static -void disposeRemovedNodes(configuration::NodeChanges const& aChanges, Factory& aFactory) +void disposeRemovedNodes(configuration::NodeChangesInformation const& aChanges, Factory& aFactory) { - using configuration::NodeChange; - using configuration::NodeChangeInfo; - for (NodeChanges::Iterator it = aChanges.begin(); it != aChanges.end(); ++it) + using configuration::NodeChangeData; + using configuration::NodeChangesInformation; + for (NodeChangesInformation::Iterator it = aChanges.begin(); it != aChanges.end(); ++it) { - NodeChangeInfo aInfo; - if (it->getChangeInfo(aInfo)) + switch (it->change.type) { - switch (aInfo.type) - { - case NodeChangeInfo::eReplaceElement: - if (aInfo.oldElement == aInfo.newElement) break; + case NodeChangeData::eReplaceElement: + // check if element is actually unchanged ! + if (! it->change.element.isDataChange()) break; - // else dispose the old one: fall thru + // else dispose the old one: fall thru - case NodeChangeInfo::eRemoveElement: - disposeOneRemovedNode( *it, aInfo, aFactory ); - break; + case NodeChangeData::eRemoveElement: + disposeOneRemovedNode( *it, aFactory ); + break; - default: break; - } + default: break; } } } @@ -747,13 +745,13 @@ void ApiRootTreeImpl::nodeChanged(Change const& aChange, OUString const& sPath, configuration::TemplateProvider aProviderForNewSets = m_aTreeImpl.getProvider().getTemplateProvider(); - NodeChanges aChanges; + configuration::NodeChangesInformation aChanges; if (configuration::adjustToChanges(aChanges, aTree,aNode, aChange,aProviderForNewSets)) { - OSL_ASSERT(aChanges.getCount() > 0); + OSL_ASSERT(aChanges.size() > 0); - Broadcaster aSender(m_aTreeImpl.getNotifier().makeBroadcaster(aChanges,false)); + Broadcaster aSender(m_aTreeImpl.getNotifier(),aChanges,false); // Should be improved later. Maybe this is the wrong lock for disposeTree ? // aLocalGuard.downgrade(); // partial clear for broadcast diff --git a/configmgr/source/api2/apitreeimplobj.hxx b/configmgr/source/api2/apitreeimplobj.hxx index aa4c17abe19c..5dbba732c7c6 100644 --- a/configmgr/source/api2/apitreeimplobj.hxx +++ b/configmgr/source/api2/apitreeimplobj.hxx @@ -2,9 +2,9 @@ * * $RCSfile: apitreeimplobj.hxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: jb $ $Date: 2000-12-11 17:04:56 $ + * last change: $Author: jb $ $Date: 2001-02-13 17:13:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,7 +71,7 @@ #include <osl/mutex.hxx> #include <vos/ref.hxx> -#include <stl/memory> +#include <memory> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/lang/XComponent.hpp> diff --git a/configmgr/source/inc/roottree.hxx b/configmgr/source/inc/roottree.hxx index f25468ad3aee..bf67da81e8fb 100644 --- a/configmgr/source/inc/roottree.hxx +++ b/configmgr/source/inc/roottree.hxx @@ -2,9 +2,9 @@ * * $RCSfile: roottree.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: jb $ $Date: 2000-12-07 14:49:33 $ + * last change: $Author: jb $ $Date: 2001-02-13 17:09:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,6 +62,8 @@ #ifndef CONFIGMGR_ROOTTREE_HXX_ #define CONFIGMGR_ROOTTREE_HXX_ +#include <vector> + namespace configmgr { class ISubtree; @@ -74,7 +76,7 @@ namespace configmgr class Tree; typedef Tree RootTree; class TreeImpl; class NodeRef; - class NodeChanges; + class NodeChangesInformation; class AbsolutePath; class TemplateProvider; typedef unsigned int NodeOffset; @@ -122,7 +124,7 @@ namespace configmgr <TRUE/> if any changes occur in this tree (so rLocalChanges is not empty), <FALSE/> otherwise. */ - bool adjustToChanges( NodeChanges& rLocalChanges, + bool adjustToChanges( NodeChangesInformation& rLocalChanges, Tree const& aBaseTree, NodeRef const& aBaseNode, Change const& aExternalChange, TemplateProvider const& aTemplateProvider) ; diff --git a/configmgr/source/treemgr/roottree.cxx b/configmgr/source/treemgr/roottree.cxx index a5c878a6ab70..a0279aed9790 100644 --- a/configmgr/source/treemgr/roottree.cxx +++ b/configmgr/source/treemgr/roottree.cxx @@ -2,9 +2,9 @@ * * $RCSfile: roottree.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: jb $ $Date: 2000-12-07 14:49:31 $ + * last change: $Author: jb $ $Date: 2001-02-13 17:16:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -64,7 +64,7 @@ #include "roottreeimpl.hxx" #include "nodefactory.hxx" #include "noderef.hxx" -#include "nodechange.hxx" +#include "nodechangeinfo.hxx" #include "cmtreemodel.hxx" namespace configmgr @@ -99,7 +99,7 @@ RootTree createUpdatableTree( AbsolutePath const& aContextPath, //----------------------------------------------------------------------------- // update on notify method //----------------------------------------------------------------------------- -bool adjustToChanges( NodeChanges& rLocalChanges, +bool adjustToChanges( NodeChangesInformation& rLocalChanges, Tree const& aBaseTree, NodeRef const& aBaseNode, Change const& aExternalChange, TemplateProvider const& aTemplateProvider) @@ -109,11 +109,11 @@ bool adjustToChanges( NodeChanges& rLocalChanges, if (!aBaseTree.isEmpty()) { - OSL_ENSURE(rLocalChanges.getCount() == 0, "Should pass empty container to adjustToChanges(...)"); + OSL_ENSURE(rLocalChanges.empty(), "Should pass empty container to adjustToChanges(...)"); TreeImplHelper::impl(aBaseTree)->adjustToChanges(rLocalChanges, TreeImplHelper::offset(aBaseNode), aExternalChange,aTemplateProvider); - return rLocalChanges.getCount() != 0; + return !rLocalChanges.empty(); } else return false; diff --git a/configmgr/source/treemgr/treeimpl.cxx b/configmgr/source/treemgr/treeimpl.cxx index 0d9309bdf53e..aa864cf7f60d 100644 --- a/configmgr/source/treemgr/treeimpl.cxx +++ b/configmgr/source/treemgr/treeimpl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: treeimpl.cxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: jb $ $Date: 2000-12-07 14:48:18 $ + * last change: $Author: jb $ $Date: 2001-02-13 17:09:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -468,7 +468,7 @@ void TreeImpl::legacyFailedCommit(Change& rRootChange) } //----------------------------------------------------------------------------- -void TreeImpl::adjustToChanges(NodeChanges& rLocalChanges, Change const& aExternalChange, TemplateProvider const& aTemplateProvider) +void TreeImpl::adjustToChanges(NodeChangesInformation& rLocalChanges, Change const& aExternalChange, TemplateProvider const& aTemplateProvider) { OSL_PRECOND( name(root()).toString() == aExternalChange.getNodeName(), "Name of change does not match actual node" ); @@ -478,7 +478,7 @@ void TreeImpl::adjustToChanges(NodeChanges& rLocalChanges, Change const& aExtern } //----------------------------------------------------------------------------- -void TreeImpl::adjustToChanges(NodeChanges& rLocalChanges, NodeOffset nNode, Change const& aExternalChange, TemplateProvider const& aTemplateProvider) +void TreeImpl::adjustToChanges(NodeChangesInformation& rLocalChanges, NodeOffset nNode, Change const& aExternalChange, TemplateProvider const& aTemplateProvider) { OSL_PRECOND( isValidNode(nNode), "ERROR: Valid node required for adjusting to changes" ); OSL_PRECOND( name(nNode).toString() == aExternalChange.getNodeName(), "Name of change does not match actual node" ); @@ -641,7 +641,7 @@ void TreeImpl::doFailedCommit(Change& rChange, NodeOffset nNode) } //----------------------------------------------------------------------------- -void TreeImpl::doAdjustToChanges(NodeChanges& rLocalChanges, Change const& rChange, NodeOffset nNode, TemplateProvider const& aTemplateProvider, TreeDepth nDepth) +void TreeImpl::doAdjustToChanges(NodeChangesInformation& rLocalChanges, Change const& rChange, NodeOffset nNode, TemplateProvider const& aTemplateProvider, TreeDepth nDepth) { OSL_ASSERT(isValidNode(nNode)); Node* pNode = node(nNode); @@ -736,7 +736,7 @@ void TreeImpl::doFailedSubCommitted(SubtreeChange& aChangesParent, NodeOffset nP } //----------------------------------------------------------------------------- -void TreeImpl::doAdjustToSubChanges(NodeChanges& rLocalChanges, SubtreeChange const& aChangesParent, NodeOffset nParentNode, +void TreeImpl::doAdjustToSubChanges(NodeChangesInformation& rLocalChanges, SubtreeChange const& aChangesParent, NodeOffset nParentNode, TemplateProvider const& aTemplateProvider, TreeDepth nDepth) { for(SubtreeChange::ChildIterator diff --git a/configmgr/source/treemgr/treeimpl.hxx b/configmgr/source/treemgr/treeimpl.hxx index bbb58498169f..be8d11bd2c93 100644 --- a/configmgr/source/treemgr/treeimpl.hxx +++ b/configmgr/source/treemgr/treeimpl.hxx @@ -2,9 +2,9 @@ * * $RCSfile: treeimpl.hxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: jb $ $Date: 2000-12-14 08:22:28 $ + * last change: $Author: jb $ $Date: 2001-02-13 17:09:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -72,9 +72,9 @@ #include <vos/ref.hxx> #include <vos/refernce.hxx> -#include <stl/vector> -#include <stl/map> -#include <stl/memory> +#include <vector> +#include <map> +#include <memory> #include <osl/diagnose.h> namespace configmgr @@ -297,9 +297,9 @@ namespace configmgr void commitChanges(); void makeIndirect(bool bIndirect); // external update - void adjustToChanges(NodeChanges& rLocalChanges, Change const& aExternalChange, + void adjustToChanges(NodeChangesInformation& rLocalChanges, Change const& aExternalChange, TemplateProvider const& aTemplateProvider); - void adjustToChanges(NodeChanges& rLocalChanges, NodeOffset nNode, Change const& aExternalChange, + void adjustToChanges(NodeChangesInformation& rLocalChanges, NodeOffset nNode, Change const& aExternalChange, TemplateProvider const& aTemplateProvider); @@ -374,14 +374,14 @@ namespace configmgr void doFinishCommit(Change& rChange, NodeOffset nNode); void doRevertCommit(Change& rChange, NodeOffset nNode); void doFailedCommit(Change& rChange, NodeOffset nNode); - void doAdjustToChanges(NodeChanges& rLocalChanges, Change const& rChange, NodeOffset nNode, + void doAdjustToChanges(NodeChangesInformation& rLocalChanges, Change const& rChange, NodeOffset nNode, TemplateProvider const& aTemplateProvider, TreeDepth nDepth); void doCommitSubChanges(SubtreeChange& aChangesParent, NodeOffset nParentNode); void doFinishSubCommitted(SubtreeChange& aChangesParent, NodeOffset nParentNode); void doRevertSubCommitted(SubtreeChange& aChangesParent, NodeOffset nParentNode); void doFailedSubCommitted(SubtreeChange& aChangesParent, NodeOffset nParentNode); - void doAdjustToSubChanges(NodeChanges& rLocalChanges, SubtreeChange const& rChange, NodeOffset nParentNode, + void doAdjustToSubChanges(NodeChangesInformation& rLocalChanges, SubtreeChange const& rChange, NodeOffset nParentNode, TemplateProvider const& aTemplateProvider, TreeDepth nDepth); protected: /// set a new parent context for this tree @@ -555,6 +555,9 @@ namespace configmgr NodeRef makeNode(TreeImpl& rTree, NodeOffset nOffset); static + NodeRef makeNode(NodeID const& aNodeID); + + static bool isSet(NodeRef const& aNode); static |