1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: buffernode.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmlsecurity.hxx"
34 #include "elementmark.hxx"
35 #include "elementcollector.hxx"
36 #include "buffernode.hxx"
37 #include <com/sun/star/xml/crypto/sax/ConstOfSecurityId.hpp>
39 namespace cssu
= com::sun::star::uno
;
40 namespace cssxw
= com::sun::star::xml::wrapper
;
41 namespace cssxc
= com::sun::star::xml::crypto
;
43 BufferNode::BufferNode( const cssu::Reference
< cssxw::XXMLElementWrapper
>& xXMLElement
)
46 m_bAllReceived(false),
47 m_xXMLElement(xXMLElement
)
51 bool BufferNode::isECOfBeforeModifyIncluded(sal_Int32 nIgnoredSecurityId
) const
52 /****** BufferNode/isECOfBeforeModifyIncluded ********************************
55 * isECOfBeforeModifyIncluded -- checks whether there is some
56 * ElementCollector on this BufferNode, that has BEFORE-MODIFY priority.
59 * bExist = isECOfBeforeModifyIncluded(nIgnoredSecurityId);
62 * checks each ElementCollector on this BufferNode, if all following
63 * conditions are satisfied, then returns true:
64 * 1. the ElementCollector's priority is BEFOREMODIFY;
65 * 2. the ElementCollector's securityId can't be ignored.
66 * otherwise, returns false.
69 * nIgnoredSecurityId - the security Id to be ignored. If it equals
70 * to UNDEFINEDSECURITYID, then no security Id
74 * bExist - true if a match found, false otherwise
77 * 05.01.2004 - implemented
81 * Email: michael.mi@sun.com
82 ******************************************************************************/
85 std::vector
< const ElementCollector
* >::const_iterator ii
= m_vElementCollectors
.begin();
87 for( ; ii
!= m_vElementCollectors
.end() ; ++ii
)
89 ElementCollector
* pElementCollector
= (ElementCollector
*)*ii
;
91 if ((nIgnoredSecurityId
== cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID
||
92 pElementCollector
->getSecurityId() != nIgnoredSecurityId
) &&
93 (pElementCollector
->getPriority() == cssxc::sax::ElementMarkPriority_BEFOREMODIFY
))
103 void BufferNode::setReceivedAll()
104 /****** BufferNode/setReceiveAll *********************************************
107 * setReceivedAll -- indicates that the element in this BufferNode has
108 * been compeletely bufferred.
114 * sets the all-received flag and launches ElementCollector's notify
124 * 05.01.2004 - implemented
128 * Email: michael.mi@sun.com
129 ******************************************************************************/
131 m_bAllReceived
= true;
132 elementCollectorNotify();
135 bool BufferNode::isAllReceived() const
137 return m_bAllReceived
;
140 void BufferNode::addElementCollector(const ElementCollector
* pElementCollector
)
141 /****** BufferNode/addElementCollector ***************************************
144 * addElementCollector -- adds a new ElementCollector to this BufferNode.
147 * addElementCollector(pElementCollector);
153 * pElementCollector - the ElementCollector to be added
159 * 05.01.2004 - implemented
163 * Email: michael.mi@sun.com
164 ******************************************************************************/
166 m_vElementCollectors
.push_back( pElementCollector
);
167 ((ElementCollector
*)pElementCollector
)->setBufferNode(this);
170 void BufferNode::removeElementCollector(const ElementCollector
* pElementCollector
)
171 /****** BufferNode/removeElementCollector ************************************
174 * removeElementCollector -- removes an ElementCollector from this
178 * removeElementCollector(pElementCollector);
184 * pElementCollector - the ElementCollector to be removed
190 * 05.01.2004 - implemented
194 * Email: michael.mi@sun.com
195 ******************************************************************************/
197 std::vector
< const ElementCollector
* >::iterator ii
= m_vElementCollectors
.begin();
199 for( ; ii
!= m_vElementCollectors
.end() ; ++ii
)
201 if( *ii
== pElementCollector
)
203 m_vElementCollectors
.erase( ii
);
204 ((ElementCollector
*)pElementCollector
)->setBufferNode(NULL
);
210 ElementMark
* BufferNode::getBlocker() const
215 void BufferNode::setBlocker(const ElementMark
* pBlocker
)
216 /****** BufferNode/setBlocker ************************************************
219 * setBlocker -- adds a blocker to this BufferNode.
222 * setBlocker(pBlocker);
228 * pBlocker - the new blocker to be attached
234 * Because there is only one blocker permited for a BufferNode, so the
235 * old blocker on this BufferNode, if there is one, will be overcasted.
238 * 05.01.2004 - implemented
242 * Email: michael.mi@sun.com
243 ******************************************************************************/
245 OSL_ASSERT(!(m_pBlocker
!= NULL
&& pBlocker
!= NULL
));
247 m_pBlocker
= (ElementMark
*)pBlocker
;
248 if (m_pBlocker
!= NULL
)
250 m_pBlocker
->setBufferNode(this);
254 rtl::OUString
BufferNode::printChildren() const
255 /****** BufferNode/printChildren *********************************************
258 * printChildren -- prints children information into a string.
261 * result = printChildren();
270 * result - the information string
273 * 05.01.2004 - implemented
277 * Email: michael.mi@sun.com
278 ******************************************************************************/
281 std::vector
< const ElementCollector
* >::const_iterator ii
= m_vElementCollectors
.begin();
283 for( ; ii
!= m_vElementCollectors
.end() ; ++ii
)
285 rc
+= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BufID=" ));
286 rc
+= rtl::OUString::valueOf((*ii
)->getBufferId());
288 if (((ElementCollector
*)(*ii
))->getModify())
290 rc
+= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "[M]" ));
293 rc
+= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ",Pri=" ));
295 switch (((ElementCollector
*)(*ii
))->getPriority())
297 case cssxc::sax::ElementMarkPriority_BEFOREMODIFY
:
298 rc
+= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BEFOREMODIFY" ));
300 case cssxc::sax::ElementMarkPriority_AFTERMODIFY
:
301 rc
+= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AFTERMODIFY" ));
304 rc
+= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UNKNOWN" ));
308 rc
+= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "(" ));
310 if (((ElementCollector*)(*ii))->isInternalNotificationSuppressed())
312 rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*IN-Suppressed* " ));
315 rc
+= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SecID=" ));
316 rc
+= rtl::OUString::valueOf(((ElementCollector
*)(*ii
))->getSecurityId());
317 rc
+= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ")" ));
318 rc
+= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ));
324 bool BufferNode::hasAnything() const
325 /****** BufferNode/hasAnything ***********************************************
328 * hasAnything -- checks whether there is any ElementCollector or blocker
329 * on this BufferNode.
332 * bExist = hasAnything();
341 * bExist - true if there is, false otherwise.
344 * 05.01.2004 - implemented
348 * Email: michael.mi@sun.com
349 ******************************************************************************/
351 return (m_pBlocker
!= NULL
|| m_vElementCollectors
.size() > 0);
354 bool BufferNode::hasChildren() const
355 /****** BufferNode/hasChildren ***********************************************
358 * hasChildren -- checks whether this BufferNode has any child
362 * bExist = hasChildren();
371 * bExist - true if there is, false otherwise.
374 * 05.01.2004 - implemented
378 * Email: michael.mi@sun.com
379 ******************************************************************************/
381 return (m_vChildren
.size() > 0);
384 std::vector
< const BufferNode
* >* BufferNode::getChildren() const
386 return new std::vector
< const BufferNode
* >( m_vChildren
);
389 const BufferNode
* BufferNode::getFirstChild() const
390 /****** BufferNode/getFirstChild *********************************************
393 * getFirstChild -- retrieves the first child BufferNode.
396 * child = getFirstChild();
405 * child - the first child BufferNode, or NULL if there is no child
409 * 05.01.2004 - implemented
413 * Email: michael.mi@sun.com
414 ******************************************************************************/
416 BufferNode
* rc
= NULL
;
418 if (m_vChildren
.size() > 0)
420 rc
= (BufferNode
*)m_vChildren
.front();
423 return (const BufferNode
*)rc
;
426 void BufferNode::addChild(const BufferNode
* pChild
, sal_Int32 nPosition
)
427 /****** BufferNode/addChild(pChild,nPosition) ********************************
430 * addChild -- inserts a child BufferNode at specific position.
433 * addChild(pChild, nPosition);
439 * pChild - the child BufferNode to be added.
440 * nPosition - the position where the new child locates.
446 * If the nPosition is -1, then the new child BufferNode is appended
450 * 05.01.2004 - implemented
454 * Email: michael.mi@sun.com
455 ******************************************************************************/
459 m_vChildren
.push_back( pChild
);
463 std::vector
< const BufferNode
* >::iterator ii
= m_vChildren
.begin();
465 m_vChildren
.insert(ii
, pChild
);
469 void BufferNode::addChild(const BufferNode
* pChild
)
470 /****** BufferNode/addChild() ************************************************
473 * addChild -- add a new child BufferNode.
482 * pChild - the child BufferNode to be added.
488 * The new child BufferNode is appended at the end.
491 * 05.01.2004 - implemented
495 * Email: michael.mi@sun.com
496 ******************************************************************************/
498 addChild(pChild
, -1);
501 void BufferNode::removeChild(const BufferNode
* pChild
)
502 /****** BufferNode/removeChild ***********************************************
505 * removeChild -- removes a child BufferNode from the children list.
508 * removeChild(pChild);
514 * pChild - the child BufferNode to be removed
520 * 05.01.2004 - implemented
524 * Email: michael.mi@sun.com
525 ******************************************************************************/
527 std::vector
< const BufferNode
* >::iterator ii
= m_vChildren
.begin();
529 for( ; ii
!= m_vChildren
.end() ; ++ii
)
533 m_vChildren
.erase( ii
);
539 sal_Int32
BufferNode::indexOfChild(const BufferNode
* pChild
) const
540 /****** BufferNode/indexOfChild **********************************************
543 * indexOfChild -- gets the index of a child BufferNode.
546 * index = indexOfChild(pChild);
552 * pChild - the child BufferNode whose index to be gotten
555 * index - the index of that child BufferNode. If that child BufferNode
556 * is not found, -1 is returned.
559 * 05.01.2004 - implemented
563 * Email: michael.mi@sun.com
564 ******************************************************************************/
566 sal_Int32 nIndex
= 0;
569 std::vector
< const BufferNode
* >::const_iterator ii
= m_vChildren
.begin();
571 for( ; ii
!= m_vChildren
.end() ; ++ii
)
589 const BufferNode
* BufferNode::childAt(sal_Int32 nIndex
) const
590 /****** BufferNode/childAt ***************************************************
593 * childAt -- retrieves the child BufferNode at specific possition.
596 * child = childAt(nIndex);
602 * nIndex - the index of the child BufferNode to be retrieved
605 * child - the child BufferNode at index position, or NULL if the index
606 * is out of the range of children.
609 * 05.01.2004 - implemented
613 * Email: michael.mi@sun.com
614 ******************************************************************************/
616 BufferNode
* rc
= NULL
;
618 if (nIndex
< ((sal_Int32
)m_vChildren
.size()) && nIndex
>= 0)
620 rc
= (BufferNode
*)m_vChildren
[nIndex
];
623 return (const BufferNode
*)rc
;
626 const BufferNode
* BufferNode::getParent() const
631 void BufferNode::setParent(const BufferNode
* pParent
)
633 m_pParent
= (BufferNode
*)pParent
;
636 const BufferNode
* BufferNode::getNextSibling() const
637 /****** BufferNode/getNextSibling ********************************************
640 * getNextSibling -- retrieves the next sibling BufferNode.
643 * sibling = getNextSibling();
652 * sibling - the next sibling BufferNode, or NULL if there is none.
655 * 05.01.2004 - implemented
659 * Email: michael.mi@sun.com
660 ******************************************************************************/
662 BufferNode
* rc
= NULL
;
664 if (m_pParent
!= NULL
)
666 rc
= (BufferNode
*)m_pParent
->getNextChild(this);
669 return (const BufferNode
*)rc
;
672 const BufferNode
* BufferNode::isAncestor(const BufferNode
* pDescendant
) const
673 /****** BufferNode/isAncestor ************************************************
676 * isAncestor -- checks whether this BufferNode is an ancestor of another
680 * bIs = isAncestor(pDescendant);
686 * pDescendant - the BufferNode to be checked as a descendant
689 * bIs - true if this BufferNode is an ancestor of the pDescendant,
693 * 05.01.2004 - implemented
697 * Email: michael.mi@sun.com
698 ******************************************************************************/
700 BufferNode
* rc
= NULL
;
702 if (pDescendant
!= NULL
)
704 std::vector
< const BufferNode
* >::const_iterator ii
= m_vChildren
.begin();
706 for( ; ii
!= m_vChildren
.end() ; ++ii
)
708 BufferNode
* pChild
= (BufferNode
*)*ii
;
710 if (pChild
== pDescendant
)
716 if (pChild
->isAncestor(pDescendant
) != NULL
)
724 return (const BufferNode
*)rc
;
727 bool BufferNode::isPrevious(const BufferNode
* pFollowing
) const
728 /****** BufferNode/isPrevious ************************************************
731 * isPrevious -- checks whether this BufferNode is ahead of another
732 * BufferNode in the tree order.
735 * bIs = isPrevious(pFollowing);
741 * pFollowing - the BufferNode to be checked as a following
744 * bIs - true if this BufferNode is ahead in the tree order, false
748 * 05.01.2004 - implemented
752 * Email: michael.mi@sun.com
753 ******************************************************************************/
757 BufferNode
* pNextBufferNode
= (BufferNode
*)getNextNodeByTreeOrder();
758 while (pNextBufferNode
!= NULL
)
760 if (pNextBufferNode
== pFollowing
)
766 pNextBufferNode
= (BufferNode
*)(pNextBufferNode
->getNextNodeByTreeOrder());
772 const BufferNode
* BufferNode::getNextNodeByTreeOrder() const
773 /****** BufferNode/getNextNodeByTreeOrder ************************************
776 * getNextNodeByTreeOrder -- retrieves the next BufferNode in the tree
780 * next = getNextNodeByTreeOrder();
789 * next - the BufferNode following this BufferNode in the tree order,
790 * or NULL if there is none.
793 * The "next" node in tree order is defined as:
794 * 1. If a node has children, then the first child is;
795 * 2. otherwise, if it has a following sibling, then this sibling node is;
796 * 3. otherwise, if it has a parent node, the the parent's next sibling
798 * 4. otherwise, no "next" node exists.
801 * 05.01.2004 - implemented
805 * Email: michael.mi@sun.com
806 ******************************************************************************/
809 * If this buffer node has m_vChildren, then return the first
814 return getFirstChild();
818 * Otherwise, it this buffer node has a following sibling,
819 * then return that sibling.
821 BufferNode
* pNextSibling
= (BufferNode
*)getNextSibling();
822 if (pNextSibling
!= NULL
)
828 * Otherwise, it this buffer node has parent, then return
829 * its parent's following sibling.
831 BufferNode
* pNode
= (BufferNode
*)this;
833 BufferNode
* pNextSiblingParent
= NULL
;
842 pParent
= (BufferNode
*)pNode
->getParent();
845 pNextSiblingParent
= (BufferNode
*)pParent
->getNextSibling();
849 }while (pNextSiblingParent
== NULL
);
851 return pNextSiblingParent
;
854 cssu::Reference
< cssxw::XXMLElementWrapper
> BufferNode::getXMLElement() const
856 return m_xXMLElement
;
859 void BufferNode::setXMLElement( const cssu::Reference
< cssxw::XXMLElementWrapper
>& xXMLElement
)
861 m_xXMLElement
= xXMLElement
;
864 void BufferNode::notifyBranch()
865 /****** BufferNode/notifyBranch **********************************************
868 * notifyBranch -- notifies each BufferNode in the branch of this
869 * BufferNode in the tree order.
884 * 05.01.2004 - implemented
888 * Email: michael.mi@sun.com
889 ******************************************************************************/
891 std::vector
< const BufferNode
* >::const_iterator ii
= m_vChildren
.begin();
893 for( ; ii
!= m_vChildren
.end() ; ++ii
)
895 BufferNode
* pBufferNode
= (BufferNode
*)*ii
;
896 pBufferNode
->elementCollectorNotify();
897 pBufferNode
->notifyBranch();
901 void BufferNode::notifyAncestor()
902 /****** BufferNode/notifyAncestor ********************************************
905 * notifyAncestor -- notifies each ancestor BufferNode through the parent
921 * 05.01.2004 - implemented
925 * Email: michael.mi@sun.com
926 ******************************************************************************/
928 BufferNode
* pParent
= m_pParent
;
929 while (pParent
!= NULL
)
931 pParent
->notifyAncestor();
932 pParent
= (BufferNode
*)pParent
->getParent();
936 void BufferNode::elementCollectorNotify()
937 /****** BufferNode/elementCollectorNotify ************************************
940 * elementCollectorNotify -- notifies this BufferNode.
943 * elementCollectorNotify();
946 * Notifies this BufferNode if the notification is not suppressed.
952 * child - the first child BufferNode, or NULL if there is no child
956 * 05.01.2004 - implemented
960 * Email: michael.mi@sun.com
961 ******************************************************************************/
963 if (m_vElementCollectors
.size()>0)
965 cssxc::sax::ElementMarkPriority nMaxPriority
= cssxc::sax::ElementMarkPriority_MINIMUM
;
966 cssxc::sax::ElementMarkPriority nPriority
;
969 * get the max priority among ElementCollectors on this BufferNode
971 std::vector
< const ElementCollector
* >::const_iterator ii
= m_vElementCollectors
.begin();
972 for( ; ii
!= m_vElementCollectors
.end() ; ++ii
)
974 ElementCollector
* pElementCollector
= (ElementCollector
*)*ii
;
975 nPriority
= pElementCollector
->getPriority();
976 if (nPriority
> nMaxPriority
)
978 nMaxPriority
= nPriority
;
982 std::vector
< const ElementCollector
* > vElementCollectors( m_vElementCollectors
);
983 ii
= vElementCollectors
.begin();
985 for( ; ii
!= vElementCollectors
.end() ; ++ii
)
987 ElementCollector
* pElementCollector
= (ElementCollector
*)*ii
;
988 nPriority
= pElementCollector
->getPriority();
989 bool bToModify
= pElementCollector
->getModify();
992 * Only ElementCollector with the max priority can
993 * perform notify operation.
994 * Moreover, if any blocker exists in the subtree of
995 * this BufferNode, this ElementCollector can't do notify
996 * unless its priority is BEFOREMODIFY.
998 if (nPriority
== nMaxPriority
&&
999 (nPriority
== cssxc::sax::ElementMarkPriority_BEFOREMODIFY
||
1000 !isBlockerInSubTreeIncluded(pElementCollector
->getSecurityId())))
1003 * If this ElementCollector will modify the bufferred element, then
1004 * special attention must be paid.
1006 * If there is any ElementCollector in the subtree or any ancestor
1007 * ElementCollector with PRI_BEFPREMODIFY priority, this
1008 * ElementCollector can't perform notify operation, otherwise, it
1009 * will destroy the bufferred element, in turn, ElementCollectors
1010 * mentioned above can't perform their mission.
1012 //if (!(nMaxPriority == cssxc::sax::ElementMarkPriority_PRI_MODIFY &&
1014 (isECInSubTreeIncluded(pElementCollector
->getSecurityId()) ||
1015 isECOfBeforeModifyInAncestorIncluded(pElementCollector
->getSecurityId()))
1018 pElementCollector
->notifyListener();
1025 bool BufferNode::isECInSubTreeIncluded(sal_Int32 nIgnoredSecurityId
) const
1026 /****** BufferNode/isECInSubTreeIncluded *************************************
1029 * isECInSubTreeIncluded -- checks whether there is any ElementCollector
1030 * in the branch of this BufferNode.
1033 * bExist = isECInSubTreeIncluded(nIgnoredSecurityId);
1036 * checks each BufferNode in the branch of this BufferNode, if there is
1037 * an ElementCollector whose signatureId is not ignored, then return
1038 * true, otherwise, false returned.
1041 * nIgnoredSecurityId - the security Id to be ignored. If it equals
1042 * to UNDEFINEDSECURITYID, then no security Id
1046 * bExist - true if a match found, false otherwise.
1049 * 05.01.2004 - implemented
1053 * Email: michael.mi@sun.com
1054 ******************************************************************************/
1058 std::vector
< const ElementCollector
* >::const_iterator jj
= m_vElementCollectors
.begin();
1060 for( ; jj
!= m_vElementCollectors
.end() ; ++jj
)
1062 ElementCollector
* pElementCollector
= (ElementCollector
*)*jj
;
1063 if (nIgnoredSecurityId
== cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID
||
1064 pElementCollector
->getSecurityId() != nIgnoredSecurityId
)
1073 std::vector
< const BufferNode
* >::const_iterator ii
= m_vChildren
.begin();
1075 for( ; ii
!= m_vChildren
.end() ; ++ii
)
1077 BufferNode
* pBufferNode
= (BufferNode
*)*ii
;
1079 if ( pBufferNode
->isECInSubTreeIncluded(nIgnoredSecurityId
))
1090 bool BufferNode::isECOfBeforeModifyInAncestorIncluded(sal_Int32 nIgnoredSecurityId
) const
1091 /****** BufferNode/isECOfBeforeModifyInAncestorIncluded **********************
1094 * isECOfBeforeModifyInAncestorIncluded -- checks whether there is some
1095 * ancestor BufferNode which has ElementCollector with PRI_BEFPREMODIFY
1099 * bExist = isECOfBeforeModifyInAncestorIncluded(nIgnoredSecurityId);
1102 * checks each ancestor BufferNode through the parent link, if there is
1103 * an ElementCollector with PRI_BEFPREMODIFY priority and its
1104 * signatureId is not ignored, then return true, otherwise, false
1108 * nIgnoredSecurityId - the security Id to be ignored. If it equals
1109 * to UNDEFINEDSECURITYID, then no security Id
1113 * bExist - true if a match found, false otherwise.
1116 * 05.01.2004 - implemented
1120 * Email: michael.mi@sun.com
1121 ******************************************************************************/
1125 BufferNode
* pParentNode
= m_pParent
;
1126 while (pParentNode
!= NULL
)
1128 if (pParentNode
->isECOfBeforeModifyIncluded(nIgnoredSecurityId
))
1134 pParentNode
= (BufferNode
*)pParentNode
->getParent();
1140 bool BufferNode::isBlockerInSubTreeIncluded(sal_Int32 nIgnoredSecurityId
) const
1141 /****** BufferNode/isBlockerInSubTreeIncluded ********************************
1144 * isBlockerInSubTreeIncluded -- checks whether there is some BufferNode
1145 * which has blocker on it
1148 * bExist = isBlockerInSubTreeIncluded(nIgnoredSecurityId);
1151 * checks each BufferNode in the branch of this BufferNode, if one has
1152 * a blocker on it, and the blocker's securityId is not ignored, then
1153 * returns true; otherwise, false returns.
1156 * nIgnoredSecurityId - the security Id to be ignored. If it equals
1157 * to UNDEFINEDSECURITYID, then no security Id
1161 * bExist - true if a match found, false otherwise.
1164 * 05.01.2004 - implemented
1168 * Email: michael.mi@sun.com
1169 ******************************************************************************/
1173 std::vector
< const BufferNode
* >::const_iterator ii
= m_vChildren
.begin();
1175 for( ; ii
!= m_vChildren
.end() ; ++ii
)
1177 BufferNode
* pBufferNode
= (BufferNode
*)*ii
;
1178 ElementMark
* pBlocker
= pBufferNode
->getBlocker();
1180 if (pBlocker
!= NULL
&&
1181 (nIgnoredSecurityId
== cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID
||
1182 pBlocker
->getSecurityId() != nIgnoredSecurityId
))
1188 if (rc
|| pBufferNode
->isBlockerInSubTreeIncluded(nIgnoredSecurityId
))
1198 const BufferNode
* BufferNode::getNextChild(const BufferNode
* pChild
) const
1199 /****** BufferNode/getNextChild **********************************************
1202 * getNextChild -- get the next child BufferNode.
1205 * nextChild = getNextChild();
1211 * pChild - the child BufferNode whose next node is retrieved.
1214 * nextChild - the next child BufferNode after the pChild, or NULL if
1218 * 05.01.2004 - implemented
1222 * Email: michael.mi@sun.com
1223 ******************************************************************************/
1225 BufferNode
* rc
= NULL
;
1226 bool bChildFound
= false;
1228 std::vector
< const BufferNode
* >::const_iterator ii
= m_vChildren
.begin();
1229 for( ; ii
!= m_vChildren
.end() ; ++ii
)
1233 rc
= (BufferNode
*)*ii
;
1243 return (const BufferNode
*)rc
;
1247 void BufferNode::freeAllChildren()
1248 /****** BufferNode/freeAllChildren *******************************************
1251 * freeAllChildren -- free all his child BufferNode.
1254 * freeAllChildren();
1266 * 30.03.2004 - the correct the memory leak bug
1270 * Email: michael.mi@sun.com
1271 ******************************************************************************/
1273 std::vector
< const BufferNode
* >::const_iterator ii
= m_vChildren
.begin();
1274 for( ; ii
!= m_vChildren
.end() ; ++ii
)
1276 BufferNode
*pChild
= (BufferNode
*)(*ii
);
1277 pChild
->freeAllChildren();
1281 m_vChildren
.clear();