Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-29 09:20:54

0001 // Created by: DAUTRY Philippe
0002 // Copyright (c) 1997-1999 Matra Datavision
0003 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _TDF_ChildIterator_HeaderFile
0017 #define _TDF_ChildIterator_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 #include <Standard_Handle.hxx>
0022 
0023 #include <Standard_Boolean.hxx>
0024 #include <TDF_Label.hxx>
0025 class TDF_Label;
0026 
0027 //! Iterates on the children of a label, at the first
0028 //! level only. It is possible to ask the iterator to
0029 //! explore all the sub label levels of the given one,
0030 //! with the option "allLevels".
0031 class TDF_ChildIterator
0032 {
0033 public:
0034   DEFINE_STANDARD_ALLOC
0035 
0036   //! Creates an empty iterator object to
0037   //! explore the children of a label.
0038   Standard_EXPORT TDF_ChildIterator();
0039 
0040   //! Constructs the iterator object defined by
0041   //! the label aLabel. Iterates on the children of the given label. If
0042   //! <allLevels> option is set to true, it explores not
0043   //! only the first, but all the sub label levels.
0044   Standard_EXPORT TDF_ChildIterator(const TDF_Label& aLabel, const bool allLevels = false);
0045 
0046   //! Initializes the iteration on the children of the
0047   //! given label.
0048   //! If <allLevels> option is set to true,
0049   //! it explores not only the first, but all the sub
0050   //! label levels.
0051   //! If allLevels is false, only the first level of
0052   //! child labels is explored.
0053   //! In the example below, the label is iterated
0054   //! using Initialize, More and Next and its
0055   //! child labels dumped using TDF_Tool::Entry.
0056   //! Example
0057   //! void DumpChildren(const
0058   //! TDF_Label& aLabel)
0059   //! {
0060   //! TDF_ChildIterator it;
0061   //! TCollection_AsciiString es;
0062   //! for
0063   //! (it.Initialize(aLabel,true);
0064   //! it.More(); it.Next()){
0065   //! TDF_Tool::Entry(it.Value(),es);
0066   //! std::cout << as.ToCString() << std::endl;
0067   //! }
0068   //! }
0069   Standard_EXPORT void Initialize(const TDF_Label& aLabel, const bool allLevels = false);
0070 
0071   //! Returns true if a current label is found in the
0072   //! iteration process.
0073   bool More() const;
0074 
0075   //! Move the current iteration to the next Item.
0076   Standard_EXPORT void Next();
0077 
0078   //! Moves this iteration to the next brother
0079   //! label. A brother label is one with the same
0080   //! father as an initial label.
0081   //! Use this function when the non-empty
0082   //! constructor or Initialize has allLevels set to
0083   //! true. The result is that the iteration does not
0084   //! explore the children of the current label.
0085   //! This method is interesting only with
0086   //! "allLevels" behavior, because it avoids to explore
0087   //! the current label children.
0088   Standard_EXPORT void NextBrother();
0089 
0090   //! Returns the current label; or, if there is
0091   //! none, a null label.
0092   const TDF_Label Value() const;
0093 
0094 private:
0095   TDF_LabelNodePtr myNode;
0096   int              myFirstLevel;
0097 };
0098 
0099 #include <TDF_ChildIterator.lxx>
0100 
0101 #endif // _TDF_ChildIterator_HeaderFile