2001-01-17 14:02:34 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* $RCSfile: mergechange.hxx,v $
|
|
|
|
*
|
2001-07-16 16:00:31 +00:00
|
|
|
* $Revision: 1.3 $
|
2001-01-17 14:02:34 +00:00
|
|
|
*
|
2001-07-16 16:00:31 +00:00
|
|
|
* last change: $Author: jb $ $Date: 2001-07-16 17:00:30 $
|
2001-01-17 14:02:34 +00:00
|
|
|
*
|
|
|
|
* The Contents of this file are made available subject to the terms of
|
|
|
|
* either of the following licenses
|
|
|
|
*
|
|
|
|
* - GNU Lesser General Public License Version 2.1
|
|
|
|
* - Sun Industry Standards Source License Version 1.1
|
|
|
|
*
|
|
|
|
* Sun Microsystems Inc., October, 2000
|
|
|
|
*
|
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2000 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Sun Industry Standards Source License Version 1.1
|
|
|
|
* =================================================
|
|
|
|
* The contents of this file are subject to the Sun Industry Standards
|
|
|
|
* Source License Version 1.1 (the "License"); You may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of the
|
|
|
|
* License at http://www.openoffice.org/license.html.
|
|
|
|
*
|
|
|
|
* Software provided under this License is provided on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
|
|
|
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
|
|
|
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
|
|
|
* See the License for the specific provisions governing your rights and
|
|
|
|
* obligations concerning the Software.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* Copyright: 2000 by Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): _______________________________________
|
|
|
|
*
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2001-07-05 16:05:51 +00:00
|
|
|
#ifndef INCLUDED_CONFIGMGR_MERGECHANGE_HXX
|
|
|
|
#define INCLUDED_CONFIGMGR_MERGECHANGE_HXX
|
|
|
|
|
|
|
|
#ifndef INCLUDED_CONFIGMGR_NAMECREATOR_HXX
|
|
|
|
#include "namecreator.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef CONFIGMGR_CHANGE_HXX
|
2001-01-17 14:02:34 +00:00
|
|
|
#include "change.hxx"
|
2001-07-05 16:05:51 +00:00
|
|
|
#endif
|
|
|
|
#ifndef CONFIGMGR_TREECHANGELIST_HXX
|
|
|
|
#include "treechangelist.hxx"
|
|
|
|
#endif
|
2001-01-17 14:02:34 +00:00
|
|
|
|
|
|
|
namespace configmgr
|
|
|
|
{
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2001-07-05 16:05:51 +00:00
|
|
|
class OMergeTreeChangeList : private ChangeTreeAction, private OPathCreator<AbsolutePath>
|
2001-01-17 14:02:34 +00:00
|
|
|
{
|
|
|
|
TreeChangeList &m_aTreeChangeList; // ChangeList, which will be grown
|
|
|
|
SubtreeChange *m_pCurrentParent; // our current position
|
|
|
|
|
|
|
|
// ------- Helper for Path stack -------
|
2001-07-05 16:05:51 +00:00
|
|
|
SubtreeChange* pushTree(SubtreeChange& _rTree);
|
|
|
|
void popTree(SubtreeChange* _pSaveTree);
|
2001-01-17 14:02:34 +00:00
|
|
|
public:
|
|
|
|
// CTor
|
|
|
|
OMergeTreeChangeList(TreeChangeList& _aTree);
|
|
|
|
|
|
|
|
// start function, with the Change we want to do.
|
|
|
|
// WARNING this could be a big tree, because a change can contain subtreechanges!
|
2001-07-05 16:05:51 +00:00
|
|
|
void mergeChanges(TreeChangeList const&_rList);
|
2001-01-17 14:02:34 +00:00
|
|
|
|
2001-07-05 16:05:51 +00:00
|
|
|
private:
|
|
|
|
void initRoot(TreeChangeList const& _aChanges);
|
2001-01-17 14:02:34 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
virtual void handle(ValueChange const& _rValueNode);
|
|
|
|
virtual void handle(AddNode const& _rAddNode);
|
|
|
|
virtual void handle(RemoveNode const& _rRemoveNode);
|
|
|
|
virtual void handle(SubtreeChange const& _rSubtree);
|
|
|
|
};
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
2001-07-05 16:05:51 +00:00
|
|
|
class OMergeChanges : private ChangeTreeAction, private OPathCreator<RelativePath>
|
2001-01-17 14:02:34 +00:00
|
|
|
{
|
2001-07-05 16:05:51 +00:00
|
|
|
SubtreeChange &m_rSubtreeChange; // ChangeList, which will be grown
|
2001-01-17 14:02:34 +00:00
|
|
|
SubtreeChange *m_pCurrentParent; // our current position
|
|
|
|
|
2001-07-05 16:05:51 +00:00
|
|
|
typedef configuration::RelativePath RelativePath;
|
2001-01-17 14:02:34 +00:00
|
|
|
// ------- Helper for Path stack -------
|
2001-07-05 16:05:51 +00:00
|
|
|
SubtreeChange* pushTree(SubtreeChange& _rTree);
|
|
|
|
void popTree(SubtreeChange* _pSaveTree);
|
2001-01-17 14:02:34 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
// CTor
|
2001-07-05 16:05:51 +00:00
|
|
|
OMergeChanges(SubtreeChange& _rTree);
|
2001-01-17 14:02:34 +00:00
|
|
|
|
|
|
|
// start function, with the Change we want to do.
|
|
|
|
// WARNING this could be a big tree, because a change can contain subtreechanges!
|
2001-07-05 16:05:51 +00:00
|
|
|
void mergeChanges(const SubtreeChange &_rChange, const RelativePath& _aPathToChange);
|
|
|
|
void mergeChanges(const SubtreeChange &_rChange);
|
2001-01-17 14:02:34 +00:00
|
|
|
|
2001-07-05 16:05:51 +00:00
|
|
|
private:
|
2001-07-16 16:00:31 +00:00
|
|
|
void initRoot(const SubtreeChange &_rRootChange, const RelativePath& _aPathToChange);
|
2001-01-17 14:02:34 +00:00
|
|
|
private:
|
|
|
|
virtual void handle(ValueChange const& _rValueNode);
|
|
|
|
virtual void handle(AddNode const& _rAddNode);
|
|
|
|
virtual void handle(RemoveNode const& _rRemoveNode);
|
|
|
|
virtual void handle(SubtreeChange const& _rSubtree);
|
|
|
|
|
|
|
|
};
|
|
|
|
} // namespace configmgr
|
2001-07-05 16:05:51 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|