Salome HOME
Base implementation of Notebook
[modules/kernel.git] / src / ModuleCatalog / SALOME_ModuleCatalog_Parser_IO.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  SALOME ModuleCatalog : implementation of ModuleCatalog server which parsers xml description of modules
23 //  File   : SALOME_ModuleCatalog_Parser_IO.cxx
24 //  Author : Estelle Deville
25 //  Module : SALOME
26 //  $Header$
27 //
28 #include "SALOME_ModuleCatalog_Parser_IO.hxx"
29 #include <string>
30 #include <iostream>
31 #include "utilities.h"
32
33 using namespace std;
34
35 std::ostream & operator<< (std::ostream & f, const ParserParameter & P)
36 {
37   f << "          name :       " << P.name << std::endl;
38   f << "          type :       " << P.type << std::endl;
39   return f;
40 }
41
42 std::ostream & operator<< (std::ostream & f, 
43                            const ParserDataStreamParameter & P)
44 {
45   f << "          name :       " << P.name << std::endl;
46   f << "          type :       " << P.type << std::endl;
47   f << "          dependency : " << P.dependency << std::endl;
48   return f;
49 }
50
51 std::ostream & operator<< (std::ostream & f, 
52                            const ParserService & S)
53 {
54   int i, n;
55   f << "      name :       " << S.name << std::endl;
56   f << "      default :    " << (S.byDefault ? "yes" : "no") 
57     << std::endl;
58
59   n = S.inParameters.size();
60   f << "      in parameters : " << n << std::endl;
61   for (i=0; i<n; i++)
62     f << S.inParameters[i] << std::endl;
63   if (n == 0) f << std::endl;
64
65   n = S.inDataStreamParameters.size();
66   f << "      in DataStream parameters : " << n << std::endl;
67   for (i=0; i<n; i++)
68     f << S.inDataStreamParameters[i] << std::endl;
69   if (n == 0) f << std::endl;
70
71   n = S.outParameters.size();
72   f << "      out parameters : " << n << std::endl;
73   for (i=0; i<n; i++)
74     f << S.outParameters[i] << std::endl;
75   if (n == 0) f << std::endl;
76
77   n = S.outDataStreamParameters.size();
78   f << "      out DataStream parameters : " << n << std::endl;
79   for (i=0; i<n; i++)
80     f << S.outDataStreamParameters[i] << std::endl;
81   if (n == 0) f << std::endl;
82
83   return f;
84 }
85
86 std::ostream & operator<< (std::ostream & f, 
87                            const ParserInterface & I)
88 {
89   int j, n;
90   f << "    name :       " << I.name << std::endl;
91
92   n = I.services.size();
93   f << "    services : " << n << std::endl;
94   for (j=0; j<n; j++) {
95     MESSAGE(I.services[j].name);
96     f << I.services[j] << std::endl;
97   }
98
99   return f;
100 }
101
102 std::ostream & operator<< (std::ostream & f, 
103                            const  ParserComponentType & T)
104 {
105   std::string s;
106   switch (T) {
107   case GEOM :   s = "GEOM"; break;
108   case MESH :   s = "MESH"; break;
109   case Med  :   s = "Med"; break;
110   case SOLVER : s = "SOLVER"; break;
111   case DATA :   s = "DATA"; break;
112   case VISU :   s = "VISU"; break;
113   case SUPERV : s = "SUPERV"; break;
114   default :     s = "OTHER"; break;
115   }
116   f << s << std::endl;
117   return f;
118 }
119
120 std::ostream & operator<< (std::ostream & f, 
121                            const ParserComponent & C)
122 {
123   int j, n;
124   f << std::endl
125     << "    name :       " << C.name << std::endl;
126   f << "    user name :  " << C.username << std::endl;
127   f << "    type :       " << C.type << std::endl;
128   f << "    multistudy : " << (C.multistudy ? "yes" : "no")
129     << std::endl;
130   f << "    icon :       " << C.icon << std::endl;
131   f << "    constraint : " << C.constraint << std::endl;
132
133   n = C.interfaces.size();
134   f << "    interfaces : " << n << std::endl;
135   for (j=0; j<n; j++)
136     f << C.interfaces[j] << std::endl;
137   if (n == 0) f << std::endl;
138
139   return f;
140 }
141
142