idltype.cxx (ff7655f0) idltype.cxx (9d8e7fba)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 113 unchanged lines hidden (view full) ---

122 OString typeName;
123 sal_uInt32 index = 0;
124 while (iter != usingSet.end())
125 {
126 typeName = (*iter).m_type;
127 if ((index = typeName.lastIndexOf(']')) > 0)
128 typeName = typeName.copy(index + 1);
129
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 113 unchanged lines hidden (view full) ---

122 OString typeName;
123 sal_uInt32 index = 0;
124 while (iter != usingSet.end())
125 {
126 typeName = (*iter).m_type;
127 if ((index = typeName.lastIndexOf(']')) > 0)
128 typeName = typeName.copy(index + 1);
129
130 if (getBaseType(typeName).getLength() == 0)
130 if ( getBaseType(typeName).isEmpty() )
131 {
132 if (!produceType(typeName,
133 m_typeMgr,
134 m_dependencies,
135 pOptions))
136 {
137 fprintf(stderr, "%s ERROR: %s\n",
138 pOptions->getProgramName().getStr(),

--- 90 unchanged lines hidden (view full) ---

229
230 relType = (*iter).m_type;
231 if (index > 0)
232 relType = relType.copy(index+1);
233
234
235 OString defPrefix("IDL");
236
131 {
132 if (!produceType(typeName,
133 m_typeMgr,
134 m_dependencies,
135 pOptions))
136 {
137 fprintf(stderr, "%s ERROR: %s\n",
138 pOptions->getProgramName().getStr(),

--- 90 unchanged lines hidden (view full) ---

229
230 relType = (*iter).m_type;
231 if (index > 0)
232 relType = relType.copy(index+1);
233
234
235 OString defPrefix("IDL");
236
237 if (getBaseType(relType).getLength() == 0 &&
237 if ( getBaseType(relType).isEmpty() &&
238 m_typeName != relType)
239 {
240 if (m_typeMgr.getTypeClass(relType) == RT_TYPE_INTERFACE)
241 {
242 if (!((*iter).m_use & TYPEUSE_SUPER))
243 {
244 o << "\n";
245 dumpNameSpace(o, sal_True, sal_False, relType);

--- 34 unchanged lines hidden (view full) ---

280 ++iter;
281 }
282}
283
284void IdlType::dumpNameSpace(FileStream& o, sal_Bool bOpen, sal_Bool bFull, const OString& type)
285{
286 OString typeName(type);
287 sal_Bool bOneLine = sal_True;
238 m_typeName != relType)
239 {
240 if (m_typeMgr.getTypeClass(relType) == RT_TYPE_INTERFACE)
241 {
242 if (!((*iter).m_use & TYPEUSE_SUPER))
243 {
244 o << "\n";
245 dumpNameSpace(o, sal_True, sal_False, relType);

--- 34 unchanged lines hidden (view full) ---

280 ++iter;
281 }
282}
283
284void IdlType::dumpNameSpace(FileStream& o, sal_Bool bOpen, sal_Bool bFull, const OString& type)
285{
286 OString typeName(type);
287 sal_Bool bOneLine = sal_True;
288 if (typeName.getLength() == 0)
288 if ( typeName.isEmpty() )
289 {
290 typeName = m_typeName;
291 bOneLine = sal_False;
292 }
293
294 if (typeName == "/")
295 return;
296

--- 54 unchanged lines hidden (view full) ---

351 if (!pReader)
352 {
353 bSelfCheck = sal_False;
354 pReader = &m_reader;
355 }
356
357 sal_uInt32 count = 0;
358 OString superType(pReader->getSuperTypeName());
289 {
290 typeName = m_typeName;
291 bOneLine = sal_False;
292 }
293
294 if (typeName == "/")
295 return;
296

--- 54 unchanged lines hidden (view full) ---

351 if (!pReader)
352 {
353 bSelfCheck = sal_False;
354 pReader = &m_reader;
355 }
356
357 sal_uInt32 count = 0;
358 OString superType(pReader->getSuperTypeName());
359 if (superType.getLength() > 0)
359 if ( !superType.isEmpty() )
360 {
361 TypeReader aSuperReader(m_typeMgr.getTypeReader(superType));
362 if ( aSuperReader.isValid() )
363 {
364 count = checkInheritedMemberCount(&aSuperReader);
365 }
366 }
367

--- 45 unchanged lines hidden (view full) ---

413 //o << "sequence< ";
414 }
415*/
416 switch (typeClass)
417 {
418 case RT_TYPE_INVALID:
419 {
420 OString tmp(getBaseType(relType));
360 {
361 TypeReader aSuperReader(m_typeMgr.getTypeReader(superType));
362 if ( aSuperReader.isValid() )
363 {
364 count = checkInheritedMemberCount(&aSuperReader);
365 }
366 }
367

--- 45 unchanged lines hidden (view full) ---

413 //o << "sequence< ";
414 }
415*/
416 switch (typeClass)
417 {
418 case RT_TYPE_INVALID:
419 {
420 OString tmp(getBaseType(relType));
421 if (tmp.getLength() > 0)
421 if ( !tmp.isEmpty() )
422 {
423 tmp = tmp.replace( ' ', '_' );
424 o << tmp;
425 } else
426 throw CannotDumpException("Unknown type '" + relType + "', incomplete type library.");
427 }
428 break;
429 case RT_TYPE_INTERFACE:

--- 341 unchanged lines hidden (view full) ---

771 dumpDefaultHIncludes(o);
772 o << "\n";
773 dumpDepIncludes(o, m_typeName, "idl");
774 o << "\n";
775 dumpNameSpace(o);
776
777 // write documentation
778 OString aDoc = m_reader.getDoku();
422 {
423 tmp = tmp.replace( ' ', '_' );
424 o << tmp;
425 } else
426 throw CannotDumpException("Unknown type '" + relType + "', incomplete type library.");
427 }
428 break;
429 case RT_TYPE_INTERFACE:

--- 341 unchanged lines hidden (view full) ---

771 dumpDefaultHIncludes(o);
772 o << "\n";
773 dumpDepIncludes(o, m_typeName, "idl");
774 o << "\n";
775 dumpNameSpace(o);
776
777 // write documentation
778 OString aDoc = m_reader.getDoku();
779 if( aDoc.getLength() )
779 if( !aDoc.isEmpty() )
780 o << "/**\n" << aDoc << "\n*/";
781 o << "\ninterface " << m_name;
782
783 OString superType(m_reader.getSuperTypeName());
780 o << "/**\n" << aDoc << "\n*/";
781 o << "\ninterface " << m_name;
782
783 OString superType(m_reader.getSuperTypeName());
784 if (superType.getLength() > 0)
784 if ( !superType.isEmpty() )
785 o << " : " << scopedName(m_typeName, superType);
786
787 o << "\n{\n";
788 inc();
789
790 dumpAttributes(o);
791 dumpMethods(o);
792

--- 30 unchanged lines hidden (view full) ---

823 if (first)
824 {
825 first = sal_False;
826 o << "\n";
827 }
828
829 // write documentation
830 OString aDoc = m_reader.getFieldDoku(i);
785 o << " : " << scopedName(m_typeName, superType);
786
787 o << "\n{\n";
788 inc();
789
790 dumpAttributes(o);
791 dumpMethods(o);
792

--- 30 unchanged lines hidden (view full) ---

823 if (first)
824 {
825 first = sal_False;
826 o << "\n";
827 }
828
829 // write documentation
830 OString aDoc = m_reader.getFieldDoku(i);
831 if( aDoc.getLength() )
831 if( !aDoc.isEmpty() )
832 o << "/**\n" << aDoc << "\n*/\n";
833
834 if (access == RT_ACCESS_READONLY)
835 o << indent() << "readonly attribute ";
836 else
837 o << indent() << "attribute ";
838 dumpType(o, fieldType);
839 o << " " << fieldName << ";\n";

--- 24 unchanged lines hidden (view full) ---

864
865 if ( methodName.equals("acquire") || methodName.equals("release") )
866 {
867 bWithRunTimeExcp = sal_False;
868 }
869
870 // write documentation
871 OString aDoc = m_reader.getMethodDoku(i);
832 o << "/**\n" << aDoc << "\n*/\n";
833
834 if (access == RT_ACCESS_READONLY)
835 o << indent() << "readonly attribute ";
836 else
837 o << indent() << "attribute ";
838 dumpType(o, fieldType);
839 o << " " << fieldName << ";\n";

--- 24 unchanged lines hidden (view full) ---

864
865 if ( methodName.equals("acquire") || methodName.equals("release") )
866 {
867 bWithRunTimeExcp = sal_False;
868 }
869
870 // write documentation
871 OString aDoc = m_reader.getMethodDoku(i);
872 if( aDoc.getLength() )
872 if( !aDoc.isEmpty() )
873 o << "/**\n" << aDoc << "\n*/\n";
874
875 o << indent();
876 dumpType(o, returnType);
877 o << " " << methodName << "( ";
878 sal_uInt16 j;
879 for (j=0; j < paramCount; j++)
880 {

--- 93 unchanged lines hidden (view full) ---

974 if (!pReader)
975 {
976 bSelfCheck = sal_False;
977 pReader = &m_reader;
978 }
979
980 sal_uInt32 count = 0;
981 OString superType(pReader->getSuperTypeName());
873 o << "/**\n" << aDoc << "\n*/\n";
874
875 o << indent();
876 dumpType(o, returnType);
877 o << " " << methodName << "( ";
878 sal_uInt16 j;
879 for (j=0; j < paramCount; j++)
880 {

--- 93 unchanged lines hidden (view full) ---

974 if (!pReader)
975 {
976 bSelfCheck = sal_False;
977 pReader = &m_reader;
978 }
979
980 sal_uInt32 count = 0;
981 OString superType(pReader->getSuperTypeName());
982 if (superType.getLength() > 0)
982 if ( !superType.isEmpty() )
983 {
984 TypeReader aSuperReader(m_typeMgr.getTypeReader(superType));
985 if (aSuperReader.isValid())
986 {
987 count = checkInheritedMemberCount(&aSuperReader);
988 }
989 }
990

--- 262 unchanged lines hidden (view full) ---

1253 o << "\n";
1254 dumpDepIncludes(o, m_typeName, "idl");
1255 o << "\n";
1256
1257 dumpNameSpace(o);
1258
1259 // write documentation
1260 OString aDoc = m_reader.getDoku();
983 {
984 TypeReader aSuperReader(m_typeMgr.getTypeReader(superType));
985 if (aSuperReader.isValid())
986 {
987 count = checkInheritedMemberCount(&aSuperReader);
988 }
989 }
990

--- 262 unchanged lines hidden (view full) ---

1253 o << "\n";
1254 dumpDepIncludes(o, m_typeName, "idl");
1255 o << "\n";
1256
1257 dumpNameSpace(o);
1258
1259 // write documentation
1260 OString aDoc = m_reader.getDoku();
1261 if( aDoc.getLength() )
1261 if( !aDoc.isEmpty() )
1262 o << "/**\n" << aDoc << "\n*/";
1263
1264 o << "\nstruct " << m_name;
1265 o << "\n{\n";
1266 inc();
1267
1268 OString superType(m_reader.getSuperTypeName());
1262 o << "/**\n" << aDoc << "\n*/";
1263
1264 o << "\nstruct " << m_name;
1265 o << "\n{\n";
1266 inc();
1267
1268 OString superType(m_reader.getSuperTypeName());
1269 if (superType.getLength() > 0)
1269 if ( !superType.isEmpty() )
1270 dumpSuperMember(o, superType);
1271
1272 sal_uInt32 fieldCount = m_reader.getFieldCount();
1273 RTFieldAccess access = RT_ACCESS_INVALID;
1274 OString fieldName;
1275 OString fieldType;
1276 sal_uInt16 i=0;
1277

--- 4 unchanged lines hidden (view full) ---

1282 if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
1283 continue;
1284
1285 fieldName = m_reader.getFieldName(i);
1286 fieldType = m_reader.getFieldType(i);
1287
1288 // write documentation
1289 OString aDoc = m_reader.getFieldDoku(i);
1270 dumpSuperMember(o, superType);
1271
1272 sal_uInt32 fieldCount = m_reader.getFieldCount();
1273 RTFieldAccess access = RT_ACCESS_INVALID;
1274 OString fieldName;
1275 OString fieldType;
1276 sal_uInt16 i=0;
1277

--- 4 unchanged lines hidden (view full) ---

1282 if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
1283 continue;
1284
1285 fieldName = m_reader.getFieldName(i);
1286 fieldType = m_reader.getFieldType(i);
1287
1288 // write documentation
1289 OString aDoc = m_reader.getFieldDoku(i);
1290 if( aDoc.getLength() )
1290 if( !aDoc.isEmpty() )
1291 o << "/**\n" << aDoc << "\n*/";
1292
1293 o << indent();
1294 dumpType(o, fieldType);
1295 o << " " << fieldName << ";\n";
1296 }
1297
1298 dec();
1299 o << "};\n\n";
1300
1301 dumpNameSpace(o, sal_False);
1302
1303 o << "#endif /* "<< headerDefine << "*/" << "\n";
1304
1305 return sal_True;
1306}
1307
1308void StructureType::dumpSuperMember(FileStream& o, const OString& superType)
1309{
1291 o << "/**\n" << aDoc << "\n*/";
1292
1293 o << indent();
1294 dumpType(o, fieldType);
1295 o << " " << fieldName << ";\n";
1296 }
1297
1298 dec();
1299 o << "};\n\n";
1300
1301 dumpNameSpace(o, sal_False);
1302
1303 o << "#endif /* "<< headerDefine << "*/" << "\n";
1304
1305 return sal_True;
1306}
1307
1308void StructureType::dumpSuperMember(FileStream& o, const OString& superType)
1309{
1310 if (superType.getLength() > 0)
1310 if ( !superType.isEmpty() )
1311 {
1312 TypeReader aSuperReader(m_typeMgr.getTypeReader(superType));
1313
1314 if (aSuperReader.isValid())
1315 {
1316 dumpSuperMember(o, aSuperReader.getSuperTypeName());
1317
1318 sal_uInt32 fieldCount = aSuperReader.getFieldCount();

--- 7 unchanged lines hidden (view full) ---

1326 if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
1327 continue;
1328
1329 fieldName = aSuperReader.getFieldName(i);
1330 fieldType = aSuperReader.getFieldType(i);
1331
1332 // write documentation
1333 OString aDoc = aSuperReader.getFieldDoku(i);
1311 {
1312 TypeReader aSuperReader(m_typeMgr.getTypeReader(superType));
1313
1314 if (aSuperReader.isValid())
1315 {
1316 dumpSuperMember(o, aSuperReader.getSuperTypeName());
1317
1318 sal_uInt32 fieldCount = aSuperReader.getFieldCount();

--- 7 unchanged lines hidden (view full) ---

1326 if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
1327 continue;
1328
1329 fieldName = aSuperReader.getFieldName(i);
1330 fieldType = aSuperReader.getFieldType(i);
1331
1332 // write documentation
1333 OString aDoc = aSuperReader.getFieldDoku(i);
1334 if( aDoc.getLength() )
1334 if( !aDoc.isEmpty() )
1335 o << "/**\n" << aDoc << "\n*/";
1336
1337 o << indent();
1338 dumpType(o, fieldType);
1339 o << " ";
1340 o << fieldName << ";\n";
1341 }
1342 }

--- 26 unchanged lines hidden (view full) ---

1369 o << "\n";
1370 dumpDepIncludes(o, m_typeName, "idl");
1371 o << "\n";
1372
1373 dumpNameSpace(o);
1374
1375 // write documentation
1376 OString aDoc = m_reader.getDoku();
1335 o << "/**\n" << aDoc << "\n*/";
1336
1337 o << indent();
1338 dumpType(o, fieldType);
1339 o << " ";
1340 o << fieldName << ";\n";
1341 }
1342 }

--- 26 unchanged lines hidden (view full) ---

1369 o << "\n";
1370 dumpDepIncludes(o, m_typeName, "idl");
1371 o << "\n";
1372
1373 dumpNameSpace(o);
1374
1375 // write documentation
1376 OString aDoc = m_reader.getDoku();
1377 if( aDoc.getLength() )
1377 if( !aDoc.isEmpty() )
1378 o << "/**\n" << aDoc << "\n*/";
1379
1380 o << "\nexception " << m_name;
1381 o << "\n{\n";
1382 inc();
1383
1384 // Write extra member for derived exceptions
1385 o << indent() << "/*extra member to hold a derived exception */\n";
1386 o << indent() << "any _derivedException;\n";
1387 OString superType(m_reader.getSuperTypeName());
1378 o << "/**\n" << aDoc << "\n*/";
1379
1380 o << "\nexception " << m_name;
1381 o << "\n{\n";
1382 inc();
1383
1384 // Write extra member for derived exceptions
1385 o << indent() << "/*extra member to hold a derived exception */\n";
1386 o << indent() << "any _derivedException;\n";
1387 OString superType(m_reader.getSuperTypeName());
1388 if (superType.getLength() > 0)
1388 if ( !superType.isEmpty() )
1389 dumpSuperMember(o, superType);
1390
1391 sal_uInt32 fieldCount = m_reader.getFieldCount();
1392 RTFieldAccess access = RT_ACCESS_INVALID;
1393 OString fieldName;
1394 OString fieldType;
1395 sal_uInt16 i = 0;
1396

--- 4 unchanged lines hidden (view full) ---

1401 if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
1402 continue;
1403
1404 fieldName = m_reader.getFieldName(i);
1405 fieldType = m_reader.getFieldType(i);
1406
1407 // write documentation
1408 OString aDoc = m_reader.getFieldDoku(i);
1389 dumpSuperMember(o, superType);
1390
1391 sal_uInt32 fieldCount = m_reader.getFieldCount();
1392 RTFieldAccess access = RT_ACCESS_INVALID;
1393 OString fieldName;
1394 OString fieldType;
1395 sal_uInt16 i = 0;
1396

--- 4 unchanged lines hidden (view full) ---

1401 if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
1402 continue;
1403
1404 fieldName = m_reader.getFieldName(i);
1405 fieldType = m_reader.getFieldType(i);
1406
1407 // write documentation
1408 OString aDoc = m_reader.getFieldDoku(i);
1409 if( aDoc.getLength() )
1409 if( !aDoc.isEmpty() )
1410 o << "/**\n" << aDoc << "\n*/";
1411
1412 o << indent();
1413 dumpType(o, fieldType);
1414 o << " " << fieldName << ";\n";
1415 }
1416
1417

--- 4 unchanged lines hidden (view full) ---

1422
1423 o << "#endif /* "<< headerDefine << "*/" << "\n";
1424
1425 return sal_True;
1426}
1427
1428void ExceptionType::dumpSuperMember(FileStream& o, const OString& superType)
1429{
1410 o << "/**\n" << aDoc << "\n*/";
1411
1412 o << indent();
1413 dumpType(o, fieldType);
1414 o << " " << fieldName << ";\n";
1415 }
1416
1417

--- 4 unchanged lines hidden (view full) ---

1422
1423 o << "#endif /* "<< headerDefine << "*/" << "\n";
1424
1425 return sal_True;
1426}
1427
1428void ExceptionType::dumpSuperMember(FileStream& o, const OString& superType)
1429{
1430 if (superType.getLength() > 0)
1430 if ( !superType.isEmpty() )
1431 {
1432 TypeReader aSuperReader(m_typeMgr.getTypeReader(superType));
1433
1434 if (aSuperReader.isValid())
1435 {
1436 dumpSuperMember(o, aSuperReader.getSuperTypeName());
1437
1438 sal_uInt32 fieldCount = aSuperReader.getFieldCount();

--- 7 unchanged lines hidden (view full) ---

1446 if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
1447 continue;
1448
1449 fieldName = aSuperReader.getFieldName(i);
1450 fieldType = aSuperReader.getFieldType(i);
1451
1452 // write documentation
1453 OString aDoc = aSuperReader.getFieldDoku(i);
1431 {
1432 TypeReader aSuperReader(m_typeMgr.getTypeReader(superType));
1433
1434 if (aSuperReader.isValid())
1435 {
1436 dumpSuperMember(o, aSuperReader.getSuperTypeName());
1437
1438 sal_uInt32 fieldCount = aSuperReader.getFieldCount();

--- 7 unchanged lines hidden (view full) ---

1446 if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID)
1447 continue;
1448
1449 fieldName = aSuperReader.getFieldName(i);
1450 fieldType = aSuperReader.getFieldType(i);
1451
1452 // write documentation
1453 OString aDoc = aSuperReader.getFieldDoku(i);
1454 if( aDoc.getLength() )
1454 if( !aDoc.isEmpty() )
1455 o << "/**\n" << aDoc << "\n*/";
1456
1457 o << indent();
1458 dumpType(o, fieldType);
1459 o << " ";
1460 o << fieldName << ";\n";
1461 }
1462 }

--- 24 unchanged lines hidden (view full) ---

1487
1488 dumpDefaultHIncludes(o);
1489 o << "\n";
1490
1491 dumpNameSpace(o);
1492
1493 // write documentation
1494 OString aDoc = m_reader.getDoku();
1455 o << "/**\n" << aDoc << "\n*/";
1456
1457 o << indent();
1458 dumpType(o, fieldType);
1459 o << " ";
1460 o << fieldName << ";\n";
1461 }
1462 }

--- 24 unchanged lines hidden (view full) ---

1487
1488 dumpDefaultHIncludes(o);
1489 o << "\n";
1490
1491 dumpNameSpace(o);
1492
1493 // write documentation
1494 OString aDoc = m_reader.getDoku();
1495 if( aDoc.getLength() )
1495 if( !aDoc.isEmpty() )
1496 o << "/**\n" << aDoc << "\n*/";
1497
1498 o << "\nenum " << m_name << "\n{\n";
1499 inc();
1500
1501 sal_uInt32 fieldCount = m_reader.getFieldCount();
1502 RTFieldAccess access = RT_ACCESS_INVALID;
1503 RTConstValue constValue;

--- 245 unchanged lines hidden ---
1496 o << "/**\n" << aDoc << "\n*/";
1497
1498 o << "\nenum " << m_name << "\n{\n";
1499 inc();
1500
1501 sal_uInt32 fieldCount = m_reader.getFieldCount();
1502 RTFieldAccess access = RT_ACCESS_INVALID;
1503 RTConstValue constValue;

--- 245 unchanged lines hidden ---