1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_xmlsecurity.hxx"
31 #include "elementmark.hxx"
32 #include "elementcollector.hxx"
33 #include "buffernode.hxx"
34 #include <com/sun/star/xml/crypto/sax/ConstOfSecurityId.hpp>
36 namespace cssu
= com::sun::star::uno
;
37 namespace cssxw
= com::sun::star::xml::wrapper
;
38 namespace cssxc
= com::sun::star::xml::crypto
;
40 BufferNode::BufferNode( const cssu::Reference
< cssxw::XXMLElementWrapper
>& xXMLElement
)
43 m_bAllReceived(false),
44 m_xXMLElement(xXMLElement
)
48 bool BufferNode::isECOfBeforeModifyIncluded(sal_Int32 nIgnoredSecurityId
) const
49 /****** BufferNode/isECOfBeforeModifyIncluded ********************************
52 * isECOfBeforeModifyIncluded -- checks whether there is some
53 * ElementCollector on this BufferNode, that has BEFORE-MODIFY priority.
56 * bExist = isECOfBeforeModifyIncluded(nIgnoredSecurityId);
59 * checks each ElementCollector on this BufferNode, if all following
60 * conditions are satisfied, then returns true:
61 * 1. the ElementCollector's priority is BEFOREMODIFY;
62 * 2. the ElementCollector's securityId can't be ignored.
63 * otherwise, returns false.
66 * nIgnoredSecurityId - the security Id to be ignored. If it equals
67 * to UNDEFINEDSECURITYID, then no security Id
71 * bExist - true if a match found, false otherwise
74 * 05.01.2004 - implemented
78 * Email: michael.mi@sun.com
79 ******************************************************************************/
82 std::vector
< const ElementCollector
* >::const_iterator ii
= m_vElementCollectors
.begin();
84 for( ; ii
!= m_vElementCollectors
.end() ; ++ii
)
86 ElementCollector
* pElementCollector
= (ElementCollector
*)*ii
;
88 if ((nIgnoredSecurityId
== cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID
||
89 pElementCollector
->getSecurityId() != nIgnoredSecurityId
) &&
90 (pElementCollector
->getPriority() == cssxc::sax::ElementMarkPriority_BEFOREMODIFY
))
100 void BufferNode::setReceivedAll()
101 /****** BufferNode/setReceiveAll *********************************************
104 * setReceivedAll -- indicates that the element in this BufferNode has
105 * been compeletely bufferred.
111 * sets the all-received flag and launches ElementCollector's notify
121 * 05.01.2004 - implemented
125 * Email: michael.mi@sun.com
126 ******************************************************************************/
128 m_bAllReceived
= true;
129 elementCollectorNotify();
132 bool BufferNode::isAllReceived() const
134 return m_bAllReceived
;
137 void BufferNode::addElementCollector(const ElementCollector
* pElementCollector
)
138 /****** BufferNode/addElementCollector ***************************************
141 * addElementCollector -- adds a new ElementCollector to this BufferNode.
144 * addElementCollector(pElementCollector);
150 * pElementCollector - the ElementCollector to be added
156 * 05.01.2004 - implemented
160 * Email: michael.mi@sun.com
161 ******************************************************************************/
163 m_vElementCollectors
.push_back( pElementCollector
);
164 ((ElementCollector
*)pElementCollector
)->setBufferNode(this);
167 void BufferNode::removeElementCollector(const ElementCollector
* pElementCollector
)
168 /****** BufferNode/removeElementCollector ************************************
171 * removeElementCollector -- removes an ElementCollector from this
175 * removeElementCollector(pElementCollector);
181 * pElementCollector - the ElementCollector to be removed
187 * 05.01.2004 - implemented
191 * Email: michael.mi@sun.com
192 ******************************************************************************/
194 std::vector
< const ElementCollector
* >::iterator ii
= m_vElementCollectors
.begin();
196 for( ; ii
!= m_vElementCollectors
.end() ; ++ii
)
198 if( *ii
== pElementCollector
)
200 m_vElementCollectors
.erase( ii
);
201 ((ElementCollector
*)pElementCollector
)->setBufferNode(NULL
);
207 ElementMark
* BufferNode::getBlocker() const
212 void BufferNode::setBlocker(const ElementMark
* pBlocker
)
213 /****** BufferNode/setBlocker ************************************************
216 * setBlocker -- adds a blocker to this BufferNode.
219 * setBlocker(pBlocker);
225 * pBlocker - the new blocker to be attached
231 * Because there is only one blocker permited for a BufferNode, so the
232 * old blocker on this BufferNode, if there is one, will be overcasted.
235 * 05.01.2004 - implemented
239 * Email: michael.mi@sun.com
240 ******************************************************************************/
242 OSL_ASSERT(!(m_pBlocker
!= NULL
&& pBlocker
!= NULL
));
244 m_pBlocker
= (ElementMark
*)pBlocker
;
245 if (m_pBlocker
!= NULL
)
247 m_pBlocker
->setBufferNode(this);
251 rtl::OUString
BufferNode::printChildren() const
252 /****** BufferNode/printChildren *********************************************
255 * printChildren -- prints children information into a string.
258 * result = printChildren();
267 * result - the information string
270 * 05.01.2004 - implemented
274 * Email: michael.mi@sun.com
275 ******************************************************************************/
278 std::vector
< const ElementCollector
* >::const_iterator ii
= m_vElementCollectors
.begin();
280 for( ; ii
!= m_vElementCollectors
.end() ; ++ii
)
282 rc
+= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BufID=" ));
283 rc
+= rtl::OUString::valueOf((*ii
)->getBufferId());
285 if (((ElementCollector
*)(*ii
))->getModify())
287 rc
+= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "[M]" ));
290 rc
+= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ",Pri=" ));
292 switch (((ElementCollector
*)(*ii
))->getPriority())
294 case cssxc::sax::ElementMarkPriority_BEFOREMODIFY
:
295 rc
+= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BEFOREMODIFY" ));
297 case cssxc::sax::ElementMarkPriority_AFTERMODIFY
:
298 rc
+= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AFTERMODIFY" ));
301 rc
+= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UNKNOWN" ));
305 rc
+= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "(" ));
307 if (((ElementCollector*)(*ii))->isInternalNotificationSuppressed())
309 rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*IN-Suppressed* " ));
312 rc
+= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SecID=" ));
313 rc
+= rtl::OUString::valueOf(((ElementCollector
*)(*ii
))->getSecurityId());
314 rc
+= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ")" ));
315 rc
+= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ));
321 bool BufferNode::hasAnything() const
322 /****** BufferNode/hasAnything ***********************************************
325 * hasAnything -- checks whether there is any ElementCollector or blocker
326 * on this BufferNode.
329 * bExist = hasAnything();
338 * bExist - true if there is, false otherwise.
341 * 05.01.2004 - implemented
345 * Email: michael.mi@sun.com
346 ******************************************************************************/
348 return (m_pBlocker
!= NULL
|| m_vElementCollectors
.size() > 0);
351 bool BufferNode::hasChildren() const
352 /****** BufferNode/hasChildren ***********************************************
355 * hasChildren -- checks whether this BufferNode has any child
359 * bExist = hasChildren();
368 * bExist - true if there is, false otherwise.
371 * 05.01.2004 - implemented
375 * Email: michael.mi@sun.com
376 ******************************************************************************/
378 return (m_vChildren
.size() > 0);
381 std::vector
< const BufferNode
* >* BufferNode::getChildren() const
383 return new std::vector
< const BufferNode
* >( m_vChildren
);
386 const BufferNode
* BufferNode::getFirstChild() const
387 /****** BufferNode/getFirstChild *********************************************
390 * getFirstChild -- retrieves the first child BufferNode.
393 * child = getFirstChild();
402 * child - the first child BufferNode, or NULL if there is no child
406 * 05.01.2004 - implemented
410 * Email: michael.mi@sun.com
411 ******************************************************************************/
413 BufferNode
* rc
= NULL
;
415 if (m_vChildren
.size() > 0)
417 rc
= (BufferNode
*)m_vChildren
.front();
420 return (const BufferNode
*)rc
;
423 void BufferNode::addChild(const BufferNode
* pChild
, sal_Int32 nPosition
)
424 /****** BufferNode/addChild(pChild,nPosition) ********************************
427 * addChild -- inserts a child BufferNode at specific position.
430 * addChild(pChild, nPosition);
436 * pChild - the child BufferNode to be added.
437 * nPosition - the position where the new child locates.
443 * If the nPosition is -1, then the new child BufferNode is appended
447 * 05.01.2004 - implemented
451 * Email: michael.mi@sun.com
452 ******************************************************************************/
456 m_vChildren
.push_back( pChild
);
460 std::vector
< const BufferNode
* >::iterator ii
= m_vChildren
.begin();
462 m_vChildren
.insert(ii
, pChild
);
466 void BufferNode::addChild(const BufferNode
* pChild
)
467 /****** BufferNode/addChild() ************************************************
470 * addChild -- add a new child BufferNode.
479 * pChild - the child BufferNode to be added.
485 * The new child BufferNode is appended at the end.
488 * 05.01.2004 - implemented
492 * Email: michael.mi@sun.com
493 ******************************************************************************/
495 addChild(pChild
, -1);
498 void BufferNode::removeChild(const BufferNode
* pChild
)
499 /****** BufferNode/removeChild ***********************************************
502 * removeChild -- removes a child BufferNode from the children list.
505 * removeChild(pChild);
511 * pChild - the child BufferNode to be removed
517 * 05.01.2004 - implemented
521 * Email: michael.mi@sun.com
522 ******************************************************************************/
524 std::vector
< const BufferNode
* >::iterator ii
= m_vChildren
.begin();
526 for( ; ii
!= m_vChildren
.end() ; ++ii
)
530 m_vChildren
.erase( ii
);
536 sal_Int32
BufferNode::indexOfChild(const BufferNode
* pChild
) const
537 /****** BufferNode/indexOfChild **********************************************
540 * indexOfChild -- gets the index of a child BufferNode.
543 * index = indexOfChild(pChild);
549 * pChild - the child BufferNode whose index to be gotten
552 * index - the index of that child BufferNode. If that child BufferNode
553 * is not found, -1 is returned.
556 * 05.01.2004 - implemented
560 * Email: michael.mi@sun.com
561 ******************************************************************************/
563 sal_Int32 nIndex
= 0;
566 std::vector
< const BufferNode
* >::const_iterator ii
= m_vChildren
.begin();
568 for( ; ii
!= m_vChildren
.end() ; ++ii
)
586 const BufferNode
* BufferNode::childAt(sal_Int32 nIndex
) const
587 /****** BufferNode/childAt ***************************************************
590 * childAt -- retrieves the child BufferNode at specific possition.
593 * child = childAt(nIndex);
599 * nIndex - the index of the child BufferNode to be retrieved
602 * child - the child BufferNode at index position, or NULL if the index
603 * is out of the range of children.
606 * 05.01.2004 - implemented
610 * Email: michael.mi@sun.com
611 ******************************************************************************/
613 BufferNode
* rc
= NULL
;
615 if (nIndex
< ((sal_Int32
)m_vChildren
.size()) && nIndex
>= 0)
617 rc
= (BufferNode
*)m_vChildren
[nIndex
];
620 return (const BufferNode
*)rc
;
623 const BufferNode
* BufferNode::getParent() const
628 void BufferNode::setParent(const BufferNode
* pParent
)
630 m_pParent
= (BufferNode
*)pParent
;
633 const BufferNode
* BufferNode::getNextSibling() const
634 /****** BufferNode/getNextSibling ********************************************
637 * getNextSibling -- retrieves the next sibling BufferNode.
640 * sibling = getNextSibling();
649 * sibling - the next sibling BufferNode, or NULL if there is none.
652 * 05.01.2004 - implemented
656 * Email: michael.mi@sun.com
657 ******************************************************************************/
659 BufferNode
* rc
= NULL
;
661 if (m_pParent
!= NULL
)
663 rc
= (BufferNode
*)m_pParent
->getNextChild(this);
666 return (const BufferNode
*)rc
;
669 const BufferNode
* BufferNode::isAncestor(const BufferNode
* pDescendant
) const
670 /****** BufferNode/isAncestor ************************************************
673 * isAncestor -- checks whether this BufferNode is an ancestor of another
677 * bIs = isAncestor(pDescendant);
683 * pDescendant - the BufferNode to be checked as a descendant
686 * bIs - true if this BufferNode is an ancestor of the pDescendant,
690 * 05.01.2004 - implemented
694 * Email: michael.mi@sun.com
695 ******************************************************************************/
697 BufferNode
* rc
= NULL
;
699 if (pDescendant
!= NULL
)
701 std::vector
< const BufferNode
* >::const_iterator ii
= m_vChildren
.begin();
703 for( ; ii
!= m_vChildren
.end() ; ++ii
)
705 BufferNode
* pChild
= (BufferNode
*)*ii
;
707 if (pChild
== pDescendant
)
713 if (pChild
->isAncestor(pDescendant
) != NULL
)
721 return (const BufferNode
*)rc
;
724 bool BufferNode::isPrevious(const BufferNode
* pFollowing
) const
725 /****** BufferNode/isPrevious ************************************************
728 * isPrevious -- checks whether this BufferNode is ahead of another
729 * BufferNode in the tree order.
732 * bIs = isPrevious(pFollowing);
738 * pFollowing - the BufferNode to be checked as a following
741 * bIs - true if this BufferNode is ahead in the tree order, false
745 * 05.01.2004 - implemented
749 * Email: michael.mi@sun.com
750 ******************************************************************************/
754 BufferNode
* pNextBufferNode
= (BufferNode
*)getNextNodeByTreeOrder();
755 while (pNextBufferNode
!= NULL
)
757 if (pNextBufferNode
== pFollowing
)
763 pNextBufferNode
= (BufferNode
*)(pNextBufferNode
->getNextNodeByTreeOrder());
769 const BufferNode
* BufferNode::getNextNodeByTreeOrder() const
770 /****** BufferNode/getNextNodeByTreeOrder ************************************
773 * getNextNodeByTreeOrder -- retrieves the next BufferNode in the tree
777 * next = getNextNodeByTreeOrder();
786 * next - the BufferNode following this BufferNode in the tree order,
787 * or NULL if there is none.
790 * The "next" node in tree order is defined as:
791 * 1. If a node has children, then the first child is;
792 * 2. otherwise, if it has a following sibling, then this sibling node is;
793 * 3. otherwise, if it has a parent node, the the parent's next sibling
795 * 4. otherwise, no "next" node exists.
798 * 05.01.2004 - implemented
802 * Email: michael.mi@sun.com
803 ******************************************************************************/
806 * If this buffer node has m_vChildren, then return the first
811 return getFirstChild();
815 * Otherwise, it this buffer node has a following sibling,
816 * then return that sibling.
818 BufferNode
* pNextSibling
= (BufferNode
*)getNextSibling();
819 if (pNextSibling
!= NULL
)
825 * Otherwise, it this buffer node has parent, then return
826 * its parent's following sibling.
828 BufferNode
* pNode
= (BufferNode
*)this;
830 BufferNode
* pNextSiblingParent
= NULL
;
839 pParent
= (BufferNode
*)pNode
->getParent();
842 pNextSiblingParent
= (BufferNode
*)pParent
->getNextSibling();
846 }while (pNextSiblingParent
== NULL
);
848 return pNextSiblingParent
;
851 cssu::Reference
< cssxw::XXMLElementWrapper
> BufferNode::getXMLElement() const
853 return m_xXMLElement
;
856 void BufferNode::setXMLElement( const cssu::Reference
< cssxw::XXMLElementWrapper
>& xXMLElement
)
858 m_xXMLElement
= xXMLElement
;
861 void BufferNode::notifyBranch()
862 /****** BufferNode/notifyBranch **********************************************
865 * notifyBranch -- notifies each BufferNode in the branch of this
866 * BufferNode in the tree order.
881 * 05.01.2004 - implemented
885 * Email: michael.mi@sun.com
886 ******************************************************************************/
888 std::vector
< const BufferNode
* >::const_iterator ii
= m_vChildren
.begin();
890 for( ; ii
!= m_vChildren
.end() ; ++ii
)
892 BufferNode
* pBufferNode
= (BufferNode
*)*ii
;
893 pBufferNode
->elementCollectorNotify();
894 pBufferNode
->notifyBranch();
898 void BufferNode::notifyAncestor()
899 /****** BufferNode/notifyAncestor ********************************************
902 * notifyAncestor -- notifies each ancestor BufferNode through the parent
918 * 05.01.2004 - implemented
922 * Email: michael.mi@sun.com
923 ******************************************************************************/
925 BufferNode
* pParent
= m_pParent
;
926 while (pParent
!= NULL
)
928 pParent
->notifyAncestor();
929 pParent
= (BufferNode
*)pParent
->getParent();
933 void BufferNode::elementCollectorNotify()
934 /****** BufferNode/elementCollectorNotify ************************************
937 * elementCollectorNotify -- notifies this BufferNode.
940 * elementCollectorNotify();
943 * Notifies this BufferNode if the notification is not suppressed.
949 * child - the first child BufferNode, or NULL if there is no child
953 * 05.01.2004 - implemented
957 * Email: michael.mi@sun.com
958 ******************************************************************************/
960 if (m_vElementCollectors
.size()>0)
962 cssxc::sax::ElementMarkPriority nMaxPriority
= cssxc::sax::ElementMarkPriority_MINIMUM
;
963 cssxc::sax::ElementMarkPriority nPriority
;
966 * get the max priority among ElementCollectors on this BufferNode
968 std::vector
< const ElementCollector
* >::const_iterator ii
= m_vElementCollectors
.begin();
969 for( ; ii
!= m_vElementCollectors
.end() ; ++ii
)
971 ElementCollector
* pElementCollector
= (ElementCollector
*)*ii
;
972 nPriority
= pElementCollector
->getPriority();
973 if (nPriority
> nMaxPriority
)
975 nMaxPriority
= nPriority
;
979 std::vector
< const ElementCollector
* > vElementCollectors( m_vElementCollectors
);
980 ii
= vElementCollectors
.begin();
982 for( ; ii
!= vElementCollectors
.end() ; ++ii
)
984 ElementCollector
* pElementCollector
= (ElementCollector
*)*ii
;
985 nPriority
= pElementCollector
->getPriority();
986 bool bToModify
= pElementCollector
->getModify();
989 * Only ElementCollector with the max priority can
990 * perform notify operation.
991 * Moreover, if any blocker exists in the subtree of
992 * this BufferNode, this ElementCollector can't do notify
993 * unless its priority is BEFOREMODIFY.
995 if (nPriority
== nMaxPriority
&&
996 (nPriority
== cssxc::sax::ElementMarkPriority_BEFOREMODIFY
||
997 !isBlockerInSubTreeIncluded(pElementCollector
->getSecurityId())))
1000 * If this ElementCollector will modify the bufferred element, then
1001 * special attention must be paid.
1003 * If there is any ElementCollector in the subtree or any ancestor
1004 * ElementCollector with PRI_BEFPREMODIFY priority, this
1005 * ElementCollector can't perform notify operation, otherwise, it
1006 * will destroy the bufferred element, in turn, ElementCollectors
1007 * mentioned above can't perform their mission.
1009 //if (!(nMaxPriority == cssxc::sax::ElementMarkPriority_PRI_MODIFY &&
1011 (isECInSubTreeIncluded(pElementCollector
->getSecurityId()) ||
1012 isECOfBeforeModifyInAncestorIncluded(pElementCollector
->getSecurityId()))
1015 pElementCollector
->notifyListener();
1022 bool BufferNode::isECInSubTreeIncluded(sal_Int32 nIgnoredSecurityId
) const
1023 /****** BufferNode/isECInSubTreeIncluded *************************************
1026 * isECInSubTreeIncluded -- checks whether there is any ElementCollector
1027 * in the branch of this BufferNode.
1030 * bExist = isECInSubTreeIncluded(nIgnoredSecurityId);
1033 * checks each BufferNode in the branch of this BufferNode, if there is
1034 * an ElementCollector whose signatureId is not ignored, then return
1035 * true, otherwise, false returned.
1038 * nIgnoredSecurityId - the security Id to be ignored. If it equals
1039 * to UNDEFINEDSECURITYID, then no security Id
1043 * bExist - true if a match found, false otherwise.
1046 * 05.01.2004 - implemented
1050 * Email: michael.mi@sun.com
1051 ******************************************************************************/
1055 std::vector
< const ElementCollector
* >::const_iterator jj
= m_vElementCollectors
.begin();
1057 for( ; jj
!= m_vElementCollectors
.end() ; ++jj
)
1059 ElementCollector
* pElementCollector
= (ElementCollector
*)*jj
;
1060 if (nIgnoredSecurityId
== cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID
||
1061 pElementCollector
->getSecurityId() != nIgnoredSecurityId
)
1070 std::vector
< const BufferNode
* >::const_iterator ii
= m_vChildren
.begin();
1072 for( ; ii
!= m_vChildren
.end() ; ++ii
)
1074 BufferNode
* pBufferNode
= (BufferNode
*)*ii
;
1076 if ( pBufferNode
->isECInSubTreeIncluded(nIgnoredSecurityId
))
1087 bool BufferNode::isECOfBeforeModifyInAncestorIncluded(sal_Int32 nIgnoredSecurityId
) const
1088 /****** BufferNode/isECOfBeforeModifyInAncestorIncluded **********************
1091 * isECOfBeforeModifyInAncestorIncluded -- checks whether there is some
1092 * ancestor BufferNode which has ElementCollector with PRI_BEFPREMODIFY
1096 * bExist = isECOfBeforeModifyInAncestorIncluded(nIgnoredSecurityId);
1099 * checks each ancestor BufferNode through the parent link, if there is
1100 * an ElementCollector with PRI_BEFPREMODIFY priority and its
1101 * signatureId is not ignored, then return true, otherwise, false
1105 * nIgnoredSecurityId - the security Id to be ignored. If it equals
1106 * to UNDEFINEDSECURITYID, then no security Id
1110 * bExist - true if a match found, false otherwise.
1113 * 05.01.2004 - implemented
1117 * Email: michael.mi@sun.com
1118 ******************************************************************************/
1122 BufferNode
* pParentNode
= m_pParent
;
1123 while (pParentNode
!= NULL
)
1125 if (pParentNode
->isECOfBeforeModifyIncluded(nIgnoredSecurityId
))
1131 pParentNode
= (BufferNode
*)pParentNode
->getParent();
1137 bool BufferNode::isBlockerInSubTreeIncluded(sal_Int32 nIgnoredSecurityId
) const
1138 /****** BufferNode/isBlockerInSubTreeIncluded ********************************
1141 * isBlockerInSubTreeIncluded -- checks whether there is some BufferNode
1142 * which has blocker on it
1145 * bExist = isBlockerInSubTreeIncluded(nIgnoredSecurityId);
1148 * checks each BufferNode in the branch of this BufferNode, if one has
1149 * a blocker on it, and the blocker's securityId is not ignored, then
1150 * returns true; otherwise, false returns.
1153 * nIgnoredSecurityId - the security Id to be ignored. If it equals
1154 * to UNDEFINEDSECURITYID, then no security Id
1158 * bExist - true if a match found, false otherwise.
1161 * 05.01.2004 - implemented
1165 * Email: michael.mi@sun.com
1166 ******************************************************************************/
1170 std::vector
< const BufferNode
* >::const_iterator ii
= m_vChildren
.begin();
1172 for( ; ii
!= m_vChildren
.end() ; ++ii
)
1174 BufferNode
* pBufferNode
= (BufferNode
*)*ii
;
1175 ElementMark
* pBlocker
= pBufferNode
->getBlocker();
1177 if (pBlocker
!= NULL
&&
1178 (nIgnoredSecurityId
== cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID
||
1179 pBlocker
->getSecurityId() != nIgnoredSecurityId
))
1185 if (rc
|| pBufferNode
->isBlockerInSubTreeIncluded(nIgnoredSecurityId
))
1195 const BufferNode
* BufferNode::getNextChild(const BufferNode
* pChild
) const
1196 /****** BufferNode/getNextChild **********************************************
1199 * getNextChild -- get the next child BufferNode.
1202 * nextChild = getNextChild();
1208 * pChild - the child BufferNode whose next node is retrieved.
1211 * nextChild - the next child BufferNode after the pChild, or NULL if
1215 * 05.01.2004 - implemented
1219 * Email: michael.mi@sun.com
1220 ******************************************************************************/
1222 BufferNode
* rc
= NULL
;
1223 bool bChildFound
= false;
1225 std::vector
< const BufferNode
* >::const_iterator ii
= m_vChildren
.begin();
1226 for( ; ii
!= m_vChildren
.end() ; ++ii
)
1230 rc
= (BufferNode
*)*ii
;
1240 return (const BufferNode
*)rc
;
1244 void BufferNode::freeAllChildren()
1245 /****** BufferNode/freeAllChildren *******************************************
1248 * freeAllChildren -- free all his child BufferNode.
1251 * freeAllChildren();
1263 * 30.03.2004 - the correct the memory leak bug
1267 * Email: michael.mi@sun.com
1268 ******************************************************************************/
1270 std::vector
< const BufferNode
* >::const_iterator ii
= m_vChildren
.begin();
1271 for( ; ii
!= m_vChildren
.end() ; ++ii
)
1273 BufferNode
*pChild
= (BufferNode
*)(*ii
);
1274 pChild
->freeAllChildren();
1278 m_vChildren
.clear();