2 # Copyright (C) 2010-2014 CEA/DEN, EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 ffile = "PARAVIS_CreateClass.cxx"
25 wfile = os.path.join(sys.argv[1], "wrapfiles.txt")
27 ffile_stream = open(ffile, "w")
29 ffile_stream.write('#include <iostream>' + '\n')
30 ffile_stream.write('#include <QString>' + '\n')
31 ffile_stream.write('#include "PARAVIS_Gen_i.hh"' + '\n')
32 wfile_stream = open(wfile)
33 for line in wfile_stream:
34 if line.split()[0] == "vtkWebGLExporter" :
35 ffile_stream.write('#ifdef WIN32\n')
36 ffile_stream.write(' #ifdef GetObject\n')
37 ffile_stream.write(' #undef GetObject\n')
38 ffile_stream.write(' #endif\n')
39 ffile_stream.write('#endif\n')
41 ffile_stream.write('#include "PARAVIS_Gen_%s_i.hh"'%(line.split()[0]) + '\n')
44 ffile_stream.write('' + '\n')
45 ffile_stream.write('PARAVIS::PARAVIS_Base_i* CreateInstance(::vtkObjectBase* Inst, const QString& theClassName)' + '\n')
46 ffile_stream.write('{' + '\n')
47 wfile_stream = open(wfile)
49 for line in wfile_stream:
50 lst.append(line.split()[0])
55 ffile_stream.write(' if(theClassName == "%s" || (Inst != NULL && Inst->IsA("%s")))'%(item, item) + '\n')
56 ffile_stream.write(' return new PARAVIS::%s_i();'%(item) + '\n')
58 ffile_stream.write('' + '\n')
59 ffile_stream.write(' cerr << "The class " << theClassName.toStdString() << " is not created!" << endl;' + '\n')
60 ffile_stream.write(' return new PARAVIS::PARAVIS_Base_i();' + '\n')
61 ffile_stream.write('}' + '\n')