0025367: IGES and BRep persistence - support unicode file names on Windows
[occt.git] / src / IFSelect / IFSelect_WorkLibrary.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
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.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #include <IFSelect_WorkLibrary.ixx>
15 #include <TCollection_HAsciiString.hxx>
16
17 #include <Message_Messenger.hxx>
18 #include <Message.hxx>
19
20 //  all deferred but Copy (virtual default)
21
22 IFSelect_WorkLibrary::IFSelect_WorkLibrary ()  {  thelevdef = 0;  }
23
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
29 {
30   for (list.Start(); list.More(); list.Next())
31     TC.TransferEntity (list.Value());
32
33   TC.FillModel(newmodel);
34
35   return Standard_True;
36 }
37
38
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
44 {
45   if (thelevhlp.IsNull()) DumpEntity (model,protocol,entity,S,0);
46   else                    DumpEntity (model,protocol,entity,S,thelevdef);
47 }
48
49
50     void  IFSelect_WorkLibrary::SetDumpLevels
51   (const Standard_Integer def, const Standard_Integer max)
52 {
53   thelevdef = def;
54   thelevhlp.Nullify();
55   if (max >= 0) thelevhlp = new Interface_HArray1OfHAsciiString (0,max);
56 }
57
58     void  IFSelect_WorkLibrary::DumpLevels
59   (Standard_Integer& def, Standard_Integer& max) const
60 {
61   def = thelevdef;
62   if (thelevhlp.IsNull()) {  def = 0;  max = -1;  }
63   else max = thelevhlp->Upper();
64 }
65
66     void  IFSelect_WorkLibrary::SetDumpHelp
67   (const Standard_Integer level, const Standard_CString help)
68 {
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);
73 }
74
75     Standard_CString  IFSelect_WorkLibrary::DumpHelp
76   (const Standard_Integer level) const
77 {
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();
83 }