1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-06-30 12:14:08 +03:00
occt/src/Transfer/Transfer_Iterator.gxx
ski 9775fa6110 0026937: Eliminate NO_CXX_EXCEPTION macro support
Macro NO_CXX_EXCEPTION was removed from code.
Method Raise() was replaced by explicit throw statement.
Method Standard_Failure::Caught() was replaced by normal C++mechanism of exception transfer.
Method Standard_Failure::Caught() is deprecated now.
Eliminated empty constructors.
Updated samples.
Eliminate empty method ChangeValue from NCollection_Map class.
Removed not operable methods from NCollection classes.
2017-02-02 16:35:54 +03:00

74 lines
2.4 KiB
Plaintext

// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// 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, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// Transfer_Iterator.gxx
#include <Standard_NoSuchObject.hxx>
// TheStart est suppose Handle(Standard_Transient) ou (Transfer_Finder)
// Il a servi a instancier TheList qui est une HSequence
Transfer_Iterator::Transfer_Iterator (const Standard_Boolean withstarts)
: Transfer_TransferIterator ()
{ if (withstarts) thestarts = new TheList(); }
void Transfer_Iterator::Add
(const Handle(Transfer_Binder)& binder)
{
if (!thestarts.IsNull()) throw Standard_NoSuchObject("Transfer_Iterator : Add, Starting Object required not provided");
AddItem(binder);
}
void Transfer_Iterator::Add
(const Handle(Transfer_Binder)& binder, const TheStart& start)
{
AddItem(binder);
if (!thestarts.IsNull()) thestarts->Append(start);
}
void Transfer_Iterator::Filter
(const Handle(TheList)& list, const Standard_Boolean keep)
{
if (list.IsNull() || thestarts.IsNull()) return;
Standard_Integer i, j, nb = thestarts->Length();
if (nb == 0) return;
Handle(Transfer_Binder) factice;
Transfer_TransferMap amap (nb);
for (i = 1; i <= nb; i ++) {
j = amap.Add (thestarts->Value(i),factice);
SelectItem (j,!keep);
}
// Comparaison
nb = list->Length();
for (i = 1; i <= nb; i ++) {
j = amap.FindIndex (list->Value(i));
if (j > 0) SelectItem (j,keep);
}
}
Standard_Boolean Transfer_Iterator::HasStarting () const
{ return (!thestarts.IsNull()); }
const TheStart& Transfer_Iterator::Starting () const
{
// if (thecurr == 0 || thecurr > themaxi) throw Standard_NoSuchObject
// ("TransferIterator : Starting");
// if (theselect->Value(thecurr) == 0) throw Standard_NoSuchObject
// ("TransferIterator : Starting");
if (thestarts.IsNull()) throw Standard_NoSuchObject("TransferIterator : No Starting defined at all");
return thestarts->Value(thecurr);
}