0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / StepData / StepData_ECDescr.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 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
973c2be1 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.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
b311480e 13
42cf5bc1 14
15#include <Standard_Type.hxx>
16#include <StepData_Described.hxx>
17#include <StepData_ECDescr.hxx>
ec357c5c 18#include <StepData_ESDescr.hxx>
42cf5bc1 19#include <StepData_Plex.hxx>
ec357c5c 20#include <StepData_Simple.hxx>
42cf5bc1 21#include <TCollection_AsciiString.hxx>
7fd59977 22
92efcf78 23IMPLEMENT_STANDARD_RTTIEXT(StepData_ECDescr,StepData_EDescr)
24
b311480e 25StepData_ECDescr::StepData_ECDescr () { }
7fd59977 26
27 void StepData_ECDescr::Add (const Handle(StepData_ESDescr)& member)
28{
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; }
35 }
36 thelist.Append (member);
37}
38
39 Standard_Integer StepData_ECDescr::NbMembers () const
40 { return thelist.Length(); }
41
42 Handle(StepData_ESDescr) StepData_ECDescr::Member
43 (const Standard_Integer num) const
44 { return Handle(StepData_ESDescr)::DownCast (thelist.Value(num)); }
45
46 Handle(TColStd_HSequenceOfAsciiString) StepData_ECDescr::TypeList () const
47{
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());
52 tl->Append(nam);
53 }
54 return tl;
55}
56
57
58 Standard_Boolean StepData_ECDescr::Matches (const Standard_CString name) const
59{
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;
64 }
65 return Standard_False;
66}
67
68 Standard_Boolean StepData_ECDescr::IsComplex () const
69 { return Standard_True; }
70
71 Handle(StepData_Described) StepData_ECDescr::NewEntity () const
72{
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);
79 }
80 return ent;
81}