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.
14 #include <IFSelect_WorkLibrary.ixx>
15 #include <TCollection_HAsciiString.hxx>
17 #include <Message_Messenger.hxx>
18 #include <Message.hxx>
20 // all deferred but Copy (virtual default)
22 IFSelect_WorkLibrary::IFSelect_WorkLibrary () { thelevdef = 0; }
24 Standard_Boolean IFSelect_WorkLibrary::CopyModel
25 (const Handle(Interface_InterfaceModel)& /*original*/,
26 const Handle(Interface_InterfaceModel)& newmodel,
27 const Interface_EntityIterator& list,
28 Interface_CopyTool& TC) const
30 for (list.Start(); list.More(); list.Next())
31 TC.TransferEntity (list.Value());
33 TC.FillModel(newmodel);
39 void IFSelect_WorkLibrary::DumpEntity
40 (const Handle(Interface_InterfaceModel)& model,
41 const Handle(Interface_Protocol)& protocol,
42 const Handle(Standard_Transient)& entity,
43 const Handle(Message_Messenger)& S) const
45 if (thelevhlp.IsNull()) DumpEntity (model,protocol,entity,S,0);
46 else DumpEntity (model,protocol,entity,S,thelevdef);
50 void IFSelect_WorkLibrary::SetDumpLevels
51 (const Standard_Integer def, const Standard_Integer max)
55 if (max >= 0) thelevhlp = new Interface_HArray1OfHAsciiString (0,max);
58 void IFSelect_WorkLibrary::DumpLevels
59 (Standard_Integer& def, Standard_Integer& max) const
62 if (thelevhlp.IsNull()) { def = 0; max = -1; }
63 else max = thelevhlp->Upper();
66 void IFSelect_WorkLibrary::SetDumpHelp
67 (const Standard_Integer level, const Standard_CString help)
69 if (thelevhlp.IsNull()) return;
70 if (level < 0 || level > thelevhlp->Upper()) return;
71 Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString (help);
72 thelevhlp->SetValue (level,str);
75 Standard_CString IFSelect_WorkLibrary::DumpHelp
76 (const Standard_Integer level) const
78 if (thelevhlp.IsNull()) return "";
79 if (level < 0 || level > thelevhlp->Upper()) return "";
80 Handle(TCollection_HAsciiString) str = thelevhlp->Value (level);
81 if (str.IsNull()) return "";
82 return str->ToCString();