b311480e |
1 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
2 | // |
3 | // The content of this file is subject to the Open CASCADE Technology Public |
4 | // License Version 6.5 (the "License"). You may not use the content of this file |
5 | // except in compliance with the License. Please obtain a copy of the License |
6 | // at http://www.opencascade.org and read it completely before using this file. |
7 | // |
8 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
9 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
10 | // |
11 | // The Original Code and all software distributed under the License is |
12 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
13 | // Initial Developer hereby disclaims all such warranties, including without |
14 | // limitation, any warranties of merchantability, fitness for a particular |
15 | // purpose or non-infringement. Please see the License for the specific terms |
16 | // and conditions governing the rights and limitations under the License. |
17 | |
7fd59977 |
18 | #include <StepData_ECDescr.ixx> |
19 | #include <TCollection_AsciiString.hxx> |
20 | #include <StepData_Plex.hxx> |
21 | |
b311480e |
22 | StepData_ECDescr::StepData_ECDescr () { } |
7fd59977 |
23 | |
24 | void StepData_ECDescr::Add (const Handle(StepData_ESDescr)& member) |
25 | { |
26 | if (member.IsNull()) return; |
27 | Standard_CString name = member->TypeName(); |
28 | TCollection_AsciiString nam (name); |
29 | for (Standard_Integer i = NbMembers(); i > 0; i --) { |
30 | Handle(StepData_ESDescr) mem = Member(i); |
31 | if (nam.IsLess (mem->TypeName())) { thelist.InsertBefore (i,member); return; } |
32 | } |
33 | thelist.Append (member); |
34 | } |
35 | |
36 | Standard_Integer StepData_ECDescr::NbMembers () const |
37 | { return thelist.Length(); } |
38 | |
39 | Handle(StepData_ESDescr) StepData_ECDescr::Member |
40 | (const Standard_Integer num) const |
41 | { return Handle(StepData_ESDescr)::DownCast (thelist.Value(num)); } |
42 | |
43 | Handle(TColStd_HSequenceOfAsciiString) StepData_ECDescr::TypeList () const |
44 | { |
45 | Handle(TColStd_HSequenceOfAsciiString) tl = new TColStd_HSequenceOfAsciiString(); |
46 | Standard_Integer i, nb = NbMembers(); |
47 | for (i = 1; i <= nb; i ++) { |
48 | TCollection_AsciiString nam (Member(i)->TypeName()); |
49 | tl->Append(nam); |
50 | } |
51 | return tl; |
52 | } |
53 | |
54 | |
55 | Standard_Boolean StepData_ECDescr::Matches (const Standard_CString name) const |
56 | { |
57 | Standard_Integer i, nb = NbMembers(); |
58 | for (i = 1; i <= nb; i ++) { |
59 | Handle(StepData_ESDescr) member = Member(i); |
60 | if (member->Matches(name)) return Standard_True; |
61 | } |
62 | return Standard_False; |
63 | } |
64 | |
65 | Standard_Boolean StepData_ECDescr::IsComplex () const |
66 | { return Standard_True; } |
67 | |
68 | Handle(StepData_Described) StepData_ECDescr::NewEntity () const |
69 | { |
70 | Handle(StepData_Plex) ent = new StepData_Plex (this); |
71 | Standard_Integer i, nb = NbMembers(); |
72 | for (i = 1; i <= nb; i ++) { |
73 | Handle(StepData_ESDescr) member = Member(i); |
74 | Handle(StepData_Simple) mem = Handle(StepData_Simple)::DownCast(member->NewEntity()); |
75 | if (!mem.IsNull()) ent->Add (mem); |
76 | } |
77 | return ent; |
78 | } |