1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-07 18:30:55 +03:00
occt/src/StepData/StepData_ECDescr.cxx
bugmster 973c2be1e1 0024428: Implementation of LGPL license
The copying permission statements at the beginning of source files updated to refer to LGPL.
Copyright dates extended till 2014 in advance.
2013-12-17 12:42:41 +04:00

75 lines
2.5 KiB
C++

// 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 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.
#include <StepData_ECDescr.ixx>
#include <TCollection_AsciiString.hxx>
#include <StepData_Plex.hxx>
StepData_ECDescr::StepData_ECDescr () { }
void StepData_ECDescr::Add (const Handle(StepData_ESDescr)& member)
{
if (member.IsNull()) return;
Standard_CString name = member->TypeName();
TCollection_AsciiString nam (name);
for (Standard_Integer i = NbMembers(); i > 0; i --) {
Handle(StepData_ESDescr) mem = Member(i);
if (nam.IsLess (mem->TypeName())) { thelist.InsertBefore (i,member); return; }
}
thelist.Append (member);
}
Standard_Integer StepData_ECDescr::NbMembers () const
{ return thelist.Length(); }
Handle(StepData_ESDescr) StepData_ECDescr::Member
(const Standard_Integer num) const
{ return Handle(StepData_ESDescr)::DownCast (thelist.Value(num)); }
Handle(TColStd_HSequenceOfAsciiString) StepData_ECDescr::TypeList () const
{
Handle(TColStd_HSequenceOfAsciiString) tl = new TColStd_HSequenceOfAsciiString();
Standard_Integer i, nb = NbMembers();
for (i = 1; i <= nb; i ++) {
TCollection_AsciiString nam (Member(i)->TypeName());
tl->Append(nam);
}
return tl;
}
Standard_Boolean StepData_ECDescr::Matches (const Standard_CString name) const
{
Standard_Integer i, nb = NbMembers();
for (i = 1; i <= nb; i ++) {
Handle(StepData_ESDescr) member = Member(i);
if (member->Matches(name)) return Standard_True;
}
return Standard_False;
}
Standard_Boolean StepData_ECDescr::IsComplex () const
{ return Standard_True; }
Handle(StepData_Described) StepData_ECDescr::NewEntity () const
{
Handle(StepData_Plex) ent = new StepData_Plex (this);
Standard_Integer i, nb = NbMembers();
for (i = 1; i <= nb; i ++) {
Handle(StepData_ESDescr) member = Member(i);
Handle(StepData_Simple) mem = Handle(StepData_Simple)::DownCast(member->NewEntity());
if (!mem.IsNull()) ent->Add (mem);
}
return ent;
}