1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #include <Standard_Type.hxx>
16 #include <StepData_Described.hxx>
17 #include <StepData_ECDescr.hxx>
18 #include <StepData_ESDescr.hxx>
19 #include <StepData_Plex.hxx>
20 #include <StepData_Simple.hxx>
21 #include <TCollection_AsciiString.hxx>
23 IMPLEMENT_STANDARD_RTTIEXT(StepData_ECDescr,StepData_EDescr)
25 StepData_ECDescr::StepData_ECDescr () { }
27 void StepData_ECDescr::Add (const Handle(StepData_ESDescr)& member)
29 if (member.IsNull()) return;
30 Standard_CString name = member->TypeName();
31 TCollection_AsciiString nam (name);
32 for (Standard_Integer i = NbMembers(); i > 0; i --) {
33 Handle(StepData_ESDescr) mem = Member(i);
34 if (nam.IsLess (mem->TypeName())) { thelist.InsertBefore (i,member); return; }
36 thelist.Append (member);
39 Standard_Integer StepData_ECDescr::NbMembers () const
40 { return thelist.Length(); }
42 Handle(StepData_ESDescr) StepData_ECDescr::Member
43 (const Standard_Integer num) const
44 { return Handle(StepData_ESDescr)::DownCast (thelist.Value(num)); }
46 Handle(TColStd_HSequenceOfAsciiString) StepData_ECDescr::TypeList () const
48 Handle(TColStd_HSequenceOfAsciiString) tl = new TColStd_HSequenceOfAsciiString();
49 Standard_Integer i, nb = NbMembers();
50 for (i = 1; i <= nb; i ++) {
51 TCollection_AsciiString nam (Member(i)->TypeName());
58 Standard_Boolean StepData_ECDescr::Matches (const Standard_CString name) const
60 Standard_Integer i, nb = NbMembers();
61 for (i = 1; i <= nb; i ++) {
62 Handle(StepData_ESDescr) member = Member(i);
63 if (member->Matches(name)) return Standard_True;
65 return Standard_False;
68 Standard_Boolean StepData_ECDescr::IsComplex () const
69 { return Standard_True; }
71 Handle(StepData_Described) StepData_ECDescr::NewEntity () const
73 Handle(StepData_Plex) ent = new StepData_Plex (this);
74 Standard_Integer i, nb = NbMembers();
75 for (i = 1; i <= nb; i ++) {
76 Handle(StepData_ESDescr) member = Member(i);
77 Handle(StepData_Simple) mem = Handle(StepData_Simple)::DownCast(member->NewEntity());
78 if (!mem.IsNull()) ent->Add (mem);