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 <IFSelect_WorkLibrary.ixx> |
19 | #include <TCollection_HAsciiString.hxx> |
20 | |
21 | #include <Message_Messenger.hxx> |
22 | #include <Message.hxx> |
b311480e |
23 | |
7fd59977 |
24 | // all deferred but Copy (virtual default) |
25 | |
b311480e |
26 | IFSelect_WorkLibrary::IFSelect_WorkLibrary () { thelevdef = 0; } |
7fd59977 |
27 | |
28 | Standard_Boolean IFSelect_WorkLibrary::CopyModel |
29 | (const Handle(Interface_InterfaceModel)& /*original*/, |
30 | const Handle(Interface_InterfaceModel)& newmodel, |
31 | const Interface_EntityIterator& list, |
32 | Interface_CopyTool& TC) const |
33 | { |
34 | for (list.Start(); list.More(); list.Next()) |
35 | TC.TransferEntity (list.Value()); |
36 | |
37 | TC.FillModel(newmodel); |
38 | |
39 | return Standard_True; |
40 | } |
41 | |
42 | |
43 | void IFSelect_WorkLibrary::DumpEntity |
44 | (const Handle(Interface_InterfaceModel)& model, |
45 | const Handle(Interface_Protocol)& protocol, |
46 | const Handle(Standard_Transient)& entity, |
47 | const Handle(Message_Messenger)& S) const |
48 | { |
49 | if (thelevhlp.IsNull()) DumpEntity (model,protocol,entity,S,0); |
50 | else DumpEntity (model,protocol,entity,S,thelevdef); |
51 | } |
52 | |
53 | |
54 | void IFSelect_WorkLibrary::SetDumpLevels |
55 | (const Standard_Integer def, const Standard_Integer max) |
56 | { |
57 | thelevdef = def; |
58 | thelevhlp.Nullify(); |
59 | if (max >= 0) thelevhlp = new Interface_HArray1OfHAsciiString (0,max); |
60 | } |
61 | |
62 | void IFSelect_WorkLibrary::DumpLevels |
63 | (Standard_Integer& def, Standard_Integer& max) const |
64 | { |
65 | def = thelevdef; |
66 | if (thelevhlp.IsNull()) { def = 0; max = -1; } |
67 | else max = thelevhlp->Upper(); |
68 | } |
69 | |
70 | void IFSelect_WorkLibrary::SetDumpHelp |
71 | (const Standard_Integer level, const Standard_CString help) |
72 | { |
73 | if (thelevhlp.IsNull()) return; |
74 | if (level < 0 || level > thelevhlp->Upper()) return; |
75 | Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString (help); |
76 | thelevhlp->SetValue (level,str); |
77 | } |
78 | |
79 | Standard_CString IFSelect_WorkLibrary::DumpHelp |
80 | (const Standard_Integer level) const |
81 | { |
82 | if (thelevhlp.IsNull()) return ""; |
83 | if (level < 0 || level > thelevhlp->Upper()) return ""; |
84 | Handle(TCollection_HAsciiString) str = thelevhlp->Value (level); |
85 | if (str.IsNull()) return ""; |
86 | return str->ToCString(); |
87 | } |